var newwindow;



function poplinks(url)

{

	newwindow=window.open(url,'name','scrollbars=yes,height=400,width=600,left=0,top=0,resizable=yes');



	if (window.focus) {newwindow.focus()}



}







function popfilewindow(url)



{



	filewindow=window.open(url,'AttachFile','height=400,width=600,left=0,top=0,resizable=yes,scrollbars=yes,status=yes');



	if (window.focus) {filewindow.focus()}



}







//Function alert message Display  



  function confirmMsg(msg){



	if(!confirm(msg)){



		return false;



	} else {



		return true;



	}



}



//For link Onchange







function changecat(id)



	{



	var link_catname=document.links_form.catid.value;



		if (link_catname=="All")



			{



				window.location.href="links.php?id="+id;



			}



		else



			{



				window.location.href="links.php?li="+document.links_form.catid.value+"&id="+id;



			}



	}



	//Change Blog



	function changeblog(id)



	{



		if(document.blogchange.catID.value == ""){



		window.location.href="blogs.php?id="+id;



		}else{



		document.blogchange.action = "categoryblogs.php?id="+id;



		document.blogchange.submit();



		}			



	}



	



//Mouse over picture change



function showimg(imgid,imgname){



	var virtualpath="images/"+imgname;



	var newimage = new Image();



	newimage.src = virtualpath;



	var width =newimage.width ;



	var height = newimage.height;



	document.getElementById(imgid).src=virtualpath;



	document.getElementById(imgid).width =width;



	document.getElementById(imgid).height =height;



}







//Ad Approval page



function openApprove(siteURL){



	if( ( document.approvead.attentionicon[0].checked ) && ( document.approvead.attname[0].checked == false && document.approvead.attname[1].checked == false && document.approvead.attname[2].checked == false && document.approvead.attname[3].checked == false && document.approvead.attname[4].checked == false && document.approvead.attname[5].checked == false && document.approvead.attname[6].checked == false && document.approvead.attname[7].checked == false && document.approvead.attname[8].checked == false && document.approvead.attname[9].checked == false && document.approvead.attname[10].checked == false) ){



	alert("Please choose any one of the attention getter.");



	return false;



	}



	classifiedid = document.approvead.classadid.value;



	passid = document.approvead.hiddenid.value;



	document.approvead.action=siteURL+"adinfo.php"



	document.approvead.submit();



	//window.location.href=siteURL+"adinfo.php?classadid="+classifiedid+"&id="+passid;







}



function openEdit(siteURL){



	classifiedid = document.approvead.classadid.value;



	passid = document.approvead.hiddenid.value;



	window.location.href=siteURL+"clplacead.php?classadid="+classifiedid+"&id="+passid+"&actionfrom=approvead";



	//document.approvead.action=siteURL+"clplacead.php"



	//document.approvead.submit();



}







function openImages(siteURL){



	classifiedid = document.approvead.classadid.value;



	passid = document.approvead.hiddenid.value;



	window.location.href=siteURL+"placeadimages.php?classadid="+classifiedid+"&id="+passid;



}











//For Ad Image Upload Page



function openUpdateImage(siteURL){



	document.frm_images.action=siteURL+"imageupdate.php"



	document.frm_images.submit();



}











function openSkipImage(siteURL){



	classifiedid = document.frm_images.classadid.value;



	passid = document.frm_images.hiddenid.value;



	window.location.href=siteURL+"approveplacead.php?classadid="+classifiedid+"&id="+passid;



}



//Password Validation







function clpassword_validation(){



	if (document.clpassword.username.value == ""){



				alert ("Please enter the User name.");



				document.clpassword.username.focus();



				return false;



	}



	if (!validateEmail(document.clpassword.emailid.value,1,1)) 



		{



				document.clpassword.emailid.focus();



				return false;



		}



}











//For Palce Ad Page



function openSubmit(siteURL){



	if (document.placead.first.value == ""){



				alert ("Please enter the first name.");



				document.placead.first.focus();



				return false;



		}



		if (document.placead.last.value == "") 



		{



				alert ("Please enter the last name.");



				document.placead.last.focus();



				return false;



		}



		if (document.placead.address.value == "") 



		{



				alert ("Please enter the address.");



				document.placead.address.focus();



				return false;



		}



		if (document.placead.city.value == "") 



		{



				alert ("Please enter the city.");



				document.placead.city.focus();



				return false;



		}



		if(document.placead.country.value == "")



		{



		        alert("Please select the country");



				document.placead.country.focus();



				return false;



		}



		if(document.placead.country.value == "United States of America" && document.placead.state1.value == "")



		{



		        alert("Please select the state");



				document.placead.state1.focus();



				return false;



		}



		if(document.placead.country.value != "United States of America" && document.placead.state.value == "")



		{



		        alert("Please enter the state");



				document.placead.state.focus();



				return false;



		}



		if (document.placead.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.placead.zip.focus();



				return false;



		}



		if (document.placead.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.placead.phone.focus();



				return false;



		}



		phone = document.placead.phone;



		if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



			



		if (!validateEmail(document.placead.emailaddr.value,1,1)) 



		{



				document.placead.emailaddr.focus();



				return false;



		}



		



		if (document.placead.title.value == "") 



					{



							alert ("Please enter the classified title.");



							document.placead.title.focus();



							return false;



					}



					



					



		



			if (document.placead.editor1.value == "") 



					{



							alert ("Please enter the classified detailed text.");



							document.placead.editor1.focus();



							return false;



					}



					



	if(document.placead.actionfrom.value != "user"){



		if (document.placead.insertdate.value == "") 



		{



				alert ("Please select the insertion date in the datepicker.");



				document.placead.insertdate.focus();



				return false;



		}



		currentdate= new Date();



		curmonth = currentdate.getMonth() + 1;



		var curdate =  curmonth + "/" + currentdate.getDate() + "/" + currentdate.getFullYear();		



		deldate=document.placead.insertdate.value;



		



		if ( !date_valid(curdate,deldate) )



		{



		   alert("Insertion date must be later than today's date.");



		   document.placead.insertdate.focus();



		   return false;



		}



	}



	if(document.placead.submenu.value == ""){



		alert ("Please select the submenu name.");



		document.placead.submenu.focus();



		return false;



	}



	



	if (document.placead.catid.value == "") {

		if (document.placead.newcategory) {

			if (document.placead.newcategory.value == "") {

				alert ("Please enter the new category name.");

				document.placead.newcategory.focus();

				return false;

			}

		}

	}

	if (document.placead.catid.value != "" && document.placead.newcategory && document.placead.newcategory.value != "" ){

		alert ("Please choose any one of the option for the category.");

		document.placead.newcategory.focus();

		return false;

	}

		

	uid = document.placead.uid.value;

	uname = document.placead.uname.value;



	document.placead.action = siteURL+"updateplacead.php?uid="+uid+"&unmae="+uname;

	document.placead.submit();

}







