// JavaScript Document
// ------------- This is Script For Admin Pages----------------------//
function menu() 
    {
      alert("OK");
	  var a=document.prod_add.categorylist.value;
	  document.location.href='index.php?task=add_prod&flg=menu&menuid='+a;
    }

	//script for Clients information

function clients_form()
{
	
	var client_type=document.client_frm.client_type.value;
	if(client_type=="")
	{
	alert("Please choose the Client's Type - Buyer/Seller");
	document.client_frm.client_type.focus();
	return false;
	}
	if(client_type=="Seller")
	{	
		var VarUserId=document.client_frm.VarUserId.value;
		if(VarUserId=="")
		{
		alert("Please enter the Seller User Id");
		document.client_frm.VarUserId.focus();
		return false;
		}	
	}
	var varFullname=document.client_frm.varFullname.value;
	if(varFullname=="")
	{
	alert("Please enter the Full Name");
	document.client_frm.varFullname.focus();
	return false;
	}
	var varAddress=document.client_frm.varAddress.value;
	if(varAddress=="")
	{
	alert("Please enter the address");
	document.client_frm.varAddress.focus();
	return false;
	}
	var varCity=document.client_frm.varCity.value;
	if(varCity=="")
	{
	alert("Please enter the city");
	document.client_frm.varCity.focus();
	return false;
	}
	
	var varState=document.client_frm.varState.value;
	if(varState=="select")
	{
	alert("Please select the state");
	document.client_frm.varState.focus();
	return false;
	}
	
	var varZipcode=document.client_frm.varZipcode.value;
	if(varZipcode=="")
	{
	alert("Please enter the zipcode");
	document.client_frm.varZipcode.focus();
	return false;
	}
	/*
	var varEmail=document.client_frm.varEmail.value;
	if(varEmail=="")
	{
	alert("Please enter the email");
	document.client_frm.varEmail.focus();
	return false;
	}
	
	
	
	 if(!validateEmail(document.client_frm.varEmail.value,1,1))
	{
	   document.client_frm.varEmail.focus();
	   return false;
	}
	var varPhone=document.client_frm.varPhone.value;
	if(varPhone=="")
	{
	alert("Please enter the Phone number");
	document.client_frm.varPhone.focus();
	return false;
	}
	*/
	var varUsername=document.client_frm.varUsername.value;
	if(varUsername=="")
	{
	alert("Please enter the Username");
	document.client_frm.varUsername.focus();
	return false;
	}
	var varPassword=document.client_frm.varPassword.value;
	if(varPassword=="")
	{
	alert("Please enter the Password");
	document.client_frm.varPassword.focus();
	return false;
	}
}

	
//Script validation for displaying the submenu-category
var lists=new Array();
var lists1=new Array();

function emptyList(box) 
{
	while (box.options.length) box.options[0] = null;
}

function fillList( box, arr ) 
{
	//alert(arr);
	for ( i = 0; i < arr[0].length; i++ ) 
	{
		opton = new Option( arr[0][i], arr[0][i+1] );
		box.options[box.length] = opton;
		i=i+1;
	}
	box.selectedIndex=0;
}

//script for Subscriber validation 
function testimonial_validation()
{
		 if (document.TetimonialForm.varName.value== "" )
		 { 
			 alert ("Please Enter Name");
			 document.TetimonialForm.varName.focus();
			 return false;
		 }
		 if (document.TetimonialForm.testimonial.value== "" )
		 { 
			 alert ("Please Enter Testimonial contents");
			 document.TetimonialForm.testimonial.focus();
			 return false;
		 }		  
		
}

//script for Seller information

function sellerinform()
{
	var varFullname=document.sellerform.varFullname.value;
	if(varFullname=="")
	{
	alert("Please enter the Full Name");
	document.sellerform.varFullname.focus();
	return false;
	}
	var varAddress=document.sellerform.varAddress.value;
	if(varAddress=="")
	{
	alert("Please enter the address");
	document.sellerform.varAddress.focus();
	return false;
	}
	var varCity=document.sellerform.varCity.value;
	if(varCity=="")
	{
	alert("Please enter the city");
	document.sellerform.varCity.focus();
	return false;
	}
	
	var varState=document.sellerform.varState.value;
	if(varState=="select")
	{
	alert("Please select the state");
	document.sellerform.varState.focus();
	return false;
	}
	
	var varZipcode=document.sellerform.varZipcode.value;
	if(varZipcode=="")
	{
	alert("Please enter the zipcode");
	document.sellerform.varZipcode.focus();
	return false;
	}
	
	var varEmail=document.sellerform.varEmail.value;
	if(varEmail=="")
	{
	alert("Please enter the email");
	document.sellerform.varEmail.focus();
	return false;
	}
	
	
	 if(!validateEmail(document.sellerform.varEmail.value,1,1))
	{
	   document.sellerform.varEmail.focus();
	   return false;
	}
	
	var varPhone=document.sellerform.varPhone.value;
	if(varPhone=="")
	{
	alert("Please enter the Phone number");
	document.sellerform.varPhone.focus();
	return false;
	}
	}
	
	
	
	//script for Buyer information

