/* start date validation function */

	/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}
/* end of date validation function */


function alphanumeric(alphane)
{
	var numaric = alphane;
	for(var j=0; j<numaric.length; j++)
	{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
 			 return true;
		  }
		  else
		  {
			 return false;
		  }
 	}

}


function days_between(value1,value2)
{
	var day1, day2;
	var month1, month2;
	var year1, year2;
	
	day1 = value1.substring (0, value1.indexOf ("/"));
	month1 = value1.substring (value1.indexOf ("/")+1, value1.lastIndexOf ("/"));
	year1 = value1.substring (value1.lastIndexOf ("/")+1, value1.length);
	
	day2 = value2.substring (0, value2.indexOf ("/"));
	month2 = value2.substring (value2.indexOf ("/")+1, value2.lastIndexOf ("/"));
	year2 = value2.substring (value2.lastIndexOf ("/")+1, value2.length);
	
	date1 = year1+"/"+month1+"/"+day1;
	date2 = year2+"/"+month2+"/"+day2;
	
	firstDate = Date.parse(date1)
	secondDate= Date.parse(date2)
	
	msPerDay = 24 * 60 * 60 * 1000
	dbd = Math.round((secondDate.valueOf()-firstDate.valueOf())/ msPerDay) + 1;
	
	if(dbd > 0)
	{
		return false;
	}
	else
	{
		return true;
	}

}



/* start get type */
function getFileType(imgpath)
{
	if(imgpath != "")

	{
	
	// code to get File Extension..
	
		var arr1 = new Array;	
		arr1 = imgpath.split("\\");	
		var len = arr1.length;	
		var img1 = arr1[len-1];	
		var filext = img1.substring(img1.lastIndexOf(".")+1);
		
		// Checking Extension
		
		if(filext == "jpg" || filext == "jpeg" || filext == "gif" || filext == "pjpeg" || filext == "x-png")
		{
			return true;
		}
		
		else	
		{
			return false;
		}
	
	}
}
/* end get type */


/* start get type */
function getVedioType(imgpath)
{
	if(imgpath != "")

	{
	
	// code to get File Extension..
	
		var arr1 = new Array;	
		arr1 = imgpath.split("\\");	
		var len = arr1.length;	
		var img1 = arr1[len-1];	
		var filext = img1.substring(img1.lastIndexOf(".")+1);
		
		// Checking Extension
		
		if(filext == "flv")
		{
			return true;
		}
		
		else	
		{
			return false;
		}
	
	}
}
/* end get type */




function trim(str) 
        { 
            return str.replace(/^\s+|\s+$/g,''); 
        }
		
/* start of change password page */	

/* start of sign up validation */