function openApproveBack(siteURL,actionfrom){



		if (document.placead.first.value == ""){



				alert ("Please enter the first name.");



				document.placead.first.focus();



				return false;



		}



		if (document.placead.last.value == "") 



		{



				alert ("Please enter the last name.");



				document.placead.last.focus();



				return false;



		}



		if (document.placead.address.value == "") 



		{



				alert ("Please enter the address.");



				document.placead.address.focus();



				return false;



		}



		if (document.placead.city.value == "") 



		{



				alert ("Please enter the city.");



				document.placead.city.focus();



				return false;



		}



		if(document.placead.country.value == "")



		{



		        alert("Please select the country");



				document.placead.country.focus();



				return false;



		}



		if(document.placead.country.value == "United States of America" && document.placead.state1.value == "")



		{



		        alert("Please select the state");



				document.placead.state1.focus();



				return false;



		}



		if(document.placead.country.value != "United States of America" && document.placead.state.value == "")



		{



		        alert("Please enter the state");



				document.placead.state.focus();



				return false;



		}



		if (document.placead.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.placead.zip.focus();



				return false;



		}



		if (document.placead.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.placead.phone.focus();



				return false;



		}



		phone = document.placead.phone;



		if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



			



		if (!validateEmail(document.placead.emailaddr.value,1,1)){



				document.placead.emailaddr.focus();



				return false;



		}



		



		if (document.placead.title.value == ""){



							alert ("Please enter the classified title.");



							document.placead.title.focus();



							return false;



		}



					



		



			if (document.placead.editor1.value == "") 



					{



							alert ("Please enter the classified detailed text.");



							document.placead.editor1.focus();



							return false;



					}



					



	if(document.placead.actionfrom.value != "user"){



		if (document.placead.insertdate.value == "") 



		{



				alert ("Please enter the insertion date.");



				document.placead.insertdate.focus();



				return false;



		}



	}



	if(document.placead.submenu.value == ""){



		alert ("Please select the submenu name.");



		document.placead.submenu.focus();



		return false;



	}



	if (document.placead.catid.value == "") {



				if (document.placead.newcategory.value == "") {



						alert ("Please enter the new category name.");



						document.placead.newcategory.focus();



						return false;



				}



		}



		



		if (document.placead.catid.value != "" && document.placead.newcategory.value != "" ){



						alert ("Please choose any one of the option for the category.");



						document.placead.newcategory.focus();



						return false;



		}



	classifiedid = document.placead.classadid.value;



	passid = document.placead.hiddenid.value;



	if(actionfrom == "adinfo")



	sitename = "adinfo.php";



	if(actionfrom == "approvead")



	sitename = "approveplacead.php";



	window.location.href=siteURL+sitename+"?classadid="+classifiedid+"&id="+passid;



}







//Script validation for displaying the submenu-category



var lists=new Array();



		function emptyList( box ) {



			 while ( box.options.length ) box.options[0] = null;



			}



			function fillList( box, arr ) {



		   for ( i = 0; i < arr[0].length; i++ ) {



			option = new Option( arr[0][i], arr[0][i+1] );



			box.options[box.length] = option;



			i=i+1;



		  }



		  box.selectedIndex=0;



			}



		function changeList( box ) {



		list = lists[box.options[box.selectedIndex].value];



		emptyList( box.form.catid );



		fillList( box.form.catid, list );



		}







//Ad Image Display











function showicons(){



		if (document.approvead.attentionicon[0].checked){



		iconstyle=document.getElementById("shicons");



		    if(iconstyle){



			iconstyle.style.display="block";



			iconstyle.style.visibility="visible";



			}				



		}



		else



		{



			iconstyle=document.getElementById("shicons");



			if(iconstyle){



			iconstyle.style.display="none";



			iconstyle.style.visibility="hidden";



			}



		}



	}



	



	



	function showState(passcountry){



		if (passcountry == "United States of America"){



			



			postate = document.getElementById("poststate");



			if(postate){



				postate.style.display="block";



				postate.style.visibility="visible";



			}



			pootherstate = document.getElementById("postotherstate");



			if(pootherstate){



				pootherstate.style.display="none";



				pootherstate.style.visibility="hidden";



			}



		}



		else{



			



			pootherstate = document.getElementById("postotherstate");



			if(pootherstate){



				pootherstate.style.display="block";



				pootherstate.style.visibility="visible";



			}



			postate = document.getElementById("poststate");



			if(postate){



				postate.style.display="none";



				postate.style.visibility="hidden";



			}



		}



	}



	



	



	