function buyerinform()
{

	var varFullname=document.buysellform.varFullname.value;
	if(varFullname=="")
	{
	alert("Please enter the Full Name");
	document.buysellform.varFullname.focus();
	return false;
	}
	var varAddress=document.buysellform.varAddress.value;
	if(varAddress=="")
	{
	alert("Please enter the address");
	document.buysellform.varAddress.focus();
	return false;
	}
	var varCity=document.buysellform.varCity.value;
	if(varCity=="")
	{
	alert("Please enter the city");
	document.buysellform.varCity.focus();
	return false;
	}
	
	var varState=document.buysellform.varState.value;
	if(varState=="select")
	{
	alert("Please select the state");
	document.buysellform.varState.focus();
	return false;
	}
	
	var varZipcode=document.buysellform.varZipcode.value;
	if(varZipcode=="")
	{
	alert("Please enter the zipcode");
	document.buysellform.varZipcode.focus();
	return false;
	}
	
	var varEmail=document.buysellform.varEmail.value;
	if(varEmail=="")
	{
	alert("Please enter the email");
	document.buysellform.varEmail.focus();
	return false;
	}
	
	
	 if(!validateEmail(document.buysellform.varEmail.value,1,1))
	{
	   document.buysellform.varEmail.focus();
	   return false;
	}
	
	var varPhone=document.buysellform.varPhone.value;
	if(varPhone=="")
	{
	alert("Please enter the Phone number");
	document.buysellform.varPhone.focus();
	return false;
	}
	}
	
	//Script for Front login
	
function logvalidate()
{
	var type1=document.loginfrm.type[0].checked;
	var type2=document.loginfrm.type[1].checked;
	if(type1=="" && type2=="")
	{
	alert("Please choose the type Seller/Buyer");
	document.loginfrm.type[0].focus();
	return false;
	}
	var varUsername=document.loginfrm.varUsername.value;
	if(varUsername=="")
	{
	alert("Please enter the username");
	document.loginfrm.varUsername.focus();
	return false;
	}
	
	var varPassword=document.loginfrm.varPassword.value;
	if(varPassword=="")
	{
	alert("Please enter the password");
	document.loginfrm.varPassword.focus();
	return false;
	}
	
}
	
//Script for Add Report
function reportvalidation()
{

	var varReporttitle=document.reportform.varReporttitle.value;
	if(varReporttitle=="")
	{
	alert("Please enter the Report Title");
	document.reportform.varReporttitle.focus();
	return false;
	}
	
	var varDownloadname=document.reportform.varDownloadname.value;
	if(varDownloadname=="")
	{
	alert("Please upload the file");
	document.reportform.varDownloadname.focus();
	return false;
	}
}

//script for Edit Report form

function reportvalidation1()
{

	var varReporttitle=document.reporteditform.varReporttitle.value;
	if(varReporttitle=="")
	{
	alert("Please enter the Report Title");
	document.reporteditform.varReporttitle.focus();
	return false;
	}
	
	/*var varDownloadname=document.reporteditform.varDownloadname.value;
	if(varDownloadname=="")
	{
	alert("Please upload the file");
	document.reporteditform.varDownloadname.focus();
	return false;
	}*/
}

//Script foe Send newsletter
function news_validation()
{
			if(document.frm_new.txtFromName.value=="")
			{
			   alert("Enter the FromName");
			   document.frm_new.txtFromName.focus();
			   return false;
			}
	 if(!validateEmail(document.frm_new.txtFromEmail.value,1,1))
	{
	   document.frm_new.txtFromEmail.focus();
	   return false;
	}
			if(document.frm_new.txtSubject.value=="")
			{
			   alert("Enter the Subject");
			   document.frm_new.txtSubject.focus();
			   return false;
			}
/*			if(document.frm_new.txtMessage.value=="")
			{
			   alert("Enter the Message");
			   document.frm_new.txtMessage.focus();
			   return false;
			}
*/
}

function changeList(box) 
{
	//alert(box);
	list = lists[box.options[box.selectedIndex].value];
	//alert(list);
	if(box.options[box.selectedIndex].value != "Select" && box.options[box.selectedIndex].value != "0")
	{
		emptyList(box.form.category);
		fillList(box.form.category, list );
	
		/*emptyList(box.form.subject);

		fillList(box.form.subject, emptycenters );*/
	}
	
}

function emptyList(sw) 
{
	while (sw.options.length) sw.options[0] = null;
}

function fillList( sw, arr ) 
{
	//alert(arr);
	for ( i = 0; i < arr[0].length; i++ ) 
	{
		opton = new Option( arr[0][i], arr[0][i+1] );
		sw.options[sw.length] = opton;
		i=i+1;
	}
	sw.selectedIndex=0;
}

function changeList1(sw) 
{
	//alert(box);
	list1 = lists1[sw.options[sw.selectedIndex].value];
	
	//alert(list);
	if(sw.options[sw.selectedIndex].value != "Select" && sw.options[sw.selectedIndex].value != "0")
	{
		emptyList(sw.form.category);
		fillList(sw.form.category, list1 );
	
		/*emptyList(box.form.subject);

		fillList(box.form.subject, emptycenters );*/
	}
	
}

	

//Left drop down Menu script
startList = function() {

	// code for IE
	if(!document.body.currentStyle) return;
	var subs = document.getElementsByName('submenu');
	for(var i=0; i<subs.length; i++) {
		var li = subs[i].parentNode;
		if(li && li.lastChild.style) {
			li.onmouseover = function() {
				this.lastChild.style.visibility = 'visible';
			}
			li.onmouseout = function() {
				this.lastChild.style.visibility = 'hidden';
			}
		}
	}
}
window.onload=startList;


