function validatePageContent(frm)
{
	if(frm.page_name.value == "")
	{
		alert("Please Enter Page Name");
		frm.page_name.focus();
		return false;
	}
}
function forget_pwd()
{
var regBlank = /[^\s]/;
if(!regBlank.test(document.frm.email.value))
	{
	alert("Please insert  email");
	document.frm.email.focus();
	return false;
	}
	if(the_mail(document.frm.email.value))
	{
	document.frm.email.focus();
	return false;
	}
else 
return true;

}
function the_mail(control_value)
{
		var emailStr = control_value;
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			alert("Email address seems incorrect ");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null)
		{
			alert("The Email address doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!");
					//eval("document."+form_name+"."+control_name).focus();
					return true;
				}
			}
				 
		}
		var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
			alert("The address must end in a three-letter domain, or two letter country.");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		if (len<2) 
		{
			alert("This address is missing a hostname!");
			//eval("document."+form_name+"."+control_name).focus();
			return true;
		}
		return false;
	
}
/*function validateSetting(frm)
{
	if(frm.site_name.value=="")
	{
		alert("Please Enter Site Name");
		frm.site_name.focus();
		return false;
	}
	if(frm.adminmail.value=="")
	{
		alert("Please Enter Admin Email");
		frm.adminmail.focus();
		return false;
	}
	if(frm.mail_sign.value=="")
	{
		alert("Please Enter Email Signature");
		frm.mail_sign.focus();
		return false;
	}
	if(frm.copyright.value=="")
	{
		alert("Please EnterCopy Right");
		frm.copyright.focus();
		return false;
	}
}*/
function submitonce(theform)
{
		
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById)
	{
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++)
		{
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			//disable em
			tempobj.disabled=true
		}// end for
	}// end if

}

function validate_form_user_registration()
{ 
	var regBlank = /[^\s]/;
	var remail=/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
	if(!remail.test(document.user_info_registration.txtEmail.value))
	{
		alert("Please enter your correct Email address.");
		document.user_info_registration.txtEmail.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtPassword.value))
	{
		alert("Please Enter Password");
		document.user_info_registration.txtPassword.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.rePassword.value))
	{
		alert("Please Re Type Your Password");
		document.user_info_registration.rePassword.focus();
		return false;
	}
	if(document.user_info_registration.txtPassword.value != document.user_info_registration.rePassword.value)
	{
		alert("Password And Retyped Password Is Not Matching");
		document.user_info_registration.rePassword.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.textFirstName.value))
	{
		alert("Please Enter First Name");
		document.user_info_registration.textFirstName.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtLastName.value))
	{
		alert("Please Enter Last Name");
		document.user_info_registration.txtLastName.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtAddress1.value))
	{
		alert("Please Enter Address1 ");
		document.user_info_registration.txtAddress1.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtCity.value))
	{
		alert("Please Enter City");
		document.user_info_registration.txtCity.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtState.value))
	{
		alert("Please Enter State");
		document.user_info_registration.txtState.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtCountry.value))
	{
		alert("Please Enter Country");
		document.user_info_registration.txtCountry.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtPostcode.value))
	{
		alert("Please Enter Post Code");
		document.user_info_registration.txtPostcode.focus();
		return false;
	}
	if(isNaN(document.user_info_registration.txtPostcode.value))
	{
		alert("Please Enter Numeric Post Code");
		document.user_info_registration.txtPostcode.focus();
		return false;
	}
	if(!regBlank.test(document.user_info_registration.txtPhone.value))
	{
		alert("Please Enter Home Phone Number");
		document.user_info_registration.txtPhone.focus();
		return false;
	}
	if(isNaN(document.user_info_registration.txtPhone.value) )
	{
		alert("Please Enter numeric phone number");
		document.user_info_registration.txtPhone.focus();
		return false;
	}
}

function validate_login()
{   var regBlank = /[^\s]/;
	
	if(!regBlank.test(document.user_login.uname.value))
	{
		alert("Please Enter User Name");
		document.user_login.uname.focus();
		return false;
	}
	if(!regBlank.test(document.user_login.pass.value))
	{
		alert("Please Enter Password");
		document.user_login.pass.focus();
		return false;
	}
	
}