function showcredit(){



	var chklen = document.transactad.ONE.length;



	for(index = 0; index < chklen ; index++){



		



				 if (document.transactad.ONE[index].checked){



						if(document.transactad.ONE[index].value == "AN"){



							cardstyle=document.getElementById("creditcard");



								if(cardstyle){



								cardstyle.style.display="block";



								cardstyle.style.visibility="visible";



								}				



							}//End of If



							else {



							cardstyle=document.getElementById("creditcard");



								if(cardstyle){



								cardstyle.style.display="none";



								cardstyle.style.visibility="hidden";



								}



							}//End of Else



				}//End of If



		} //End of For



}







function showcredit_chkout(){



	var chklen = document.checkout.ONECART.length;



	for(index = 0; index < chklen ; index++){



		



				 if (document.checkout.ONECART[index].checked){



						if(document.checkout.ONECART[index].value == "AN"){



							cardstyle=document.getElementById("creditcard");



								if(cardstyle){



								cardstyle.style.display="block";



								cardstyle.style.visibility="visible";



								}				



							}//End of If



							else {



							cardstyle=document.getElementById("creditcard");



								if(cardstyle){



								cardstyle.style.display="none";



								cardstyle.style.visibility="hidden";



								}



							}//End of Else



				}//End of If



		} //End of For



	}















function openApproveAd(siteURL){



	



	ad_amt_total = document.transactad.ad_amt_total.value;



	if(ad_amt_total > 0.00){



	chkflagvalue = 0;



	var chklen = document.transactad.ONE.length;



	if(chklen > 0){



			for(index = 0; index < chklen ; index++){



				if (!(document.transactad.ONE[index].checked))



					chkflagvalue = chkflagvalue + 1; 



			}



	



		



		if(chkflagvalue == chklen){



		alert ("Please choose any one of the payment choice.");



		return false;



		}



	}



	else{



		if (!(document.transactad.payment_type.checked)){



		alert ("Please choose any one of the payment choice.");



		return false;



		}



	}



	



	



	for(index = 0; index < chklen ; index++){



		



				 if (document.transactad.ONE[index].checked){



						if(document.transactad.ONE[index].value == "AN"){



								if (document.transactad.nameoncard.value == "") 



										{



												alert ("Please enter the card name.");



												document.transactad.nameoncard.focus();



												return false;



										}



										if (document.transactad.cardnumber.value == "") 



										{



												alert ("Please enter the card number.");



												document.transactad.cardnumber.focus();



												return false;



										}



										if (document.transactad.expirydate.value == "") 



										{



												alert ("Please enter the expiration date.");



												document.transactad.expirydate.focus();



												return false;



										}



										if (document.transactad.billingzip.value == "") 



										{



												alert ("Please enter the billing zip code.");



												document.transactad.billingzip.focus();



												return false;



										}



								}



						  }



					}



	}



	document.transactad.action=siteURL+"adpayment.php"



	document.transactad.submit();



	



}



function openEditAd(siteURL){



	classifiedid = document.transactad.classadid.value;



	passid = document.transactad.hiddenid.value;



	window.location.href=siteURL+"clplacead.php?classadid="+classifiedid+"&id="+passid+"&actionfrom=adinfo";



}







function openImagesAd(siteURL){



	classifiedid = document.transactad.classadid.value;



	passid = document.transactad.hiddenid.value;



	window.location.href=siteURL+"placeadimages.php?classadid="+classifiedid+"&id="+passid;



}







//Validation script for comment posting



function comment_validation(){



	var thename = document.postcomment.thename.value



		if (thename == "") {



			alert ("You need to have a Name");



			document.postcomment.thename.focus();



			return false



		}



	



	



	var comment = document.postcomment.comment.value



		if (comment == "") {



			alert ("Comments are empty to post");



			document.postcomment.comment.focus();



			return false



		}



}



//For News Onchange	



function changenewscat()



	{



	var link_catname=document.news_form.catid.value;



		if (link_catname=="All")



			{



				window.location.href="news.php";



			}



		else



			{



				window.location.href="news.php?li="+document.news_form.catid.value;



			}



	}



function changeclassiccat()



	{



	var link_catname=document.classic_form.catid.value;



		if (link_catname=="All")



			{



				window.location.href="classifieds.php";



			}



		else



			{



				window.location.href="classifieds.php?li="+document.classic_form.catid.value;



			}



	}



//Shopping cart functions







function openwin(){



 var len=document.cart.ONE.length;



		   var flag=0;



		  	for(var index=0;index<len;index++)



			{



			quantity=document.cart.ONE[index].value;



				if( (quantity == "")  || isNaN(quantity) || (quantity == 0) || (quantity.indexOf("-") >= 0) || (quantity.indexOf(".") >= 0) || (quantity > 65535) )



				{



							alert("Type the valid quantity");



							document.cart.ONE[index].focus();



							return false;



				}



						



			}



document.cart.action="modifycart.php";



document.cart.submit();



}



function openwindow(){



document.cart.action="deletecart.php";



document.cart.submit();



}



//Validation for files Place Ad