/*function menu() 
    {
      var a=document.editfrm.menulist.value;
	  document.location.href='index.php?task=view&flg=menu&menuid='+a;
    }
function smenu() 
    {
      var a=document.editfrm.menulist.value;
	  var b=document.editfrm.submnu.value;
	  document.location.href='index.php?task=view&flg=menu&flag=smenu&menuid='+a+'&smenuid='+b;
    }
*/
function popupmenu(url)
{
width=screen.width;
	height=screen.height;
	center=width/2;
	center1=height/2;
	leftpos=center-244;
	toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=600,width=800,left='+leftpos+',top='+toppos+',resizable=yes,scrollbars=no');
	if (window.focus) {newwindow.focus()}
}
function popupmenus(url)
{
	width=screen.width;
	//height=screen.height;
	center=width/2;
	//center1=height/2;
	leftpos=20;
	//toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=700,width=500,left='+leftpos+',top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

function popupphoto(url)
{
	width=screen.width;
	//height=screen.height;
	center=width/2;
	//center1=height/2;
	leftpos=20;
	//toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=600,width=900,left='+leftpos+',top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function popupImage(url)
{
	width=screen.width;
	//height=screen.height;
	center=width/2;
	//center1=height/2;
	leftpos=20;
	//toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=600,width=600,left='+leftpos+',top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function poporder(url)
{
	var left = (window.screen.width/2)-200;
	newwindow=window.open(url,'name','scrollbars=yes,resizable=yes,height=600,width=600,left='+left+',top=20');
	if (window.focus) {newwindow.focus()}
}
// FORUM VALIDATION ADDFORM
function forumValidate()
{
		 var categorylist= document.videoforum_add.categorylist.value;
		 if (categorylist== "Choose" )
		 { 
			 alert ("Please select the Category Name");
			 document.videoforum_add.categorylist.focus();
			 return false;
		 }
				
		 var title= document.videoforum_add.title.value;
		 if (title== "" )
		 { 
			 alert ("Please enter the Forum Title");
			 document.videoforum_add.title.focus();
			 return false;
		 }
		 var description= document.videoforum_add.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Forum Description");
			 document.videoforum_add.description.focus();
			 return false;
		 }
				
		 var videofile= document.videoforum_add.videofile.value;
		 if (videofile== "" )
		 { 
			 alert ("Please upload Your Video file");
			 document.videoforum_add.videofile.focus();
			 return false;
		 }
}

// FORUM VALIDATION EDITFORM
function forumeditValidate()
{
		 var categorylist= document.videoforum_edit.categorylist.value;
		 if (categorylist== "Choose" )
		 { 
			 alert ("Please select the Category Name");
			 document.videoforum_edit.categorylist.focus();
			 return false;
		 }
		 
		 var title= document.videoforum_edit.title.value;
		 if (title== "" )
		 { 
			 alert ("Please enter the Forum Title");
			 document.videoforum_edit.title.focus();
			 return false;
		 }
		 var description= document.videoforum_edit.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Forum Description");
			 document.videoforum_edit.description.focus();
			 return false;
		 }
		
		 
}
// END FORUM VIDEO VALIDATION

// PRODUCT VALIDATION ADDFORM
function prodvalidate()
{
		 var categorylist= document.prod_add.categorylist.value;
		 if (categorylist== "Choose" )
		 { 
			 alert ("Please select the Category Name");
			 document.prod_add.categorylist.focus();
			 return false;
		 }		 
		 var description= document.prod_add.product.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the ProductName");
			 document.prod_add.product.focus();
			 return false;
		 }
		 var description= document.prod_add.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Product Description");
			 document.prod_add.description.focus();
			 return false;
		 }
		 var amount= document.prod_add.amount.value;
		 if (amount== "" )
		 { 
			 alert ("Please enter the Product Amount");
			 document.prod_add.amount.focus();
			 return false;
		 }
		 var thumbimg= document.prod_add.thumbimg.value;
		 if (thumbimg== "" )
		 { 
			 alert ("Please upload Thumb image");
			 document.prod_add.thumbimg.focus();
			 return false;
		 }
		  var largimg= document.prod_add.largimg.value;
		 if (largimg== "" )
		 { 
			 alert ("Please upload Large image");
			 document.prod_add.largimg.focus();
			 return false;
		 }
}

