var xmlHttp;

function validate(obj)
{
	var password=obj.cpass.value;
	var newpassword=obj.newpass.value;
	var confirmpassword=obj.confirmpass.value;

	if(password.length==0)
	{
		alert("Enter the Password");
		obj.cpass.focus();
		return false;
	}
	else if(newpassword.length==0) 
	{
		alert("Enter the New Password");
		obj.newpass.focus();
		return false;
	}
	else if(confirmpassword.length==0) 
	{
		alert("Enter the Confirm Password");
		obj.confirmpass.focus();
		return false;
	}
	else if(obj.newpass.value!=obj.confirmpass.value)
	{
		  alert ("Password Not Match");
		  obj.newpass.focus();
		  return false;
	}
}
function checkUncheckAll(theElement) 
{
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++)
	 {
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
		{
			theForm[z].checked = theElement.checked;
		}	 
     }
 }
 function delmail(obj)
{
		
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		if(occ == 0)
		{
			alert('Please select any one record to delete');
		}	
		else
		{	
			
			var ans=confirm('Are you sure?');
			if(ans == true)
			{
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='del';
			//obj.form.txtsearch.value=obj.form.txtsearch.value;
			//document.frmsearchrec.cmd.value='searchwords';
			document.frmsearchrec.submit();
			}
			else{
			return false;
			}
		}
	
}
function editmember(theElement)
{
	var language=new Array();
	var occ=0;
	var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++)
	 {
		if(theForm[z].type == 'checkbox')
		{
			if(theForm[z].checked)
			{
				var val=theForm[z].name
				language = val.split('chk');
				document.frmmembership.txtrecID.value=language[1];
				occ=occ+1;
			}
			
		}
	}
	if(occ == 1)
	{
		document.frmmembership.txtMode.value='edit';
		document.frmmembership.submit();
	}
	else
	{
		alert('Please select any one record to edit');
	}
}

function editmagazine(theElement)
{
	var language=new Array();
	var occ=0;
	var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++)
	 {
		if(theForm[z].type == 'checkbox')
		{
			if(theForm[z].checked)
			{
				var val=theForm[z].name
				language = val.split('chk');
				document.frmmagazine.txtrecID.value=language[1];
				occ=occ+1;
			}
			
		}
	}
	if(occ == 1)
	{
		document.frmmagazine.txtMode.value='edit';
		document.frmmagazine.submit();
	}
	else
	{
		alert('Please select any one record to edit');
	}
}
function delmember(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		if(occ == 0)
		{
			alert('Please select any one record to delete');
		}	
		else
		{	
			var ans=confirm('Are you sure?');
			if(ans == true)
			{
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='del';
			//document.frmmembership.action='membership_type.php';
			document.frmmembership.submit();
			}
			else{
			return false;
			}
		}
	
}
 function editpagecontent(obj)
{
		var category=new Array();
		var occ=0;
		var flag=0;
	    var theForm = obj.form, z = 0;
		var magazine=document.frmmembership.title.value;
		if(magazine.length==0){
			alert("Please enter title");
			document.frmmembership.title.focus;
			return false;
		}
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		//if(occ == 0)
//		{
//			alert('Please select membership level to visible for member');
//			flag=1;
//			return false;
//		}	
//		else
//		{				
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='update';
//			//document.frmmembership.action='membership_type.php';
//						
//		}
//		if((document.frmmembership.pagetype.value==0)&&(flag==0)) {
//			alert("Please select page type");
//			return false;
//		}
		document.frmmembership.submit();
	
}
 function menucontent(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		var menu=document.frmmembership.txtmenu.value;
		if(menu.length==0){
			alert("Please enter menu item name");
			return false;
		}
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
	//	if(occ == 0)
//		{
//			alert('Please select membership level to visible for member');
//		}	
//		else
//		{				
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='update';
			//document.frmmembership.action='membership_type.php';
			document.frmmembership.submit();			
		//}
	
}
 function updatemagazine(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		var magazine=document.frmaddedit_magazine.txtmagazine.value;
		if(magazine.length==0){
			alert("Please enter magazine title");
			document.frmaddedit_magazine.txtmagazine.focus;
			return false;
		}
		var isbn=document.frmaddedit_magazine.isbn.value;
		if(isbn.length==0){
			alert("Please enter magazine ISBN");
			document.frmaddedit_magazine.isbn.focus;
			return false;
		}
		
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
	//	if(occ == 0)
//		{
//			alert('Please select membership level to visible for member');
//		}	
//		else
//		{				
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='update';
			//document.frmmembership.action='membership_type.php';
			document.frmaddedit_magazine.submit();			
		//}
	
}