function adfilevalidate(){



	if(document.frm_PlaceAdfileadd.hiddenlogo.value == ""){



		if(document.frm_PlaceAdfileadd.filename.value == ""){



					alert("Please select the file to upload");



					document.frm_PlaceAdfileadd.filename.focus();



					return false;



			}



	}



}







//validation for placead



function placead_validate(){



		if (document.placead.first.value == ""){



				alert ("Please enter the first name.");



				document.placead.first.focus();



				return false;



		}



		if (document.placead.last.value == "") 



		{



				alert ("Please enter the last name.");



				document.placead.last.focus();



				return false;



		}



		if (document.placead.address.value == "") 



		{



				alert ("Please enter the address.");



				document.placead.address.focus();



				return false;



		}



		if (document.placead.city.value == "") 



		{



				alert ("Please enter the city.");



				document.placead.city.focus();



				return false;



		}



		if(document.placead.country.value == "")



		{



		        alert("Please select the country");



				document.placead.country.focus();



				return false;



		}



		if(document.placead.country.value == "United States of America" && document.placead.state1.value == "")



		{



		        alert("Please select the state");



				document.placead.state1.focus();



				return false;



		}



		if(document.placead.country.value != "United States of America" && document.placead.state.value == "")



		{



		        alert("Please enter the state");



				document.placead.state.focus();



				return false;



		}



		if (document.placead.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.placead.zip.focus();



				return false;



		}



		if (document.placead.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.placead.phone.focus();



				return false;



		}



		phone = document.placead.phone;



		if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



			



		if (!validateEmail(document.placead.emailaddr.value,1,1)) 



		{



				document.placead.emailaddr.focus();



				return false;



		}



		



		if (document.placead.title.value == "") 



					{



							alert ("Please enter the classified title.");



							document.placead.title.focus();



							return false;



					}



					



					



		



			if (document.placead.editor1.value == "") 



					{



							alert ("Please enter the classified detailed text.");



							document.placead.editor1.focus();



							return false;



					}



					



		



		if(document.placead.actionfrom.value != "user"){



			if (document.placead.insertdate.value == "") 



			{



					alert ("Please select the insertion date in the date picker.");



					document.placead.insertdate.focus();



					return false;



			}



			currentdate= new Date();



			curmonth = currentdate.getMonth() + 1;



			var curdate =  curmonth + "/" + currentdate.getDate() + "/" + currentdate.getFullYear();		



			deldate=document.placead.insertdate.value;



			



			if ( !date_valid(curdate,deldate) )



			{



			   alert("Insertion date must be later than today's date.");



			   document.placead.insertdate.focus();



			   return false;



			}



		}







		if (document.placead.catid.value == "") {



				if (document.placead.newcategory.value == "") {



						alert ("Please enter the new category name.");



						document.placead.newcategory.focus();



						return false;



				}



		}



		



		if (document.placead.catid.value != "" && document.placead.newcategory.value != "" ){



						alert ("Please choose any one of the option for the category.");



						document.placead.newcategory.focus();



						return false;



		}



					



}







function submitevent_validate(){



	if(document.submitevent.name.value == "")



	{



				alert("Please enter the name.");



				document.submitevent.name.focus();



				return false;



	}



	/*if(document.submitevent.phone.value == "")



	{



				alert("Please enter the phone number.");



				document.submitevent.phone.focus();



				return false;



	}*/



	//Phone number validation		  



	/*



			var phone=document.submitevent.phone;



			if(phone.value == ""){



			alert("Phone number is mandatory");



			phone.focus();



			return false;



			}



			if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



	*/



	if (!validateEmail(document.submitevent.emailaddr.value,1,1)) 



	{



				document.submitevent.emailaddr.focus();



				return false;



	}



	if(document.submitevent.eventdate.value == "")



	{



				alert("Please enter the event date.");



				document.submitevent.eventdate.focus();



				return false;



	}



	var dat=document.submitevent.eventdate;



			if (isDate(dat.value)==false){



				dat.focus()



				return false



			}



	if(document.submitevent.eventname.value == "")



	{



				alert("Please enter the event name.");



				document.submitevent.eventname.focus();



				return false;



	}



	if(document.submitevent.location.value == "")



	{



				alert("Please enter the location name.");



				document.submitevent.location.focus();



				return false;



	}



	/*if(document.submitevent.timings.value == "")



	{



				alert("Please enter the timing.");



				document.submitevent.timings.focus();



				return false;



	}*/



	/*var timings=document.submitevent.timings.value;



		if(isNaN(timings) || (timings.indexOf("-") >= 0)) 



		{



				alert ("Please enter the timing in numeric value.");



				document.submitevent.timings.focus();



				return false;



		}







	if(document.submitevent.contactperson.value == "")



	{



				alert("Please enter the event contact person.");



				document.submitevent.contactperson.focus();



				return false;



	}



	if(document.submitevent.contactphone.value == "")



	{



				alert("Please enter the event contact phone number.");



				document.submitevent.contactphone.focus();



				return false;



	}*/



}	







//validation for subscibe today