function Product_validation()
{	

	var varAddress = document.Product_frm.varAddress.value;
	 if (varAddress == "" )
	 { 
	 alert ("Please enter the Address");
	 document.Product_frm.varAddress.focus();
	 return false;
	 }
	  var varCity = document.Product_frm.varCity.value;
	 if (varCity == "" )
	 { 
	 alert ("Please enter the City");
	 document.Product_frm.varCity.focus();
	 return false;
	 } 
 	  var varState = document.Product_frm.varState.value;
	 if (varState == "" )
	 { 
	 alert ("Please enter the State");
	 document.Product_frm.varState.focus();
	 return false;
	 } 
 	  var varZip = document.Product_frm.varZip.value;
	 if (varZip == "" )
	 { 
	 alert ("Please enter the Zip");
	 document.Product_frm.varZip.focus();
	 return false;
	 } 	  
	  var varBeds = document.Product_frm.varBeds.value;
	 if (varBeds == "" )
	 { 
	 alert ("Please enter the Beds");
	 document.Product_frm.varBeds.focus();
	 return false;
	 } 	  
	  var varBaths = document.Product_frm.varBaths.value;
	 if (varBaths == "" )
	 { 
	 alert ("Please enter the Baths");
	 document.Product_frm.varBaths.focus();
	 return false;
	 } 
	  var varSquareFootage = document.Product_frm.varSquareFootage.value;
	 if (varSquareFootage == "" )
	 { 
	 alert ("Please enter the Square Footage");
	 document.Product_frm.varSquareFootage.focus();
	 return false;
	 } 	
	 var varCashPrice = document.Product_frm.varCashPrice.value;
	 if (varCashPrice == "" )
	 { 
	 alert ("Please enter Cash Price");
	 document.Product_frm.varCashPrice.focus();
	 return false;
	 } 
	 var varComments = document.Product_frm.varComments.value;
	  if (varComments == "" )
	 { 
	 alert ("Please enter Comments Here");
	 document.Product_frm.varComments.focus();
	 return false;
	 }
	 var varProductstatus = document.Product_frm.varProductstatus.value;
	 if (varProductstatus == "" )
	 { 
	 alert ("Please Enter the Property Status");
	 document.Product_frm.varProductstatus.focus();
	 return false;
	 }
 	var varOrderNum = document.Product_frm.varOrderNum.value;
	 if (varOrderNum == "" )
	 { 
	 alert ("Please Enter the MLS Number");
	 document.Product_frm.varOrderNum.focus();
	 return false;
	 }
 if (isNaN(varOrderNum))
	 { 
	 alert ("Enter Numeric Value");
	 document.Product_frm.varOrderNum.focus();
	 return false;
	 }  
	 
	 
	   var varViewtoururl = document.Product_frm.varViewtoururl.value;
	  if (varViewtoururl == "" )
	 { 
	 alert ("Please Enter the virtual tour url");
	 document.Product_frm.varViewtoururl.focus();
	 return false;
	 }
	 
	  var contactemail = document.Product_frm.varContactus.value;
	  if (contactemail == "" )
	 { 
	 alert ("Please Enter the email Address for contact");
	 document.Product_frm.varContactus.focus();
	 return false;
	 }
	  if (!validateEmail(document.Product_frm.varContactus.value,1,1)) 
		 {
		 document.Product_frm.varContactus.focus();
		 return false;
		 }
	  var brochurepdf = document.Product_frm.varPrintablefile.value;
	   if (brochurepdf == "" )
	 { 
	 alert ("Please Enter the brochure pdf file");
	 document.Product_frm.varPrintablefile.focus();
	 return false;
	 }
	  var varThumbimage = document.Product_frm.varThumbimage.value;
	   if (varThumbimage == "" )
	 { 
	 alert ("Please Enter the Thumb Image");
	 document.Product_frm.varThumbimage.focus();
	 return false;
	 }
	  var varLargeimage = document.Product_frm.varLargeimage.value;
	   if (varLargeimage == "" )
	 { 
	 alert ("Please Enter the Large Image");
	 document.Product_frm.varLargeimage.focus();
	 return false;
	 }

}

//Property form Edit validation
function Product_validation_edit()
{	

	  var varAddress = document.Product_frm.varAddress.value;
	 if (varAddress == "" )
	 { 
	 alert ("Please enter the Address");
	 document.Product_frm.varAddress.focus();
	 return false;
	 }
	  var varCity = document.Product_frm.varCity.value;
	 if (varCity == "" )
	 { 
	 alert ("Please enter the City");
	 document.Product_frm.varCity.focus();
	 return false;
	 } 
 	  var varState = document.Product_frm.varState.value;
	 if (varState == "" )
	 { 
	 alert ("Please enter the State");
	 document.Product_frm.varState.focus();
	 return false;
	 } 
 	  var varZip = document.Product_frm.varZip.value;
	 if (varZip == "" )
	 { 
	 alert ("Please enter the Zip");
	 document.Product_frm.varZip.focus();
	 return false;
	 } 	  
	  var varBeds = document.Product_frm.varBeds.value;
	 if (varBeds == "" )
	 { 
	 alert ("Please enter the Beds");
	 document.Product_frm.varBeds.focus();
	 return false;
	 } 	
	  var varBaths = document.Product_frm.varBaths.value;
	 if (varBaths == "" )
	 { 
	 alert ("Please enter the Baths");
	 document.Product_frm.varBaths.focus();
	 return false;
	 } 
	  var varSquareFootage = document.Product_frm.varSquareFootage.value;
	 if (varSquareFootage == "" )
	 { 
	 alert ("Please enter the Square Footage");
	 document.Product_frm.varSquareFootage.focus();
	 return false;
	 } 	
	 var varCashPrice = document.Product_frm.varCashPrice.value;
	 if (varCashPrice == "" )
	 { 
	 alert ("Please enter Cash Price");
	 document.Product_frm.varCashPrice.focus();
	 return false;
	 } 
	 var varComments = document.Product_frm.varComments.value;
	  if (varComments == "" )
	 { 
	 alert ("Please enter Comments Here");
	 document.Product_frm.varComments.focus();
	 return false;
	 }
	 var varProductstatus = document.Product_frm.varProductstatus.value;
	 if (varProductstatus == "" )
	 { 
	 alert ("Please select the Property Status");
	 document.Product_frm.varProductstatus.focus();
	 return false;
	 } 
 	var varOrderNum = document.Product_frm.varOrderNum.value;
	 if (varOrderNum == "" )
	 { 
	 alert ("Please Enter the MLS Number");
	 document.Product_frm.varOrderNum.focus();
	 return false;
	 }
 if (isNaN(varOrderNum))
	 { 
	 alert ("Enter Numeric Value");
	 document.Product_frm.varOrderNum.focus();
	 return false;
	 }  
	 
	  var varViewtoururl = document.Product_frm.varViewtoururl.value;
	  if (varViewtoururl == "" )
	 { 
	 alert ("Please Enter the virtual tour url");
	 document.Product_frm.varViewtoururl.focus();
	 return false;
	 }
	 
	  var contactemail = document.Product_frm.varContactus.value;
	  if (contactemail == "" )
	 { 
	 alert ("Please Enter the email Address for contact");
	 document.Product_frm.varContactus.focus();
	 return false;
	 }
	  if (!validateEmail(document.Product_frm.varContactus.value,1,1)) 
		 {
		 document.Product_frm.varContactus.focus();
		 return false;
		 }

}