function addmagazine(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		var magazine=document.frmaddedit_magazine.txtmagazine.value;
		if(magazine.length==0){
			alert("Please enter magazine title");
			document.frmaddedit_magazine.txtmagazine.focus;
			return false;
		}
		var isbn=document.frmaddedit_magazine.isbn.value;
		if(isbn.length==0){
			alert("Please enter magazine ISBN");
			document.frmaddedit_magazine.isbn.focus;
			return false;
		}
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
					
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='add';
			//document.frmmembership.action='membership_type.php';
			document.frmaddedit_magazine.submit();			
		//}
	
}

function addmenucontent(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		var magazine=document.frmmembership.txtmenu.value;
		if(magazine.length==0){
			alert("Please enter menu name");
			document.frmmembership.txtmenu.focus;
			return false;
		}
		
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
					
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='add';
			//document.frmmembership.action='membership_type.php';
			document.frmmembership.submit();			
		//}
	
}
 function addpagecontent(obj)
{
		var category=new Array();
		var occ=0;
		var flag=0;
	    var theForm = obj.form, z = 0;
		var magazine=document.frmmembership.title.value;
		if(magazine.length==0){
			alert("Please enter title");
			document.frmmembership.title.focus;
			return false;
		}
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		//if(occ == 0)
//		{
//			alert('Please select membership level to visible for member');
//			flag=1;
//			return false;
//
//		}	
//		else
//		{				
            len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
            obj.form.txtMode.value='add';
//			//document.frmmembership.action='membership_type.php';						
//		}
//		if((document.frmmembership.pagetype.value==0)&&(flag==0)) {
//			alert("Please select page type");
//			return false;
//		}
		document.frmmembership.submit();
	
}
 function delmembership(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		if(occ == 0)
		{
			alert('Please select any one record to delete');
		}	
		else
		{	
			var ans=confirm('Are you sure?');
			if(ans == true)
			{
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='del';
			document.frmmembership.action='manage_content.php';
			document.frmmembership.submit();
			}
			else{
			return false;
			}
		}
	
}

function delmagazine(obj)
{
		var category=new Array();
		var occ=0;
	    var theForm = obj.form, z = 0;
		for(z=0; z<theForm.length;z++)
		{
			if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
			{
				if(theForm[z].checked)
				{
					var val=theForm[z].name;
					category[occ] = val;
					occ=occ+1;
				}
			}
		}
		if(occ == 0)
		{
			alert('Please select any one record to delete');
		}	
		else
		{	
			var ans=confirm('Are you sure?');
			if(ans == true)
			{
			len = category.length;
			vals = category.join(',');
			theForm.txtrecID.value=vals;
			obj.form.txtMode.value='del';
			document.frmmagazine.action='magazine_list.php';
			document.frmmagazine.submit();
			}
			else{
			return false;
			}
		}
	
}