function subtoday_validate(){



		if (document.emailus.firstname.value == "") 



		{



				alert ("Please enter the first name.");



				document.emailus.firstname.focus();



				return false;



		}



		if (document.emailus.lastname.value == "") 



		{



				alert ("Please enter the last name.");



				document.emailus.lastname.focus();



				return false;



		}



		if (document.emailus.address.value == "") 



		{



				alert ("Please enter the address.");



				document.emailus.address.focus();



				return false;



		}



		if (document.emailus.city.value == "") 



		{



				alert ("Please enter the city name.");



				document.emailus.city.focus();



				return false;



		}



		if (document.emailus.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.emailus.zip.focus();



				return false;



		}



		if (document.emailus.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.emailus.phone.focus();



				return false;



		}



			//Phone number validation		  



			var phone=document.emailus.phone;



			if(phone.value == ""){



			alert("Phone number is mandatory");



			phone.focus();



			return false;



			}



			if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



		if (document.emailus.username.value == "") 



		{



				alert ("Please enter the user name.");



				document.emailus.username.focus();



				return false;



		}



		if (document.emailus.password.value == "") 



		{



				alert ("Please enter the password.");



				document.emailus.password.focus();



				return false;



		}



		if (!validateEmail(document.emailus.emailaddr.value,1,1)) 



		{



				document.emailus.emailaddr.focus();



				return false;



		}



}







//validation for email us



function emailus_validate(){



		if (document.frm_emailus.name.value == "") 



		{



				alert ("Please enter the name.");



				document.frm_emailus.name.focus();



				return false;



		}



		if (document.frm_emailus.subject.value == "") 



		{



				alert ("Please enter the subject.");



				document.frm_emailus.subject.focus();



				return false;



		}



		if (!validateEmail(document.frm_emailus.emailaddr.value,1,1)) 



		{



				document.frm_emailus.emailaddr.focus();



				return false;



		}



}	







//validation for view news



function viewnews_validate(){



		if (document.newsopinion.yourname.value == "") 



		{



				alert ("Please enter the your name.");



				document.newsopinion.yourname.focus();



				return false;



		}



		if (!validateEmail(document.newsopinion.youremail.value,1,1)) 



		{



				document.newsopinion.youremail.focus();



				return false;



		}



}







//validation for links



function frlink_validate(){



		if (document.frm_frontlink.txt_name.value == "") 



		{



				alert ("Please enter the name.");



				document.frm_frontlink.txt_name.focus();



				return false;



		}



		if (!validateEmail(document.frm_frontlink.txt_email.value,1,1)) 



		{



				document.frm_frontlink.txt_email.focus();



				return false;



		}



		if (document.frm_frontlink.txt_linktitle.value == "") 



		{



				alert ("Please enter the website title.");



				document.frm_frontlink.txt_linktitle.focus();



				return false;



		}



		if (document.frm_frontlink.txt_fulllink.value == "") 



		{



				alert ("Please enter the website title.");



				document.frm_frontlink.txt_fulllink.focus();



				return false;



		}



		re = /^(file|http):\/\/\S+\.(com|net|org|info|biz|ws|us|tv|cc|in|cd|nw)$/i



		 if (!(re.test(document.frm_frontlink.txt_fulllink.value))) {



		 alert ("Invalid URL.");



		 document.frm_frontlink.txt_fulllink.focus();



		 return false;



		 }



	   /*if ((document.frm_frontlink.categoryname.value != "") && (document.frm_frontlink.txt_linkcategory.value != ""))



		{ 



					alert ("Please enter the category name.");



					document.frm_frontlink.txt_linkcategory.focus();



					return false;



		}*/



}







//validation for newsmember register



function newsmem_validate(){



		if (document.newsmem.username.value == "") 



		{



				alert ("Please enter the user name.");



				document.newsmem.username.focus();



				return false;



		}



		if (document.newsmem.password.value == "") 



		{



				alert ("Please enter the password.");



				document.newsmem.password.focus();



				return false;



		}



		if (document.newsmem.repassword.value == "") 



		{



				alert ("Please re-enter your password.");



				document.newsmem.repassword.focus();



				return false;



		}



		if (!validateEmail(document.newsmem.emailaddr.value,1,1)) 



		{



				document.newsmem.emailaddr.focus();



				return false;



		}



		if (document.newsmem.first.value == "") 



		{



				alert ("Please enter your first name.");



				document.newsmem.first.focus();



				return false;



		}



		if (document.newsmem.last.value == "") 



		{



				alert ("Please enter your last name.");



				document.newsmem.last.focus();



				return false;



		}



		if (document.newsmem.address.value == "") 



		{



				alert ("Please enter your address.");



				document.newsmem.address.focus();



				return false;



		}



		if (document.newsmem.city.value == "") 



		{



				alert ("Please enter the city name.");



				document.newsmem.city.focus();



				return false;



		}



		if (document.newsmem.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.newsmem.zip.focus();



				return false;



		}



		if (document.newsmem.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.newsmem.phone.focus();



				return false;



		}



		//Phone number validation		  



			var phone=document.newsmem.phone;



			if(phone.value == ""){



			alert("Phone number is mandatory");



			phone.focus();



			return false;



			}



			if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



			/*if (document.newsmem.byear.value == "") 



		{



				alert ("Please enter the birth year.");



				document.newsmem.byear.focus();



				return false;



		}*/



}







//validation for newsmail



function mailnews_validate(){



		if (document.frm_newsmail.txtfirst.value == "") 



		{



				alert ("Please enter the name.");



				document.frm_newsmail.txtfirst.focus();



				return false;



		}



		if (document.frm_newsmail.username.value == "") 



		{



				alert ("Please enter the user name.");



				document.frm_newsmail.username.focus();



				return false;



		}



		if (document.frm_newsmail.password.value == "") 



		{



				alert ("Please enter the password.");



				document.frm_newsmail.password.focus();



				return false;



		}



		if (!(validateEmail(document.frm_newsmail.txtemail.value,1,1))) 



		{



				document.frm_newsmail.txtemail.focus();



				return false;



		}



}				