// END PROPERTY VALIDATION

//script for cms validation 
function checkCms()
{
// 		 var Title= document.cms.Title.value;
// 		 if (Title== "" )
// 		 { 
// 			 alert ("Please enter the Title");
// 			 document.cms.Title.focus();
// 			 return false;
// 		 }
		  var metatitle= document.cms.metatitle.value;
		 if (metatitle== "" )
		 { 
			 alert ("Please enter the Meta Title");
			 document.cms.metatitle.focus();
			 return false;
		 }
		  var keyword= document.cms.keyword.value;
		 if (keyword== "" )
		 { 
			 alert ("Please enter the Meta Keyword");
			 document.cms.keyword.focus();
			 return false;
		 }
		  var description= document.cms.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Meta Description");
			 document.cms.description.focus();
			 return false;
		 }

} 

//script for dynamic cms validation 
function checkCmsdyn()
{
		 var menuname= document.cmsdyn.menuname.value;
		 if (menuname== "" )
		 { 
			 alert ("Please enter the Menuname");
			 document.cmsdyn.menuname.focus();
			 return false;
		 }
		 var Title= document.cmsdyn.Title.value;
		 if (Title== "" )
		 { 
			 alert ("Please enter the Title");
			 document.cmsdyn.Title.focus();
			 return false;
		 }
		  var metatitle= document.cmsdyn.metatitle.value;
		 if (metatitle== "" )
		 { 
			 alert ("Please enter the Meta Title");
			 document.cmsdyn.metatitle.focus();
			 return false;
		 }
		  var keyword= document.cmsdyn.keyword.value;
		 if (keyword== "" )
		 { 
			 alert ("Please enter the Meta Keyword");
			 document.cmsdyn.keyword.focus();
			 return false;
		 }
		  var description= document.cmsdyn.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Meta Description");
			 document.cmsdyn.description.focus();
			 return false;
		 }

} 

//script for cms SUBMENU validation 
function Smenuvalidate()
{	
		 var menuname= document.Smenu.menuname.value;		 
		 if (menuname== "" )
		 {
			 alert ("Please select the Menu Name");
			 document.Smenu.menuname.focus();
			 return false;
		 }
		 var Smenu= document.Smenu.Smenu.value;
		 if (Smenu== "" )
		 { 
			 alert ("Please enter the SubMenu Name");
			 document.Smenu.Smenu.focus();
			 return false;
		 }
		 var Title= document.Smenu.Title.value;
		 if (Title== "" )
		 { 
			 alert ("Please enter the Title");
			 document.Smenu.Title.focus();
			 return false;
		 }
		  var metatitle= document.Smenu.metatitle.value;
		 if (metatitle== "" )
		 { 
			 alert ("Please enter the Meta Title");
			 document.Smenu.metatitle.focus();
			 return false;
		 }
		  var keyword= document.Smenu.keyword.value;
		 if (keyword== "" )
		 { 
			 alert ("Please enter the Meta Keyword");
			 document.Smenu.keyword.focus();
			 return false;
		 }
		  var description= document.Smenu.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Meta Description");
			 document.Smenu.description.focus();
			 return false;
		 }		

}
//End Submenu script

//script for login validation 
function login_validation()
{
		 if (document.Login.txtUsername.value== "" )
		 { 
			 alert ("Please enter the Username");
			 document.Login.txtUsername.focus();
			 return false;
		 }

		 if (document.Login.txtPassword.value== "" )
		 { 
			 alert ("Please enter the Password");
			 document.Login.txtPassword.focus();
			 return false;
		 }
}