function signup_validation()
{
	var username=document.getElementById("textfield_username");
	if(trim(username.value)=='')
		{
		alert("Please enter your username");
		username.focus();
		return false;
		}
	
	
	var divusername=document.getElementById("username").innerHTML;
	if(divusername=='username already exits')
		{
		alert("This username already exits.Please enter some another username");
		username.focus();
		return false;
		}
		
	var password=document.getElementById("textfield_password");
	if(trim(password.value)=='')
		{
		alert("Please enter your password");
		password.focus();
		return false;
		}
		
	var name=document.getElementById("textfield_name");
	if(trim(name.value)=='')
		{
		alert("Please enter your full name");
		name.focus();
		return false;
		}	
	
	var email=document.getElementById("textfield_email");
	if(trim(email.value)=='')
		{
		alert("Please enter Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
	var mail=document.getElementById("mail").innerHTML;
	if(mail=='This email address already exits')
		{
		alert("This email address already exits.Please enter some another email id");
		email.focus();
		return false;
		}
		
		
	var country=document.getElementById("select_country");
	if(trim(country.value)=='')
		{
		alert("Please select the country name");
		country.focus();
		return false;
		}
		
	var state=document.getElementById("select_state");
	if(trim(state.value)=='')
		{
		alert("Please select the state name");
		state.focus();
		return false;
		}
		
	var city=document.getElementById("textfield_city");
	if(trim(city.value)=='')
		{
		alert("Please enter the city name");
		city.focus();
		return false;
		}
		
	var zip=document.getElementById("textfield_zip");
	if(trim(zip.value)=='')
		{
		alert("Please enter the zip code");
		zip.focus();
		return false;
		}
		
	else
	{
		if(!alphanumeric(zip.value))
		{
			alert("Invalid Zip code");
			zip.focus();
			return false;
		}
	}
		
	var address=document.getElementById("textarea_address");
	if(trim(address.value)=='')
		{
		alert("Please enter your full address");
		address.focus();
		return false;
		}
		
	var dob=document.getElementById("textfield_dob");
	if(trim(dob.value)!='')
		{
			if (isDate(dob.value)==false)
			{
			dob.focus()
			return false;
			}
		}
		
	var contact=document.getElementById("textfield_contactno");
	if(trim(contact.value)=='')
		{
		alert("Please enter your contact no");
		contact.focus();
		return false;
		}
		
	else
	{
		if(isNaN(contact.value))
		{
			alert("Contact no should be numeric");
			contact.focus();
			return false;
		}
	}
	
	
	var facebook=document.getElementById("textfield_facebook");
	if(trim(facebook.value)=='')
		{
		alert("Please enter facebook id");
		facebook.focus();
		return false;
		}
		
	
	var twitter=document.getElementById("textfield_twitter");
	if(trim(twitter.value)=='')
		{
		alert("Please enter twitter id");
		twitter.focus();
		return false;
		}
		
		
	var iframe=document.getElementById("iframe_image");
	var pic=iframe.contentWindow.document.getElementById("pic").value;
	if(pic=='')
		{
		alert("You didnot upload any photo for your profile");
		return true;
		}

		
	return false;
}


/* start the check location function */

function check_location()
{
	var country=document.getElementById("select_country");
	if(trim(country.value)=='')
		{
		alert("Please select the country name");
		country.focus();
		return false;
		}
		
	var state=document.getElementById("select_state");
	if(trim(state.value)=='')
		{
		alert("Please select the state name");
		state.focus();
		return false;
		}
		
	var city=document.getElementById("textfield_city");
	if(trim(city.value)=='')
		{
		alert("Please enter the city name");
		city.focus();
		return false;
		}
		
	var zip=document.getElementById("textfield_zip");
	if(trim(zip.value)=='')
		{
		alert("Please enter the zip code");
		zip.focus();
		return false;
		}
		
	else
	{
		if(!alphanumeric(zip.value))
		{
			alert("Invalid Zip code");
			zip.focus();
			return false;
		}
	}
		
	var address=document.getElementById("textarea_address");
	if(trim(address.value)=='')
		{
		alert("Please enter your full address");
		address.focus();
		return false;
		}
		
	if(((country.value)!='') && ((state.value)!='') && ((city.value)!='') && ((zip.value)!='') &&((address.value)!=''))
	{
		alert("Please click on the 'Check Location' link and check your location");
		return false;
	}
}

/* end of the check location function */


/* start the check location function */

function check_location_local()
{
	
	var city=document.getElementById("textfield_city_local");
	if(trim(city.value)=='')
		{
		alert("Please enter the city name");
		city.focus();
		return false;
		}
		
	var zip=document.getElementById("textfield_zip_local");
	if(trim(zip.value)=='')
		{
		alert("Please enter the zip code");
		zip.focus();
		return false;
		}
		
	else
	{
		if(!alphanumeric(zip.value))
		{
			alert("Invalid Zip code");
			zip.focus();
			return false;
		}
	}
		
	var address=document.getElementById("textarea_address_local");
	if(trim(address.value)=='')
		{
		alert("Please enter your full address");
		address.focus();
		return false;
		}
		
	if(((city.value)!='') && ((zip.value)!='') &&((address.value)!=''))
	{
		alert("Please click on the 'Check Location' link and check your location");
		return false;
	}
}

/* end of the check location function */




/* start of the image validation */

function image_validation()
{
	var pic=document.getElementById("pic");
	if(trim(pic.value)=='')
		{
		alert("Please select a image for your profile");
		pic.focus();
		return false;
		}
		
	else
	{
		if(!getFileType(pic.value))
		{
			alert("Invalid file type");	
			pic.focus();
			return false;
		}
	}
	
	return true;

}

/* end of the image validation function */



/* start of login validation */

function login_validation()
{
	var username=document.getElementById("textfield_username_login");
	if(trim(username.value)=='')
		{
		alert("Please enter your username");
		username.focus();
		return false;
		}
		
	var password=document.getElementById("textfield_password_login");
	if(trim(password.value)=='')
		{
		alert("Please enter your password");
		password.focus();
		return false;
		}
		
	return true;
}

/* end od login validation */


/* start of sign up validation */

function cause_validation()
{
	var category=document.getElementById("select_category");
	if(trim(category.value)=='')
		{
		alert("Please select category");
		category.focus();
		return false;
		}
		
	var subcategory=document.getElementById("select_subcategory");
	if(trim(subcategory.value)=='')
		{
		alert("Please select subcategory");
		subcategory.focus();
		return false;
		}
		
	var title=document.getElementById("textfield_title");
	if(trim(title.value)=='')
		{
		alert("Please enter the title");
		title.focus();
		return false;
		}
		
	var objective=document.getElementById("textarea_objective");
	if(trim(objective.value)=='')
		{
		alert("Please enter the objective of the cause");
		objective.focus();
		return false;
		}
		
	var description=document.getElementById("textarea_description");
	if(trim(description.value)=='')
		{
		alert("Please enter the description of the cause");
		description.focus();
		return false;
		}
		
	var specification=document.getElementById("textarea_specification");
	if(trim(specification.value)=='')
		{
		alert("Please enter what is in it for you?");
		specification.focus();
		return false;
		}
	
	if((document.form_cause.checkbox_time.checked==false) && (document.form_cause.checkbox_money.checked==false))
		{
		alert("Please checked atleast one checkbox");
		document.form_cause.checkbox_time.focus();
		return false;
		}
		
		
		if(document.form_cause.checkbox_time.checked==true)
		{
			var time=document.getElementById("textfield_time");
				if(trim(time.value)=='')
					{
					alert("Please enter how many hour you want?");
					time.focus();
					return false;
					}
					
				else
				{
					if(isNaN(time.value))
					{
					alert("Time should be numeric");
					time.focus();
					return false;
					}
				}
		}
		
		
		if(document.form_cause.checkbox_money.checked==true)
		{					
				var amount=document.getElementById("textfield_amount");
				if(trim(amount.value)=='')
					{
					alert("Please enter the amount you want");
					amount.focus();
					return false;
					}
					
				else
				{
					if(isNaN(amount.value))
					{
						alert("Amount code should be numeric");
						amount.focus();
						return false;
					}
				}
				
				
				var transaction=document.getElementById("textfield_transaction");
				if(trim(transaction.value)=='')
				{
				alert("Please enter Account-Id");
				transaction.focus();
				return false;
				}
				
				else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(transaction.value)== false)
				{
				alert("Please enter a valid Account Address?");
				transaction.focus();
				return false;
				}
				
				var venom=document.getElementById("textfield_venmo");
				if(trim(venom.value)!='')
				{
					if(isNaN(venom.value))
					{
						alert("Cellphone number should be numeric");
						venom.focus();
						return false;
					}
				}				
		}
		
	
	
		if((document.form_cause.radiobutton_location_global.checked==false) && (document.form_cause.radiobutton_location_local.checked==false))
		{
			 alert("Please select the location type");
			 document.form_cause.radiobutton_location_global.focus();
			 return false ; 
		}
		
		
	
		if(document.form_cause.radiobutton_location_global.checked==true)
		{
				
			var country=document.getElementById("select_country");
				if(trim(country.value)=='')
					{
					alert("Please select the country name");
					country.focus();
					return false;
					}
					
				var state=document.getElementById("select_state");
				if(trim(state.value)=='')
					{
					alert("Please select the state name");
					state.focus();
					return false;
					}
					
					
				var city=document.getElementById("textfield_city");
				if(trim(city.value)=='')
					{
					alert("Please enter the city name");
					city.focus();
					return false;
					}
					
				var zip=document.getElementById("textfield_zip");
				if(trim(zip.value)=='')
					{
					alert("Please enter the zip code");
					zip.focus();
					return false;
					}
					
				else
				{
					if(!alphanumeric(zip.value))
					{
						alert("Invalid Zip code");
						zip.focus();
						return false;
					}
				}
					
				var address=document.getElementById("textarea_address");
				if(trim(address.value)=='')
					{
					alert("Please enter your full address");
					address.focus();
					return false;
					}
			
		}
			
		if(document.form_cause.radiobutton_location_local.checked==true)
		{
				
			var city_local=document.getElementById("textfield_city_local");
				if(trim(city_local.value)=='')
					{
					alert("Please enter the city name");
					city_local.focus();
					return false;
					}
					
				var zip_local=document.getElementById("textfield_zip_local");
				if(trim(zip_local.value)=='')
					{
					alert("Please enter the zip code");
					zip_local.focus();
					return false;
					}
					
				else
				{
					if(!alphanumeric(zip_local.value))
					{
						alert("Invalid Zip code");
						zip_local.focus();
						return false;
					}
				}
					
				var address_local=document.getElementById("textarea_address_local");
				if(trim(address_local.value)=='')
					{
					alert("Please enter your full address");
					address_local.focus();
					return false;
					}
		}
	
	
		
	var contact=document.getElementById("textfield_contactno");
	if(trim(contact.value)=='')
		{
		alert("Please enter your contact no");
		contact.focus();
		return false;
		}
		
	else
	{
		if(isNaN(contact.value))
		{
			alert("Contact no should be numeric");
			contact.focus();
			return false;
		}
	}
	
	
	var email=document.getElementById("textfield_email");
	if(trim(email.value)=='')
		{
		alert("Please enter Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
		
		var starts=document.getElementById("textfield_starts");
		if(trim(starts.value)=='')
		{
			alert("Please enter when the cause starts");
			starts.focus()
			return false;
		}
		else
		{
			if (isDate(starts.value)==false)
			{
				starts.focus()
				return false;
			}
		}
		
	
	
		var ends=document.getElementById("textfield_ends");
		if(trim(ends.value)=='')
		{
			alert("Please enter when the cause ends");
			ends.focus()
			return false;
		}
		else
		{
			if (isDate(ends.value)==false)
			{
				ends.focus()
				return false;
			}
		}
		
		
		
		if((trim(starts.value)!='') && (trim(ends.value)!=''))
		{
			if(days_between(starts.value,ends.value))
			{
				alert("End date should be grater then start date");
				ends.focus();
				return false;
			}
		}
		
	
		var iframe=document.getElementById("iframe_cause_image");
		var img321=iframe.contentWindow.document.getElementById("img321").value;
		
		if(img321=='')
		{
			var pic=iframe.contentWindow.document.getElementById("pic").value;
			if(trim(pic)=='')
			{
			alert("Please upload image for your cause");
			return false;
			}
		}
			
		
		
		var file1=document.getElementById("imagepic1");
		var file2=document.getElementById("imagepic2");
		var file3=document.getElementById("imagepic3");
		var file4=document.getElementById("imagepic4");
		var file5=document.getElementById("imagepic5");
		var file6=document.getElementById("imagepic6");
		
		if(trim(file1.value)!='')
		{
			if(!getFileType(file1.value))
			{
				alert("Invalid image file 1 type");	
				file1.focus();
				return false;			
			}
		}
		
	
		
		if(trim(file2.value)!='')
		{
			if(!getFileType(file2.value))
			{
				alert("Invalid image file 2 type");	
				file2.focus();
				return false;			
			}
		}
		
		if(file3!=null)
		{
			if(trim(file3.value)!='')
			{
				if(!getFileType(file3.value))
				{
					alert("Invalid image file 3 type");	
					file3.focus();
					return false;			
				}
			}
		}
		
		if(file4!=null)
		{
			if(trim(file4.value)!='')
			{
				if(!getFileType(file4.value))
				{
					alert("Invalid image file 4 type");	
					file4.focus();
					return false;			
				}
			}
		}
		
		
		if(file5!=null)
		{
			if(trim(file5.value)!='')
			{
				if(!getFileType(file5.value))
				{
					alert("Invalid image file 5 type");	
					file5.focus();
					return false;			
				}
			}
		}
		
		
		if(file6!=null)
		{
			if(trim(file6.value)!='')
			{
				if(!getFileType(file6.value))
				{
					alert("Invalid image file 6 type");	
					file6.focus();
					return false;			
				}
			}
		}
		
		
		var vedio_image1=document.getElementById("vedio_image1");
		var vedio_image2=document.getElementById("vedio_image2");
		var vedio1=document.getElementById("vedio1");
		var vedio2=document.getElementById("vedio2");
		
		
		if(trim(vedio_image1.value)!='')
		{
			if(!getFileType(vedio_image1.value))
			{
				alert("Invalid video image file 1 type");	
				vedio_image1.focus();
				return false;			
			}
			
			if(trim(vedio1.value)=='')
			{
				alert("Please upload the video 1");	
				vedio1.focus();
				return false;
			}
			
		}
		
		if(trim(vedio1.value)!='')
		{
			if(!getVedioType(vedio1.value))
			{
				alert("Invalid video file 1 type");	
				vedio1.focus();
				return false;			
			}
			
			if(trim(vedio_image1.value)=='')
			{
				alert("Please upload the image for video file 1");	
				vedio_image1.focus();
				return false;
			}
		}
		
		if(trim(vedio_image2.value)!='')
		{
			if(!getFileType(vedio_image2.value))
			{
				alert("Invalid video image file 2 type");	
				vedio_image2.focus();
				return false;			
			}
			
			if(trim(vedio2.value)=='')
			{
				alert("Please upload the video 2");	
				vedio2.focus();
				return false;
			}
		}

		
		
		if(trim(vedio2.value)!='')
		{
			if(!getVedioType(vedio2.value))
			{
				alert("Invalid video file 2 type");	
				vedio2.focus();
				return false;			
			}
			
			if(trim(vedio_image2.value)=='')
			{
				alert("Please upload the image for video file 2");	
				vedio_image2.focus();
				return false;
			}
		}
		
	return true;
}



/* cause post chechbox time tr display start */

function checkbox_time_display()
{
	if(document.form_cause.checkbox_time.checked==true)
	{
		document.getElementById('by_time').style.display='block';
		return false;
	}
	else
	{
		document.getElementById('by_time').style.display='none';
		return false;
	}
}

/* cause post chechbox time tr display end */


/* cause post chechbox money tr display start */

function checkbox_money_display()
{
	if(document.form_cause.checkbox_money.checked==true)
	{
		document.getElementById('by_money').style.display='block';
		return false;
	}
	else
	{
		document.getElementById('by_money').style.display='none';
		return false;
	}
}

/* cause post chechbox money tr display end */



/* start of the image validation */

function cause_image_validation()
{
	var pic=document.getElementById("pic");
	if(trim(pic.value)=='')
		{
		alert("Please select the main image for your cause");
		pic.focus();
		return false;
		}
		
	else
	{
		if(!getFileType(pic.value))
		{
			//if(!getVedioType(pic.value))
			//{
			alert("Invalid file type");	
			pic.focus();
			return false;
			//}
		}
	}
	
	return true;

}

/* end of the image validation function */



/* start of the image validation */

function cause_edit_image_validation()
{
	var pic=document.getElementById("pic_update");
	if(trim(pic.value)=='')
		{
		alert("Please select a image first");
		pic.focus();
		return false;
		}
		
	else
	{
		if(!getFileType(pic.value))
		{
			if(!getVedioType(pic.value))
			{
			alert("Invalid file type");	
			pic.focus();
			return false;
			}
		}
	}
	
	return true;

}

/* end of the image validation function */



/* start of open_div_first() function */

function open_div_first()
{
 document.form_cause.radiobutton_location_local.checked=false;	
 var location_first=document.getElementById("location_first");
 var location_second=document.getElementById("location_second");
 location_first.style.display="block";
 location_second.style.display="none";
}
/* end of open_div_first() function */

/* start of open_div_second() function */

function open_div_second()
{
 document.form_cause.radiobutton_location_global.checked=false;
 var location_second=document.getElementById("location_second");
 var location_first=document.getElementById("location_first");
 location_second.style.display='block';
 location_first.style.display='none';
}
/* end of open_div_second() function */


/* start of function googlemap */
function googleMap()
{
	var country=document.getElementById("select_country");
	if(trim(country.value)=='')
		{
		alert("Please select the country name");
		country.focus();
		return false;
		}
		
	var state=document.getElementById("select_state");
	if(trim(state.value)=='')
		{
		alert("Please select the state name");
		state.focus();
		return false;
		}
		
	var city=document.getElementById("textfield_city");
	if(trim(city.value)=='')
		{
		alert("Please enter the city name");
		city.focus();
		return false;
		}
		
	var zip=document.getElementById("textfield_zip");
	if(trim(zip.value)=='')
		{
		alert("Please enter the zip code");
		zip.focus();
		return false;
		}
		
	else
	{
		if(!alphanumeric(zip.value))
		{
			alert("Invalid Zip code");
			zip.focus();
			return false;
		}
	}
		
	var address=document.getElementById("textarea_address");
	if(trim(address.value)=='')
		{
		alert("Please enter your full address");
		address.focus();
		return false;
		}

	if(((country.value)!='') && ((state.value)!='') && ((city.value)!='') && ((zip.value)!='') &&((address.value)!=''))
	{
	var google_map=country.value + "," + state.value + "," + city.value + "," + zip.value +"," + address.value;
	showAddress1(google_map);
	}
}
/* end of function googlemap */



/* start of googleMapCause */

function googleMapCause()
{

		if(document.form_cause.radiobutton_location_global.checked==true)
		{		
			var country=document.getElementById("select_country");
				if(trim(country.value)=='')
					{
					alert("Please select the country name");
					country.focus();
					return false;
					}
					
				var state=document.getElementById("select_state");
				if(trim(state.value)=='')
					{
					alert("Please select the state name");
					state.focus();
					return false;
					}
					
					
				var city=document.getElementById("textfield_city");
				if(trim(city.value)=='')
					{
					alert("Please enter the city name");
					city.focus();
					return false;
					}
					
				var zip=document.getElementById("textfield_zip");
				if(trim(zip.value)=='')
					{
					alert("Please enter the zip code");
					zip.focus();
					return false;
					}
					
				else
				{
					if(!alphanumeric(zip.value))
					{
						alert("Invalid Zip code");
						zip.focus();
						return false;
					}
				}
					
				var address=document.getElementById("textarea_address");
				if(trim(address.value)=='')
					{
					alert("Please enter your full address");
					address.focus();
					return false;
					}
					
			if(((country.value)!='') && ((state.value)!='') && ((city.value)!='') && ((zip.value)!='') &&((address.value)!=''))
			{
			var google_map=country.value + "," + state.value + "," + city.value + "," + zip.value +"," + address.value;
			showAddress1(google_map);
			}
			
		}
			
		if(document.form_cause.radiobutton_location_local.checked==true)
		{
				
			var city_local=document.getElementById("textfield_city_local");
				if(trim(city_local.value)=='')
					{
					alert("Please enter the city name");
					city_local.focus();
					return false;
					}
					
				var zip_local=document.getElementById("textfield_zip_local");
				if(trim(zip_local.value)=='')
					{
					alert("Please enter the zip code");
					zip_local.focus();
					return false;
					}
					
				else
				{
					if(!alphanumeric(zip_local.value))
					{
						alert("Invalid Zip code");
						zip_local.focus();
						return false;
					}
				}
					
				var address_local=document.getElementById("textarea_address_local");
				if(trim(address_local.value)=='')
					{
					alert("Please enter your full address");
					address_local.focus();
					return false;
					}
			if(((city_local.value)!='') && ((zip_local.value)!='') &&((address_local.value)!=''))
			{
			var google_map=city_local.value + "," + zip_local.value +"," + address_local.value;
			showAddress1(google_map);
			}
		}
	

}




function comments_validation()
{

	var name=document.getElementById("textfield_name");
	if(trim(name.value)=='')
		{
		alert("Please enter your name");
		name.focus();
		return false;
		}
		
		
	var email=document.getElementById("textfield_email");
	if(trim(email.value)=='')
		{
		alert("Please enter Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
	var comments=document.getElementById("textarea_comments");
	if(trim(comments.value)=='')
		{
		alert("Please enter your comments here");
		comments.focus();
		return false;
		}	
		
	var captcha=document.getElementById("textfield_captcha");

	if((trim(captcha.value)=='Type the text here') || (trim(captcha.value)=='') )
		{
		alert("Please type the text here");
		captcha.focus();
		return false;
		}
		
}


function only_comments_validation()
{

	var comments=document.getElementById("textarea_comments");
	if(trim(comments.value)=='')
		{
		alert("Please enter your comments here");
		comments.focus();
		return false;
		}
			
		
	var captcha=document.getElementById("textfield_captcha");

	if((trim(captcha.value)=='Type the text here') || (trim(captcha.value)=='') )
		{
		alert("Please type the text here");
		captcha.focus();
		return false;
		}	
		
}


/* end of googleMapCause */



function contact_validation()
{

var name=document.getElementById("textfield_fullname");

if(trim(name.value)=='')
		{
		alert("Please enter your name");
		name.focus();
		return false;
		}
		
var email=document.getElementById("textfield_email");

if(trim(email.value)=='')
		{
		alert("Please enter your email id");
		email.focus();
		return false;
		}
		
else
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
			{
			alert("Can you please enter your valid Email Address?");
			email.focus();
			return false;
			} 
		}
		
var phone=document.getElementById("textfield_phone");

if(trim(phone.value)=='')
		{
		alert("Please enter your phone number");
		phone.focus();
		return false;
		}
		
else
		{
			if(isNaN(phone.value))
			{
			alert("Phone No should be numeric");
			phone.focus();
			return false;
			}
		}	
		
var message=document.getElementById("textfield_message");

if(trim(message.value)=='')
		{
		alert("Please enter some message?");
		message.focus();
		return false;
		}
		
var captcha=document.getElementById("textfield_captcha");

if((trim(captcha.value)=='Type the text here') || (trim(captcha.value)=='') )
		{
		alert("Please type the text here");
		captcha.focus();
		return false;
		}
}

function valueNull()
{
var captcha=document.getElementById("textfield_captcha");		
	if((captcha.value)=='Type the text here')
	{
	captcha.value="";
	return false;
	}
return true;	
}

function valueGiven()
{
var captchaValue=document.getElementById("textfield_captcha");	
	if((captchaValue.value)=='')
	{
	captchaValue.value="Type the text here";
	return false;
	}
}


function amount_validation(requiredValue)
{
	
				var amount=document.getElementById("textfield_amount");
				if(trim(amount.value)=='')
					{
					alert("Please enter the amount you want to donate");
					amount.focus();
					return false;
					}
					
				else
				{
					if(isNaN(amount.value))
					{
						alert("Amount should be numeric");
						amount.focus();
						return false;
					}
					
					/*else
					{
						((amount.value)>requiredValue)
						{
							alert("Amount should be less then required amount");
							amount.focus();
							return false;
						}
					}*/
					
					else
					{
						confirmationmoney();
						return false;
					}
				}
}


function time_validation()
{
		
				var time=document.getElementById("textfield_time");
				if(trim(time.value)=='')
					{
					alert("Please enter how many hour you want to donate?");
					time.focus();
					return false;
					}
					
				else
				{
					if(isNaN(time.value))
					{
					alert("Time should be numeric");
					time.focus();
					return false;
					}
				}
					
				var day=document.getElementById("textfield_day");
				if(trim(day.value)=='')
					{
					alert("Please enter what day you plan to help?");
					day.focus();
					return false;
					}
					
					confirmationtime();
					return false;
					
				
}




function addRow(tableID) {

var i = document.getElementById("loop").value;
i++;
//alert(i);
			var table = document.getElementById(tableID);

			var rowCount = table.rows.length;			
			var row = table.insertRow(rowCount);
			
			var cell1 = row.insertCell(0);
			cell1.className='table-p';
			cell1.innerHTML = "Upload Image"+i+":";
			var cell2 = row.insertCell(1);
			var element1 = document.createElement("input");
			element1.type = "file";
			element1.id ='imagepic'+ i;
			element1.name ='imagepic'+ i;
			element1.className='filebox';
			cell2.appendChild(element1);
			
			document.getElementById("loop").value=i;
			if(i>=2)
			{
				document.getElementById("deleterow").style.display="block";
			}
			
			return false;
}
		
		
		
function removeRowFromTable(tableID)
{
  var i = document.getElementById("loop").value;
  i--;
  var tbl = document.getElementById(tableID);
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
  if(i<=2) document.getElementById("deleterow").style.display="none";
  document.getElementById("loop").value=i;
  return false;
}



/*function addVedioRow(vedioTable) {

var i = document.getElementById("vedioloop").value;
i++;
alert(i);
			var table = document.getElementById(tableID);

			var rowCount = table.rows.length;			
			var row = table.insertRow(rowCount);
			
			var cell1 = row.insertCell(0);
			cell1.className='table-p';
			cell1.innerHTML = "Upload Vedio"+i;
			var cell2 = row.insertCell(1);
			cell2.innerHTML = "&nbsp;";
			var cell3 = row.insertCell(0);
			cell3.className='table-p';
			cell3.innerHTML = "Uploade a vedio image";
			var cell4 = row.insertCell(1);
			var element1 = document.createElement("input");
			element1.type = "file";
			element1.id ='vedio_image'+ i;
			element1.name ='vedio_image'+ i;
			cell4.appendChild(element1);
			var cell5 = row.insertCell(0);
			cell5.className='table-p';
			cell5.innerHTML = "Uploade the vedio";
			var cell6 = row.insertCell(1);
			var element2 = document.createElement("input");
			element2.type = "file";
			element2.id ='vedio'+ i;
			element2.name ='vedio'+ i;
			cell6.appendChild(element2);
			var cell2 = row.insertCell(1);
			cell2.innerHTML = "&nbsp;";
			var cell2 = row.insertCell(1);
			cell2.innerHTML = "&nbsp;";
			
			document.getElementById("vedioloop").value=i;
			if(i>=2)
			{
				document.getElementById("deleterowvedio").style.display="block";
			}
			
			return false;
}
		
		
		
function removeVedioRowFromTable(vedioTable)
{
  var i = document.getElementById("vedioloop").value;
  i--;
  var tbl = document.getElementById(tableID);
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
  if(i<=2) document.getElementById("deleterow").style.display="none";
  document.getElementById("vedioloop").value=i;
  return false;
}
*/

/*function validateRow(tableID)
{
	
    var tbl = document.getElementById(tableID);
	alert(tb1)
    var lastRow = tbl.rows.length - 1;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('file' + i);
	  alert(aRow);
      if (aRow.value.length <= 2) {
        if(trim(aRow.value)!='')
		{
			if(!getFileType(aRow.value))
			{
				alert("Invald file type");	
				aRow.focus();
				return false;			
			}
		}
    }
  }
}*/



function cause_edit_vedio_validation()
{
		var vedio_image=document.getElementById("vedio_image");
		var vedio=document.getElementById("vedio");
		
		
		
			if(trim(vedio_image.value)=='')
			{
				alert("Please upload the image for video file");	
				vedio_image.focus();
				return false;
			}
			
			else
			{
				if(!getFileType(vedio_image.value))
				{
					alert("Invalid video image file type");	
					vedio_image.focus();
					return false;			
				}
			}
	
	
			if(trim(vedio.value)=='')
			{
				alert("Please upload the video");	
				vedio.focus();
				return false;
			}
			
			else
			{
				if(!getVedioType(vedio.value))
				{
					alert("Invalid video type");	
					vedio.focus();
					return false;			
				}
				
			}
		
		return true;
}


function MM_openBrWindow2(theURL,winName,features) { //v2.0
opw4=(screen.availWidth-640)/2;
oph4=(screen.availHeight-480)/2; 
  window.open(theURL,winName,features + ",left="+opw4+",top="+oph4+",scrollbars=no,toolbar=no,titlebar=no");
}


function composemsg()
{
	
	var to=document.getElementById("textfield_to");
	if(trim(to.value)=='')
		{
		alert("Please enter Email-Id of the receiver");
		to.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(to.value)== false)
		{
		alert("Please enter a valid Email Address?");
		to.focus();
		return false;
		}
		
	var subject=document.getElementById("textfield_subject_compose");
	if(trim(subject.value)=='')
		{
		alert("Please enter the subject");
		subject.focus();
		return false;
		}
		
	var message=document.getElementById("textarea_message_compose");
	if(trim(message.value)=='')
		{
		alert("Please enter the message");
		message.focus();
		return false;
		}
		
	return true;
}


function massMessage()
{
	var subject=document.getElementById("textfield_subject");
	if(trim(subject.value)=='')
		{
		alert("Please enter the subject of the meaasge");
		subject.focus();
		return false;
		}
		
	var message=document.getElementById("textarea_message");
	if(trim(message.value)=='')
		{
		alert("Please enter some text");
		message.focus();
		return false;
		}
}


function updateMessage()
{
	
	var message=document.getElementById("textarea_umessage");
	if(trim(message.value)=='')
		{
		alert("Please enter some text");
		message.focus();
		return false;
		}
}

function resetUpdateFrom()
{
	
	document.getElementById("textarea_umessage").value="";
	return false;
}



function resetMessageFrom()
{
	document.getElementById("textfield_subject").value="";
	//FCKeditorAPI.GetInstance("textarea_message").SetHTML("");
	document.getElementById("textarea_message").value="";
	return false;
	
}

function forgetpassword_validation()
{
	var email=document.getElementById("textfield_email");
	if(trim(email.value)=='')
		{
		alert("Please enter your Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
}


function confirmation() {
	var answer = confirm("would you like to tell your friends about this cause?")
	if (answer){		
		document.getElementById('light').style.display='block';
		document.getElementById('fade').style.display='block';
	}
	else{
		document.recomm_form.submit();
	}
}

function confirmationmoney() {
	var answer = confirm("would you like to tell your friends about this cause?")
	if (answer){		
		document.getElementById('lightmoney').style.display='block';
		document.getElementById('fademoney').style.display='block';
	}
	else{
		document.fademoney.submit();
	}
}

function confirmationtime() {
	var answer = confirm("would you like to tell your friends about this cause?")
	if (answer){		
		document.getElementById('lighttime').style.display='block';
		document.getElementById('fadetime').style.display='block';
	}
	else{
		document.frmTime.submit();
	}
}



function friendsValidation()
{
		
	var email=document.getElementById("textfield_friendsemail");
	if(trim(email.value)=='')
		{
		alert("Please enter your friend's Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
		return true;
}



function friendsMoneyValidation()
{
		
	var email=document.getElementById("textfield_friendsemailmoney");
	if(trim(email.value)=='')
		{
		alert("Please enter your friend's Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
		return true;
}


function friendsTimeValidation()
{
		
	var email=document.getElementById("textfield_friendsemailtime");
	if(trim(email.value)=='')
		{
		alert("Please enter your friend's Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
		return true;
}



function newsLetter()
{
	var email=document.getElementById("textfield_newsEmail");
	if(trim(email.value)=='')
		{
		alert("Please enter your Email-Id");
		email.focus();
		return false;
		}
		
		else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)== false)
		{
		alert("Please enter a valid Email Address?");
		email.focus();
		return false;
		}
		
		return true;
}