function contactform(){
	var the = document.frmmembership;
	var result = true;
	var focusElement = 0;
	var flagPassword = 0;
	var flagMail = 0;
if((the.firstname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.firstname;}	//the.fname.select();
		document.getElementById("fNameD").innerHTML = "* Please enter your first name";
		result = false;		
	}else{document.getElementById("fNameD").innerHTML = "*";}

	if((the.lastname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.lastname;}
		document.getElementById("lNameD").innerHTML = "* Please enter your last name";
		result = false;		
	}else{document.getElementById("lNameD").innerHTML = "*";}
if((the.email.value.length) == 0){
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Please enter Email address";
		result = false; 
		flagMail=1;
	}else{document.getElementById("eMailD").innerHTML = "*";}
	if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.email.value)))){	
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Invalid Email address !!";
		result = false;
	}
	return result;
}
function member_validation(content)
{
	
	
	var the = document.frmmembership;
	var result = true;
	var focusElement = 0;
	var flagPassword = 0;
	var flagMail = 0;
	
if((the.firstname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.firstname;}	//the.fname.select();
		document.getElementById("fNameD").innerHTML = "* Please enter your first name";
		result = false;		
	}else{document.getElementById("fNameD").innerHTML = "*";}	
if((the.companyname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.companyname;}	//the.fname.select();
		document.getElementById("compNameD").innerHTML = "* Please enter your company name";
		result = false;		
	}else{document.getElementById("compNameD").innerHTML = "*";}	
if((the.YR_STARTED_S.value.length) == 0){
		if(focusElement == 0) {focusElement = the.YR_STARTED_S;}	//the.fname.select();
		document.getElementById("profREOD").innerHTML = "* Please enter year";
		result = false;		
	}else{document.getElementById("profREOD").innerHTML = "*";}	

if((the.con_email1.value.length) == 0){
		if(focusElement == 0) {focusElement = the.con_email1;}
		document.getElementById("con_email1D").innerHTML = "* Please enter Email address";
		result = false; 
		flagMail=1;
	}else{document.getElementById("con_email1D").innerHTML = "*";}
if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.con_email1.value)))&&(flagMail==0)){	
		if(focusElement == 0) {focusElement = the.con_email1;}
		document.getElementById("con_email1D").innerHTML = "* Invalid Email address !!";
		result = false;
	}
if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.con_email2.value)))&&(the.con_email2.value.length!=0)){	
		if(focusElement == 0) {focusElement = the.con_email2;}
		document.getElementById("con_email2D").innerHTML = "* Invalid Email address !!";
		result = false;
	}else{document.getElementById("con_email2D").innerHTML = " ";}