//script for settnigs validation
function account_validate()
{
         var  txtCompany= document.frm_accountinfo.txtCompany.value;
		 if ( txtCompany== "" )
		 { 
			 alert ("Please enter Name of the Company");
			 document.frm_accountinfo.txtCompany.focus();
			 return false;
		 }
		 var txtContact= document.frm_accountinfo.txtContact.value;
		 if (txtContact == "" )
		 { 
			 alert ("Please enter Contact Person");
			 document.frm_accountinfo.txtContact.focus();
			 return false;
		 }
		 var txtEmail= document.frm_accountinfo.txtEmail.value;
		 if (txtEmail== "" )
		 { 
			 alert ("Please enter the Email Address");
			 document.frm_accountinfo.txtEmail.focus();
			 return false;
		 }
		 if (!validateEmail(document.frm_accountinfo.txtEmail.value,1,1)) 
		 {
		 document.frm_accountinfo.txtEmail.focus();
		 return false;
		 }
		  var  txtWebsite= document.frm_accountinfo.txtWebsite.value;
		 if ( txtWebsite== "" )
		 { 
			 alert ("Please enter Name of the Website");
			 document.frm_accountinfo.txtWebsite.focus();
			 return false;
		 }
		 var intRows= document.frm_accountinfo.intRows.value;
		 if (intRows== "" )
		 { 
			 alert ("Please enter No of Rows Displayed per page");
			 document.frm_accountinfo.intRows.focus();
			 return false;
		 }
		 if (isNaN(document.frm_accountinfo.intRows.value))
		 { 
			 alert ("No of Rows must be Numeric");
			 document.frm_accountinfo.intRows.focus();
			 return false;
		 }
		 var txtadminpage= document.frm_accountinfo.txtadminpage.value;
		 if (txtadminpage== "" )
		 { 
			 alert ("Please enter Admin Page Title");
			 document.frm_accountinfo.txtadminpage.focus();
			 return false;
		 }
		 var txthomepage= document.frm_accountinfo.txthomepage.value;
		 if (txthomepage== "" )
		 { 
			 alert ("Please enter Home Page Title");
			 document.frm_accountinfo.txthomepage.focus();
			 return false;
		 }
		 var Datedisp= document.frm_accountinfo.Datedisp.value;
		 if (Datedisp== "select" )
		 { 
			 alert ("Please enter Date format");
			 document.frm_accountinfo.Datedisp.focus();
			 return false;
		 }
}
//Ticket Status
function find_status()
{
	 var Ticketno = document.frm_status.ticketno.value;
	 if (Ticketno == "" )
	 { 
	 alert ("Please enter the Ticket No");
	 document.frm_status.ticketno.focus();
	 return false;
	 } 
}
// FORUM VALIDATION ADDFORM and EDIT FORM

function forumvalidate()
{
		 var category= document.forum.category.value;
		 if (category== "" )
		 { 
			 alert ("Please enter the Category Name");
			 document.forum.category.focus();
			 return false;
		 }
		 var description= document.forum.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Description");
			 document.forum.description.focus();
			 return false;
		 }
}
// END FORUM VALIDATION		

// BLOG VALIDATION ADDFORM and EDIT FORM

function blogvalidate()
{
		 var category= document.blog.category.value;
		 if (category== "" )
		 { 
			 alert ("Please enter the Category Name");
			 document.blog.category.focus();
			 return false;
		 }
		/* var description= document.blog.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Description");
			 document.blog.description.focus();
			 return false;
		 }*/
}
// END BLOG VALIDATION		 

// SUB CATEGORY VALIDATION ADDFORM

function subcatvalidate()
{
		 var categorylist= document.subcat.categorylist.value;
		 if (categorylist== "" )
		 { 
			 alert ("Please select the Category Name");
			 document.subcat.categorylist.focus();
			 return false;
		 }
		 var category= document.subcat.category.value;
		 if (category== "" )
		 { 
			 alert ("Please enter the Sub Category Name");
			 document.subcat.category.focus();
			 return false;
		 }
		/* var description= document.subcat.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Sub Category Description");
			 document.subcat.description.focus();
			 return false;
		 }*/
		 var imgupload= document.subcat.ImgUpload.value;
		 if (imgupload== "" )
		 { 
			 alert ("Please upload your Subcategory image");
			 document.subcat.ImgUpload.focus();
			 return false;
		 }
}
// END SUBCATEGORY VALIDATION

// SUB CATEGORY VALIDATION - EDIT FORM
function subcateditvalidate()
{
		 var categorylist= document.subcat_edit.categorylist.value;
		 if (categorylist== "" )
		 { 
			 alert ("Please select the Category Name");
			 document.subcat_edit.categorylist.focus();
			 return false;
		 }
		 var category= document.subcat_edit.category.value;
		 if (category== "" )
		 { 
			 alert ("Please enter the Sub Category Name");
			 document.subcat_edit.category.focus();
			 return false;
		 }
		 /*var description= document.subcat_edit.description.value;
		 if (description== "" )
		 { 
			 alert ("Please enter the Sub Category Description");
			 document.subcat_edit.description.focus();
			 return false;
		 }		 */
}
// END SUBCATEGORY VALIDATION