//validation for checkout


function checkout_shippingtomailcopy()
{
	
if (!document.checkout.shiptomailcpy.checked) {

document.checkout.maddr1.value = '';
document.checkout.maddr2.value = '';
document.checkout.mcity.value = '';
document.checkout.mstate.selectedIndex = '0';
document.checkout.mstate_nous.value = '';
document.checkout.mcountry.selectedIndex = '0';
document.checkout.mzip.value = '';

} else {

document.checkout.maddr1.value = document.checkout.saddr1.value;
document.checkout.maddr2.value = document.checkout.saddr2.value;
document.checkout.mcity.value = document.checkout.scity.value;
document.checkout.mstate.value = document.checkout.sstate.value;
document.checkout.mstate_nous.value = document.checkout.sstate_nous.value;
document.checkout.mcountry.value = document.checkout.scountry.value;
document.checkout.mzip.value = document.checkout.szip.value;

}	
	
	
}


function checkout_validation(){



	



		if (document.checkout.first.value == "") 



		{



				alert ("Please enter the first name.");



				document.checkout.first.focus();



				return false;



		}



		if (document.checkout.last.value == "") 



		{



				alert ("Please enter the last name.");



				document.checkout.last.focus();



				return false;



		}



	if (!(validateEmail(document.checkout.emailaddr.value,1,1))) 



		{



				document.checkout.emailaddr.focus();



				return false;



		}



		if (document.checkout.contactphone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.checkout.contactphone.focus();



				return false;



		}



		//Phone number validation		  



			var phone=document.checkout.contactphone;



			if(phone.value == ""){



			alert("Phone number is mandatory");



			phone.focus();



			return false;



			}



			if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



	if(document.checkout.aut_shipstatus.value == "Yes") {



		if (document.checkout.saddr1.value == "") 



		{



				alert ("Please enter the line1 of shipping address.");



				document.checkout.saddr1.focus();



				return false;



		}


/*
		if (document.checkout.saddr2.value == "") 



		{



				alert ("Please enter the line2 of shipping address.");



				document.checkout.saddr2.focus();



				return false;



		}
*/


		if (document.checkout.scity.value == "") 



		{



				alert ("Please enter the city name.");



				document.checkout.scity.focus();



				return false;



		}



		if (document.checkout.szip.value == "") 



		{



				alert ("Please enter the zipcode.");



				document.checkout.szip.focus();



				return false;



		}



	}



		/*if (document.checkout.shippingid.value == "") 



		 {



				alert ("Please select the shipping method.");



				document.checkout.shippingid.focus();



				return false;



		 }*/



		



	//	var deli=document.checkout.deliaddr.checked;



				



						if (document.checkout.maddr1.value == "") 



						{



								alert ("Please enter the line1 of mailing address.");



								document.checkout.maddr1.focus();



								return false;



						}


/*
						if (document.checkout.maddr2.value == "") 



						{



								alert ("Please enter the line2 of mailing address.");



								document.checkout.maddr2.focus();



								return false;



						}
*/


						if (document.checkout.mcity.value == "") 



						{



								alert ("Please enter the city of mailing address.");



								document.checkout.mcity.focus();



								return false;



						}



						if (document.checkout.mzip.value == "") 



						{



								alert ("Please enter the zip code of mailing address.");



								document.checkout.mzip.focus();



								return false;



						}



if(document.checkout.aut_shipstatus.value == "Yes") {						


/*
		 if (document.checkout.deliverydate.value == "") 



			 {



					alert ("Please enter the delivery date of mailing address.");



					document.checkout.deliverydate.focus();



					return false;



			 }



			var dat=document.checkout.deliverydate;



			if (isDate(dat.value)==false){



				dat.focus();



				return false;



			}
*/


}



						



						



				



				var chklen = document.checkout.ONECART.length;



				chkflagvalue = 0;



				if(chklen > 0){



						for(index = 0; index < chklen ; index++){



							if (!(document.checkout.ONECART[index].checked))



								chkflagvalue = chkflagvalue + 1; 



						}



				



					



					if(chkflagvalue == chklen){



					alert ("Please choose any one of the payment choice.");



					return false;



					}



				}



				else{



						if (!(document.checkout.payment_type.checked)){



						alert ("Please choose any one of the payment choice.");



						return false;



						}	



				}



				



















	for(index = 0; index < chklen ; index++){



		 if (document.checkout.ONECART[index].checked){



				if(document.checkout.ONECART[index].value == "AN"){



						if (document.checkout.nameoncard.value == "") 



						{



								alert ("Please enter the card name.");



								document.checkout.nameoncard.focus();



								return false;



						}



						if (document.checkout.cardnumber.value == "") 



						{



								alert ("Please enter the card number.");



								document.checkout.cardnumber.focus();



								return false;



						}



						if (document.checkout.expirydate.value == "") 



						{



								alert ("Please enter the expiration date.");



								document.checkout.expirydate.focus();



								return false;



						}



				}



		 }



	}



				



				



}







function cluser_validation(){



	if (document.cluserlogin.username.value == ""){



				alert ("Please enter the User Name.");



				document.cluserlogin.username.focus();



				return false;



	}



	if (document.cluserlogin.password.value == ""){



				alert ("Please enter the Password.");



				document.cluserlogin.password.focus();



				return false;



	}



}



function check_validation()