function validate_form_feild()
{
	var regBlank = /[^\s]/;
	if(!regBlank.test(document.user_info.textFirstName.value))
	{
		alert("Please Enter First Name");
		document.user_info.textFirstName.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtLastName.value))
	{
		alert("Please Enter Last Name");
		document.user_info.txtLastName.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtAddress1.value))
	{
		alert("Please Enter Address1 ");
		document.user_info.txtAddress1.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtPhone.value))
	{
		alert("Please Enter Phone Number");
		document.user_info.txtPhone.focus();
		return false;
	}
	if(isNaN(document.user_info.txtPhone.value))
	{
		alert("Please Enter Numeric Phone Number");
		document.user_info.txtPhone.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtCity.value))
	{
		alert("Please Enter City");
		document.user_info.txtCity.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtCountry.value))
	{
		alert("Please Enter Country");
		document.user_info.txtCountry.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtState.value))
	{
		alert("Please Enter State");
		document.user_info.txtState.focus();
		return false;
	}
	if(!regBlank.test(document.user_info.txtPostcode.value))
	{
		alert("Please Enter Post Code");
		document.user_info.txtPostcode.focus();
		return false;
	}
	if(isNaN(document.user_info.txtPostcode.value))
	{
		alert("Please Enter Numeric Post Code");
		document.user_info.txtPostcode.focus();
		return false;
	}
	
}

function form_validate_change_password()
{ 
	var regBlank = /[^\s]/;
	if(!regBlank.test(document.frm_changpass.old_password.value))
	{
		alert("Please Enter Old Password");
		document.frm_changpass.old_password.focus();
		return false;
	}
	if(!regBlank.test(document.frm_changpass.new_password.value))
	{
		alert("Please Enter New Password");
		document.frm_changpass.new_password.focus();
		return false;
	}
	if(!regBlank.test(document.frm_changpass.con_password.value))
	{
		alert("Please Enter Your Confirm Password");	
		document.frm_changpass.con_password.focus();
		return false;
	}
	if(document.frm_changpass.new_password.value != document.frm_changpass.con_password.value)
	{
		alert("Password not same");	
		document.frm_changpass.con_password.focus();
		return false;
	}
}

function SymError()
{
  return true;
}
//window.onerror = SymError;
// Rev. 19/12/2005
function popupwin(url,w,h) { 
     var winl = (screen.width - w) / 2;
     var wint = (screen.height - h) / 2;
     winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=0'
  	 win=window.open(url,'name', winprops);
	 win.focus();
  }
// Rev. 09/07/2005
function closeMenus(url) {
	Toggle('adminindex',url);
	Toggle('serversettings',url);
	Toggle('contentMang',url);
}
function Toggle(item,url) {
	var obj;
	if ( document.getElementById ) 
   	{
		obj=document.getElementById(item);
	} else {
		obj = document.all[item];
	}
	
	var key;
   	if ( document.getElementById ) 
   	{
		key=document.getElementById("x" + item);
	} else {
		key = document.all['x' +item];
	}	
	
	if (obj != undefined) {
		var visible = ( obj.style.display != 'none');
		if (visible) {
			obj.style.display="none";
			key.innerHTML="<img src='"+url+"plus_new.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
		} else {
			obj.style.display="block";
			key.innerHTML="<img src='"+url+"neg_new.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
		}
		
	}
	
}

function Expand(url) {
	
   if (document.getElementById) {
	    divs=document.getElementsByTagName("DIV");
	} else {		
		divs = document.all['DIV'];
	}
	
   for (i=0;i<divs.length;i++) {
	   
     divs[i].style.display="block";
	 
     key=document.getElementById("x" + divs[i].id);
	 key.innerHTML="<img src='"+url+"neg_new.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
   }
}

function Collapse(url) {
	if (document.getElementById) {
	    divs=document.getElementsByTagName("DIV");
	} else {		
		divs = document.all['DIV'];
	}
   
   for (i=0;i<divs.length;i++) {
     divs[i].style.display="none";
     key=document.getElementById("x" + divs[i].id);
     key.innerHTML="<img src='"+url+"plus_new.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
   }
}

function validatePass()
{
		
	if(document.frm_changpass.pass1.value=="")	{
	alert("Please Enter Your Old Password");	
	document.frm_changpass.pass1.focus();
	return false;
	}
	if(document.frm_changpass.pass2.value=="")	
	{
		alert("Please Enter Your New Password");	
		document.frm_changpass.pass2.focus();
		return false;
	}
	if(document.frm_changpass.pass3.value=="")	{
	alert("Please Enter Your Confirm Password");	
	document.frm_changpass.pass3.focus();
	return false;
	}
	if(document.frm_changpass.pass2.value != document.frm_changpass.pass3.value)	{
	alert("Password not same");	
	document.frm_changpass.pass3.focus();
	return false;
	}
}