// To Validate Password Field in changepassword file
function pass_validate()
{
	     var Old = document.frm_change.Old.value;
		 if (Old == "" )
		 { 
			 alert ("Please enter Your Old Password");
			 document.frm_change.Old.focus();
			 return false;
		 }
		 var Password = document.frm_change.Password.value;
		 if (Password == "" )
		 { 
			 alert ("Please enter Your New Password");
			 document.frm_change.Password.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword2.value;
		 if (Conpassword == "" )
		 { 
			 alert ("Please enter Your Confirm Password");
			 document.frm_change.Conpassword2.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword2.value;
		 if (document.frm_change.Conpassword2.value != document.frm_change.Password.value)
		 { 
			 alert ("Paasword and Confirm Password must be same");
			 document.frm_change.Conpassword2.focus();
			 return false;
		 }
}

//SEARCH VALIDATE
function searchvalidate()
{
	
		var fromdate = document.frm_search.fromdate.value;
		 if (fromdate == "" )
		 { 
			 alert ("Please enter the from date value  ");
			 document.frm_search.fromdate.focus();
			 return false;
		 }	
		var date_search = document.frm_search.date_search.value;
		 if (date_search == "" )
		 { 
			 alert ("Please enter the enter date value  ");
			 document.frm_search.date_search.focus();
			 return false;
		 }
	
}

function calldel(m)
{
  if(!confirm(m))
  {
    return false;
  }
  else
  return true;
}
//script for add member
function member_reg(type)
{	
	 var firstname = document.CustomersForm.firstname.value;
	 if (firstname == "" )
	 { 
	 alert ("Please enter the First Name");
	 document.CustomersForm.firstname.focus();
	 return false;
	 }
	 var lastname = document.CustomersForm.lastname.value; 
	 if (lastname == "")
	 { 
	 alert ("Please enter the Last Name");
	 document.CustomersForm.lastname.focus();
	 return false;
	 }
	 var emailid = document.CustomersForm.emailid.value;
	 if (emailid == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.CustomersForm.emailid.focus();
	 return false;
	 }	
	 if (!validateEmail(document.CustomersForm.emailid.value,1,1)) 
	 {
	 document.CustomersForm.emailid.focus();
	 return false;
	 }
	 var address1 = document.CustomersForm.address.value;
	 if (address1 == "" )
	 { 
	 alert ("Please enter the Address");
	 document.CustomersForm.address.focus();
	 return false;
	 }
	  var city = document.CustomersForm.city.value;
	 if (city == "" )
	 { 
	 alert ("Please enter the City Name");
	 document.CustomersForm.city.focus();
	 return false;
	 }
	 var state = document.CustomersForm.state.value;
	 if (state == "")
	 { 
	 alert ("Please enter the State Name");
	 document.CustomersForm.state.focus();
	 return false;
	 }
	 	 var zipcode = document.CustomersForm.zipcode.value;
	 if (zipcode == "" )
	 { 
	 alert ("Please enter the Post Code");
	 document.CustomersForm.zipcode.focus();
	 return false;
	 }	
	 if (isNaN(document.CustomersForm.zipcode.value))
	 { 
	 alert ("Post Code must be numeric");
	 document.CustomersForm.zipcode.focus();
	 return false;
	 }	
	 var country=document.CustomersForm.country.value;
	 if (country == "")
	 { 
	 alert ("Plese select Country");
	 document.CustomersForm.country.focus();
	 return false;
	 }
	 var phoneno = document.CustomersForm.phoneno.value;
	 if (phoneno == "")
	 { 
	 alert ("Please enter the Phone Number");
	 document.CustomersForm.phoneno.focus();
	 return false;
	 }	
	 if (isNaN(document.CustomersForm.phoneno.value))
	 { 
	 alert ("Phone Number must be numeric");
	 document.CustomersForm.phoneno.focus();
	 return false;
	 }	
	 
	 if(type != "edit")
	 {
		 var  Username= document.CustomersForm.username.value;
		 if (Username == "")
		 { 
		 alert ("Please enter the User Name");
		 document.CustomersForm.username.focus();
		 return false;
		 }	
		 var  password= document.CustomersForm.password.value;
		 if (password == "")
		 { 
		 alert ("Please enter the password");
		 document.CustomersForm.password.focus();
		 return false;
		 }	
		 var  confirmpass= document.CustomersForm.confirmpass.value;
		 if (confirmpass == "")
		 { 
		 alert ("Please enter the Confirm Password");
		 document.CustomersForm.confirmpass.focus();
		 return false;
		 }	
		 if (password != confirmpass)
		 { 
		 alert ("Password and Confirm Password must be the same");
		 document.CustomersForm.confirmpass.focus();
		 return false;
		 }	
	 }

}

// Valid Email  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;
}
 //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);
}


//script for forgot password
//script for login validation 
function forgot_validation()
{
		 if (document.forgot_frm.txtUsername.value== "" )
		 { 
			 alert ("Please enter the Email Address");
			 document.forgot_frm.txtUsername.focus();
			 return false;
		 }
		if (!validateEmail(document.forgot_frm.txtUsername.value,1,1)) 
		{
		document.forgot_frm.txtUsername.focus();
		return false;
		}
}
//script for add more images in image field
function insertMoreImageUpload() 
{ 
	var nUploads = parseInt(document.getElementById('NumberOfImgUploads').value)+1;		 
	var tbody = document.getElementById("tabImgUpload").getElementsByTagName("tbody")[1]; 
	var row = document.createElement("TR"); 
	var cell1 = document.createElement("TD");
	cell1.setAttribute("valign","top");
	cell1.setAttribute("align","right");
	cell1.setAttribute("width","37%");
	row.className="bluesmall";
	//cell1.setAttribute("style", "font-family:Verdana, Arial, Helvetica, sans-serif; font-size:8px; font-weight:normal; color:#006589;");	
	cell1.innerHTML = "Property Image &nbsp;"+nUploads;

	//insert second <td>
		var cell3 = document.createElement("TD");
	cell3.setAttribute("valign","top");
	cell3.setAttribute("align","right");
	cell3.setAttribute("width","2%");
		//insert third <td>
	var cell2 = document.createElement("TD");
	cell2.setAttribute("align","left");
	//File
	var eInput = document.createElement("INPUT"); 
	eInput.setAttribute("type","file");
	eInput.setAttribute("name","txtImage" + nUploads);
	eInput.setAttribute("id","txtImage" + nUploads);
	eInput.setAttribute("style", "border:1px solid #666666; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; font-weight:normal; color:#000000;");	
	cell2.appendChild(eInput);
	// append all <td> to <tr>
		row.appendChild(cell1); 
		row.appendChild(cell3); 
		row.appendChild(cell2); 
	tbody.appendChild(row);
	document.frm_listing.NumberOfImgUploads.value = nUploads;
	return false;
}