{



	



	if (document.clprofile.first.value == ""){



				alert ("Please enter the first name.");



				document.clprofile.first.focus();



				return false;



		}



		if (document.clprofile.last.value == ""){



				alert ("Please enter the last name.");



				document.clprofile.last.focus();



				return false;



		}



		if (document.clprofile.address.value == ""){



				alert ("Please enter the Address1.");



				document.clprofile.address.focus();



				return false;



		}



		



		if (document.clprofile.city.value == ""){



				alert ("Please enter the City.");



				document.clprofile.city.focus();



				return false;



		}



		if(document.clprofile.country.value == "")



		{



		        alert("Please select the country");



				document.clprofile.country.focus();



				return false;



		}



		if(document.clprofile.country.value == "United States of America" && document.clprofile.state1.value == "")



		{



		        alert("Please select the state");



				document.clprofile.state1.focus();



				return false;



		}



		if(document.clprofile.country.value != "United States of America" && document.clprofile.state.value == "")



		{



		        alert("Please enter the state");



				document.clprofile.state.focus();



				return false;



		}



		if (document.clprofile.zip.value == "") 



		{



				alert ("Please enter the zip code.");



				document.clprofile.zip.focus();



				return false;



		}



				if (document.clprofile.phone.value == "") 



		{



				alert ("Please enter the phone number.");



				document.clprofile.phone.focus();



				return false;



		}



		phone = document.clprofile.phone;



		if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



		if (!validateEmail(document.clprofile.emailaddr.value,1,1)){



				document.clprofile.emailaddr.focus();



				return false;



		}



		if (document.clprofile.txtUsername.value == "") {



				alert ("Please enter the User name.");



				document.clprofile.txtUsername.focus();



				return false;



		}



		var namelen = document.clprofile.txtUsername.value;



		if(parseInt(namelen.length) < 6){



			alert ("Please enter the User name with atleast 6 characters.");



			document.clprofile.txtUsername.focus();



			return false;



		}



        if (document.clprofile.txtPassword.value == "") 



		{



				alert ("Please enter the password.");



				document.clprofile.txtPassword.focus();



				return false;



		}



		var passlen = document.clprofile.txtPassword.value;



		if(parseInt(passlen.length) < 6){



			alert ("Please enter the Password with atleast 6 characters.");



			document.clprofile.txtPassword.focus();



			return false;



		}



		 if (document.clprofile.txtPassword.value != document.clprofile.txtConfPassword.value) 



		{



				alert ("Password Mismatch. Please enter the confirm password correctly.");



				document.clprofile.txtConfPassword.focus();



				return false;



		}







		}











function goLastMonth(month, year,id) 



{ 



// If the month is Januaru, decrement the year 



if(month == 1) 



{ 



--year; 



month = 13; 



} 



month=month-1;



if(month <10)



month="0"+month;







document.location.href = 'events.php?do=event&month='+month+'&year='+year+'&id='+id; 



} 



function goNextMonth(month, year ,id) 



{ 



// If the month is December, increment the year 



if(month == 12) 



{ 



++year; 



month = 0; 



} 



month=month+1;



if(month <10)



month="0"+month;



document.location.href = 'events.php?do=event&month='+month+'&year='+year+'&id='+id; 



} 



function taCount(entrada,salida,texto) {



	  var longitud=document.getElementById('editor1').value.length;



	  document.getElementById('myCounter').innerHTML = texto.replace("{CHAR}",longitud) + " ";



}



 //Function phone validation Script



// Declaring required variables



var digits = "0123456789";



// non-digit characters which are allowed in phone numbers



var phoneNumberDelimiters = "()-. ";



// characters which are allowed in international phone numbers



// (a leading + is OK)



var validWorldPhoneChars = phoneNumberDelimiters + "+";



// Minimum no of digits in an international phone no.



var minDigitsInIPhoneNumber = 10;







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++)



    {   



        // Check that current character isn't whitespace.



        var c = s.charAt(i);



        if (bag.indexOf(c) == -1) returnString += c;



    }



    return returnString;



}







function checkInternationalPhone(strPhone){



s=stripCharsInBag(strPhone,validWorldPhoneChars);



return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);



}







//Email Validation Script



function validateEmail(addr,man,db) {



	if (addr == '' && man) {



	   if (db) alert('Email address is mandatory');



	   return false;



	}



	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';



	for (i=0; i<invalidChars.length; i++) {



	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {



		  if (db) alert('Email address contains invalid characters');



		  return false;



	   }



	}



	for (i=0; i<addr.length; i++) {



	   if (addr.charCodeAt(i)>127) {



		  if (db) alert("Email address contains non ascii characters.");



		  return false;



	   }



	}







	var atPos = addr.indexOf('@',0);



	if (atPos == -1) {



	   if (db) alert('Email address must contain an @');



	   return false;



	}



	if (atPos == 0) {



	   if (db) alert('Email address must not start with @');



	   return false;



	}



	if (addr.indexOf('@', atPos + 1) > - 1) {



	   if (db) alert('Email address must contain only one @');



	   return false;



	}



	if (addr.indexOf('.', atPos) == -1) {



	   if (db) alert('Email address must contain a period in the domain name');



	   return false;



	}



	if (addr.indexOf('@.',0) != -1) {



	   if (db) alert('period must not immediately follow @ in email address');



	   return false;



	}



	if (addr.indexOf('.@',0) != -1){



	   if (db) alert('period must not immediately precede @ in email address');



	   return false;



	}



	if (addr.indexOf('..',0) != -1) {



	   if (db) alert('two periods must not be adjacent in email address');



	   return false;



	}



	var suffix = addr.substring(addr.lastIndexOf('.')+1);



	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {



	   if (db) alert('invalid primary domain in email address');



	   return false;



	}



return true;



}