if(content!=1){
   if((the.bill_addr1.value.length) == 0){
		if(focusElement == 0) {focusElement = the.bill_addr1;}
		document.getElementById("billAddr1D").innerHTML = "* Please enter billing address";
		result = false;	
	}else{document.getElementById("billAddr1D").innerHTML = "*";}
	
	if((the.bill_city.value.length == 0)||(the.bill_state.value.length == 0)||(the.bill_zip.value.length == 0)){
		if(focusElement == 0) {focusElement = the.bill_city;}	
		document.getElementById("bill_cityD").innerHTML = "* Please enter city/state/zip";
		result = false;		
	}else{document.getElementById("bill_cityD").innerHTML = "*";}

	if((the.bill_creditcard.value.length) == 0){
		if(focusElement == 0) {focusElement = the.bill_creditcard;}
		document.getElementById("creditCardD").innerHTML = "* Please enter credit card number";
		result = false;	
	}else{document.getElementById("creditCardD").innerHTML = "*";}
	if((the.bill_cvs.value.length) == 0){
		if(focusElement == 0) {focusElement = the.bill_cvs;}
		document.getElementById("cvsD").innerHTML = "* Please enter CSV code";
		result = false;	
	}else{document.getElementById("cvsD").innerHTML = "*";}
	if((the.exp_date.value.length) == 0){
		if(focusElement == 0) {focusElement = the.exp_date;}
		document.getElementById("expdateD").innerHTML = "* Please enter expire date";
		result = false;	
	}else{document.getElementById("expdateD").innerHTML = "*";}
}
//if check box is selected
if(!the.cmdPhysAddrMatch.checked){
if((the.phy_addr1.value.length) == 0){
		if(focusElement == 0) {focusElement = the.phy_addr1;}
		document.getElementById("phyAddr1D").innerHTML = "* Please enter physical address";
		result = false;	
	}else{document.getElementById("phyAddr1D").innerHTML = "*";}
	
	if((the.phy_city.value.length == 0)||(the.phy_state.value.length == 0)||(the.phy_zip.value.length == 0)){
		if(focusElement == 0) {focusElement = the.phy_city;}	
		document.getElementById("phycityD").innerHTML = "* Please enter city/state/zip";
		result = false;		
	}else{document.getElementById("phycityD").innerHTML = "*";}
}	//end of checkbox 
	if((the.off_phone.value.length == 0)){
		if(focusElement == 0) {focusElement = the.off_phone;}	
		document.getElementById("off_phoneD").innerHTML = "* Please enter phone number";
		result = false;		
	}else{document.getElementById("off_phoneD").innerHTML = "*";}
	
	if((the.lic_number.value.length == 0)){
		if(focusElement == 0) {focusElement = the.lic_number;}	
		document.getElementById("real_licD").innerHTML = "* Please enter license number";
		result = false;		
	}else{document.getElementById("real_licD").innerHTML = "*";}

	if((the.username.value.length == 0)){
		if(focusElement == 0) {focusElement = the.username;}	
		document.getElementById("usernameD").innerHTML = "* Please enter username";
		result = false;		
	}else{document.getElementById("usernameD").innerHTML = "*";}

	if((the.password.value.length == 0)){
		if(focusElement == 0) {focusElement = the.password;}	
		document.getElementById("passwordD").innerHTML = "* Please enter password";
		result = false;		
	}else{document.getElementById("passwordD").innerHTML = "*";}
	return result;
}
function edit_registration(content)
{	
	var the = document.frmmembership;
	var result = true;
	var focusElement = 0;
	var flagPassword = 0;
	var flagMail = 0;
	
if((the.firstname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.firstname;}	//the.fname.select();
		document.getElementById("fNameD").innerHTML = "* Please enter your first name";
		result = false;		
	}else{document.getElementById("fNameD").innerHTML = "*";}	
if((the.companyname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.companyname;}	//the.fname.select();
		document.getElementById("compNameD").innerHTML = "* Please enter your company name";
		result = false;		
	}else{document.getElementById("compNameD").innerHTML = "*";}	
if((the.YR_STARTED_S.value.length) == 0){
		if(focusElement == 0) {focusElement = the.YR_STARTED_S;}	//the.fname.select();
		document.getElementById("profREOD").innerHTML = "* Please enter year";
		result = false;		
	}else{document.getElementById("profREOD").innerHTML = "*";}	

if((the.con_email1.value.length) == 0){
		if(focusElement == 0) {focusElement = the.con_email1;}
		document.getElementById("con_email1D").innerHTML = "* Please enter Email address";
		result = false; 
		flagMail=1;
	}else{document.getElementById("con_email1D").innerHTML = "*";}
if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.con_email1.value)))&&(flagMail==0)){	
		if(focusElement == 0) {focusElement = the.con_email1;}
		document.getElementById("con_email1D").innerHTML = "* Invalid Email address !!";
		result = false;
	}
if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.con_email2.value)))&&(the.con_email2.value.length!=0)){	
		if(focusElement == 0) {focusElement = the.con_email2;}
		document.getElementById("con_email2D").innerHTML = "* Invalid Email address !!";
		result = false;
	}else{document.getElementById("con_email2D").innerHTML = " ";}