// this Script is Used for Checkall Checkbox
var checkflag = "false";
function check(field,value) 
{
	var checkflag = value;
	len = field.length;
	if (checkflag == "on") 
	{
		if(len==null)
		{
			field.checked=true;
		}
		else
		{
			for (i = 0; i < len; i++) 
			{
				var chkname	=	field[i].name;
					field[i].checked = true;
			}
		}
		checkflag = "off";
		return "off"; 
	}
	else 
	{
		if(len==null)
		{
			field.checked=false;
		}
		else
		{
			for (i = 0; i < len; i++) 
			{
				var chkname	=	field[i].name;
				field[i].checked = false; 
			}
		}
		checkflag = "on";
		return "on"; 
	}
}//  End -->


// Function to check checkbox
function check_checkbox(field)
{
	$Flag	=	"false";
	len = field.length;
	var Counter = 0;
	if(document.form1.chkCall.checked == true)
		$Flag	=	"true";
	var callers = "skype:";
	for (i = 0; i < len; i++) 
	{
		var chkname	=	field[i].name;
		if(field[i].checked == true)
		{
			callers	+=	field[i].value+";";
			$Flag	=	"true";
			Counter = Counter +1;
		}
	}
	if($Flag == "false")
	{
		alert("Select atleast Anyone Contact");
		return false;
	}
	else
	{
		if(Counter > 4)
		{
			alert("Select maximum 4 Contacts only");
			return false;
		}
		else
		{
			callers = callers.substr(0,callers.length-1);
			//alert(callers.length);
			callers	=	callers+"?call";
			//alert(callers);
			window.location=callers;
			return false;
		}
	}
}

function popuplinks(url)
{
	newwindow=window.open(url,'newwindow','height=200,width=400,left=0,top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

function confirmMsg(msg){
	if(!confirm(msg)){
		return false;

	} else {
		return true;

	}
}
/*//Script validation for displaying the submenu-category
	var lists=new Array();
	
	function changeList( box ) 
	{
		element = box.options[box.selectedIndex].value
		list = lists[element];
		if(box.options[box.selectedIndex].value != "")
		{
			emptyList( box.form.subCategory );
			
			fillList( box.form.subCategory, list );
		}
	}
	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 insertMoreUpload() 
{ 
	var nUploads = parseInt(document.getElementById('NumberOfUploads').value)+1;		 
	var tbody = document.getElementById("tabUpload").getElementsByTagName("tbody")[1]; 
	var row = document.createElement("TR"); 
	var cell1 = document.createElement("TD");
	
	cell1.setAttribute("valign","top");
	cell1.setAttribute("align","right");
	cell1.setAttribute("class","bluesmall");
	//cell1.setAttribute("width","21%");
	cell1.setAttribute("style","FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");
	cell1.innerHTML = "Field&nbsp;"+nUploads;

	//For Blank TD
	var cellB1 = document.createElement("TD");
	cellB1.setAttribute("valign","top");
	cellB1.setAttribute("align","center");
	//cellB1.setAttribute("width","21%");
	cellB1.setAttribute("style","FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");
	cellB1.innerHTML = "&nbsp;";

	//insert second <td>
	var cell2 = document.createElement("TD");
	//cell2.setAttribute("colspan","2");
	cell2.setAttribute("valign","top");
	//File
	var eInput = document.createElement("INPUT"); 
	eInput.setAttribute("type","text");
	eInput.setAttribute("name","mField" + nUploads);
	eInput.setAttribute("id","mField" + nUploads);
	eInput.setAttribute("style", "FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");	
	cell2.appendChild(eInput);
	
	//For Blank TD
	var cellB2 = document.createElement("TD");
	cellB2.setAttribute("valign","top");
	cellB2.setAttribute("align","left");
	//cellB2.setAttribute("width","21%");
	cellB2.setAttribute("style","FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");
	cellB2.innerHTML = "Value&nbsp;"+nUploads;
	
	// append all <td> to <tr>
	//insert second <td>
	var cell3 = document.createElement("TD");
	//cell2.setAttribute("colspan","2");
	cell3.setAttribute("valign","top");
	//File
	var eInput = document.createElement("INPUT"); 
	eInput.setAttribute("type","text");
	eInput.setAttribute("name","mValue" + nUploads);
	eInput.setAttribute("id","mValue" + nUploads);
	eInput.setAttribute("style", "FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");	
	cell3.appendChild(eInput);
	// append all <td> to <tr>

	row.appendChild(cell1); 
	row.appendChild(cellB1); 
	row.appendChild(cell2); 
	row.appendChild(cellB2); 
	row.appendChild(cell3); 
	tbody.appendChild(row);
	document.ListForm.NumberOfUploads.value = nUploads;
	return false;
}