//Date Validation format mm/dd/yyyy



// Declaring valid date character, minimum year and maximum year



var dtCh= "/";



var minYear=2000;



var maxYear=3100;







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){



	



	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



}



	



function date_valid(txt_Disfrom,txt_Disto){



	var stdate=txt_Disfrom.split("/");



	var enddate=txt_Disto.split("/");



	var prostdate = new Date();



	prostdate.setFullYear(stdate[2]);



	prostdate.setMonth(stdate[0]-1);



	prostdate.setDate(stdate[1]);



	



	var proenddate = new Date();



	proenddate.setFullYear(enddate[2]);



	proenddate.setMonth(enddate[0]-1);



	proenddate.setDate(enddate[1]);



	



	var startingdate = prostdate.getTime();



	var endingdate = proenddate.getTime();







	if(startingdate > endingdate)



	{



		return false;



	}



	return true;



}







function profilevalidation()



{



	var username=document.form1.txt_username.value;



	 if(username == "")



			 {



			 alert("Enter Username");



			 document.form1.txt_username.focus();



			 return false;



			 }



			 



	var password=document.form1.txt_password.value;



	



	 if(password == "")



			 {



			 alert("Enter Password");



			 document.form1.txt_password.focus();



			 return false;



			 }



	 if(password.length < 6)



			 {



			 alert("Password should above 6 characters");



			 document.form1.txt_password.focus();



			 return false;



			 } 



	



	var submenu=document.form1.submenu.value;



	 if(submenu == "")



			 {



			 alert("Select Category");



			 document.form1.submenu.focus();



			 return false;



			 }



	



	var firstname=document.form1.txt_fname.value;



	 if(firstname == "")



			 {



			 alert("FirstName  is empty");



			 document.form1.txt_fname.focus();



			 return false;



			 }



			 



	var lastname=document.form1.txt_lname.value;



	 if(lastname == "")



			 {



			 alert("LastName  is empty");



			 document.form1.txt_lname.focus();



			 return false;



			 }



			 



	var address=document.form1.txt_address1.value;



	 if(address == "")



			 {



			 alert("Addressline1 is empty");



			 document.form1.txt_address1.focus();



			 return false;



			 }



			 



	var city=document.form1.txt_city.value;



	 if(city == "")



			 {



			 alert("City Field is empty");



			 document.form1.txt_city.focus();



			 return false;



			 }



			 



	var state=document.form1.txt_state.value;



	 if(state == "")



			 {



			 alert("State Field is empty");



			 document.form1.txt_state.focus();



			 return false;



			 }



			 



	var member=document.form1.member.value;



	 if(member == "")



			 {



			 alert("Select any one membership");



			 document.form1.member.focus();



			 return false;



			 }



			 



	var day=document.form1.day.value;



	 if(day == "")



			 {



			 alert("Select Date");



			 document.form1.day.focus();



			 return false;



			 }



			 



	var month=document.form1.month.value;



	 if(month == "")



			 {



			 alert("Select Month");



			 document.form1.month.focus();



			 return false;



			 }



	if(document.form1.mail[1].checked == true){



		var email=document.form1.txt_email.value;



		if(document.form1.txt_email.value == ""){



				alert("You have selected the option as Email for receiving bulletins.\n So, please enter your email");



				return false;



		}



		if (!validateEmail(document.form1.txt_email.value,1,1)) 



		{



				document.form1.txt_email.focus();



				return false;



		}



	}



	/*var year=document.form1.year.value;



	 if(year == "")



			 {



			 alert("Enter Year");



			 document.form1.year.focus();



			 return false;



			 }



	if(isNaN(year))



			{



				 alert("Enter only Nubers");



				 document.form1.year.focus();



				 return false;



			}



	if(year.length > 4 && year.length < 4)



			{



				 alert("Enter valid Year");



				 document.form1.year.focus();



				 return false;



			}



			



	*/



	



	



		phone = document.form1.txt_phonehome;



		if (checkInternationalPhone(phone.value)==false){



			alert("Please Enter a Valid Phone Number")



			phone.value=""



			phone.focus()



			return false



			}



			 



			 



		var flag=0;



		var chklen = document.form1.task_profile.length;



		for(index=0;index <chklen; index++){



			if(document.form1.task_profile[index].checked == false){



				flag++;



			}



		}



		if(flag == chklen){



			alert("Please choose any one of the task choice");



			return false;



		}



			 



			 



	var profile=document.form1.txt_profile.value;



	



	 if(profile == "")



			 {



			 alert("Select Profile");



			 document.form1.txt_profile.focus();



			 return false;



			 }



}







function loginvalidation()



{



	var username=document.frm_member.txt_username.value;



	 if(username == "")



			 {



			 alert("Enter Username");



			 document.frm_member.txt_username.focus();



			 return false;



			 }



			 



	var password=document.frm_member.txt_Password.value;



	



	 if(password == "")



			 {



			 alert("Enter Password");



			 document.frm_member.txt_Password.focus();



			 return false;



			 }



	 if(password.length < 6)



			 {



			 alert("Password should above 6 characters");



			 document.frm_member.txt_Password.focus();



			 return false;



			 } 



}







function reportvalidation()



{



	var searchval=document.form1.search1.value;



	 if(searchval == "")



			 {



			 alert("Enter Search phrase");



			 document.form1.search1.focus();



			 return false;



			 }



}