if((the.phy_addr1.value.length) == 0){
		if(focusElement == 0) {focusElement = the.phy_addr1;}
		document.getElementById("phyAddr1D").innerHTML = "* Please enter physical address";
		result = false;	
	}else{document.getElementById("phyAddr1D").innerHTML = "*";}
	
	if((the.phy_city.value.length == 0)||(the.phy_state.value.length == 0)||(the.phy_zip.value.length == 0)){
		if(focusElement == 0) {focusElement = the.phy_city;}	
		document.getElementById("phycityD").innerHTML = "* Please enter city/state/zip";
		result = false;		
	}else{document.getElementById("phycityD").innerHTML = "*";}

	if((the.off_phone.value.length == 0)){
		if(focusElement == 0) {focusElement = the.off_phone;}	
		document.getElementById("off_phoneD").innerHTML = "* Please enter phone number";
		result = false;		
	}else{document.getElementById("off_phoneD").innerHTML = "*";}
	
	if((the.lic_number.value.length == 0)){
		if(focusElement == 0) {focusElement = the.lic_number;}	
		document.getElementById("real_licD").innerHTML = "* Please enter license number";
		result = false;		
	}else{document.getElementById("real_licD").innerHTML = "*";}
	
	return result;
}
function email_check()
{
	var the = document.frmforgetPassword;
	var result = true;
	var focusElement = 0;
	var flagPassword = 0;
	var flagMail = 0;
	if((the.email.value.length) == 0){
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Please enter Email address";
		result = false; 
		flagMail=1;
	}
	else if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.email.value)))){	
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Invalid Email address !!";
		result = false;
	}
	return result;
}
function contactus_check()
{
	var the = document.frmforgetPassword;
	var result = true;
	var focusElement = 0;
	var flagPassword = 0;
	var flagMail = 0;
	if((the.firstname.value.length) == 0){
		if(focusElement == 0) {focusElement = the.firstname;}	//the.fname.select();
		document.getElementById("fNameD").innerHTML = "* Please enter your name";
		result = false;		
	}else{document.getElementById("fNameD").innerHTML = "*";}	
	
	if((the.email.value.length) == 0){
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Please enter Email address";
		result = false; 
		flagMail=1;
	}
	else if( (!(/^[^@ ]+@[^@ ]+\.[^@\.]+$/.test(the.email.value)))){	
		if(focusElement == 0) {focusElement = the.email;}
		document.getElementById("eMailD").innerHTML = "* Invalid Email address !!";
		result = false;
	}
	
	return result;
}


function showRecords(pageno,char,keyword)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="get_magazine.php";

url=url+"?pageno="+pageno;
url=url+"&char="+char;

if(keyword=='true')
{
	
 url=url+"&keyword="+keyword;	 
}
//url=url+"&sid="+Math.random();
//alert("showrecords"+pageno);

xmlHttp.onreadystatechange=pageChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
delete xmlHttp;
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function validate_contact()
{
	var user_type=document.forms.contact_us.CustomerType;	
	var EnquiryTopic=document.getElementById('EnquiryTopic');
	var OtherComment=document.getElementById('OtherComment');
	var CustomerComments=document.getElementById('CustomerComments');
	var Name=document.getElementById('Name');
	var Email=document.getElementById('Email');

	
	 var sel=0;

	      for(i=0;i<user_type.length;i++)
		{
		  
		  if(user_type[i].checked==true)
			sel=sel+1;
		}
		
	      if(sel==0)
		{
		 alert('Please select one.');
		 document.getElementById('CustomerType').focus();
		 return false;	
		}
	
	

	if(EnquiryTopic.value=='Other' && trim(OtherComment.value)=='')
	{
		 alert('Please other type of enquiry.');
		 OtherComment.focus();
		 return false;	
	}

	if(trim(CustomerComments.value)=='')
	{
		 alert('Please enter your comments.');
		 CustomerComments.focus();
		 return false;	
	}

	if(trim(Name.value)=='')
	{
		 alert('Please enter your name.');
		 Name.focus();
		 return false;	
	}
	if(trim(Email.value)=='')
	{
		 alert('Please enter your email.');
		 Email.focus();
		 return false;	
	}

	if(validateEmail(Email.value) ==false)
	{
		 alert('Please enter valid email.');
		 Email.focus();
		 return false;	
	}
return true;
	
}

function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '');
}

function validateEmail(email)
{
 if(email.search(/^[^@ ]+@[^@ ]+\.[^@\.]+$/) == -1){
 return false;

 }
 else if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z]+)*\.[A-Za-z]+$/) == -1)
 return false;
 else if (email.search(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) == -1)
 return false;
 else if (email.search(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/) == -1)
 return false;
 else if (email.search(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/) == -1)
 return false;
 else if (email.search(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/) == -1)
 return false;
 else if (email.search(/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/) == -1)
 return false;
 else
 return true;

}
//================================= Configuration Page =================
/*function configurationOption(obj){
	alert ('as');
	var MemRegistration=frmRegistration.memregistration.value;
	var MemPage=frmRegistration.memberpage.value;
	alert ('val 1' +MemRegistration);
	alert ('val 2' +MemPage);
}*/
//--------------------------