function usedbikeformvalid() 
{   var mil= /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	var frm = document.newsform;
	var error_msg = '';
	feedback=document.getElementById('name');
       if (feedback.value=='')
		{
		error_msg += "Please Enter Name<br> ";
		feedback.focus();
		}
	pon4=document.getElementById('pon');
       if (pon4.value=='')
		{
		error_msg += "Please Enter Phone<br> ";
		pon4.focus();
		}
	email1=document.getElementById('email');
		if (email1.value.search(mil)==-1)
		{
		error_msg += "Please Enter Valid Email Id<br>";
		email1.focus();
		}
		
	    
		/*feedback=document.getElementById('discr');
	    if (feedback.value==0)
		{
		error_msg += "Please Enter Something In Discription<br> ";
		feedback.focus();
		}*/
	xajax_usedbikefeedback(xajax.getFormValues('usedbikeform'),error_msg);
}

function addnewsarticle(theForm)
{
	var mil= /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

 var error_msg = '';
	var flag = false;
	var error_ctl = '';
	ctl=document.getElementById('postby');
	if(ctl.value=='')
	{   
	    
		error_msg += "Please Add Post By\n";
		flag = true;
		error_ctl=ctl;
		
	}
	ctl2=document.getElementById('author');
	if(ctl2.value=='')
	{   
	    
		error_msg += "Please Add Author \n";
		flag = true;
		error_ctl=ctl;
		
	}
	ctl3=document.getElementById('title');
	if(ctl3.value=='')
	{   
	    
		error_msg += "Please Add Title \n";
		flag = true;
		error_ctl=ctl;
		
	}
	email1=document.getElementById('email');
		if (email1.value.search(mil)==-1)
		{
		error_msg += "Please Enter Valid Email Id.";
		flag = true;
		error_ctl=email1;
		}
	
	
		
	if(flag == true)
	{
		alert(error_msg);
		error_ctl.focus();
		return false;
		
	}


  
  return (true);
}



function newsformvalid() 
{   var mil= /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	var frm = document.newsform;
	var error_msg = '';

	email1=document.getElementById('newsemail');
		if (email1.value.search(mil)==-1)
		{
		error_msg += "Please Enter Valid Email Id";
		email1.focus();
		}
		
	xajax_newslattersingup(xajax.getFormValues('newslatterfrom'),error_msg);
}


function clientformvalid() 
{   var mil= /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	var frm = document.newsform;
	var error_msg = '';

	email1=document.getElementById('cemail');
		if (email1.value.search(mil)==-1)
		{
		error_msg += "Please Enter Valid Email Id<br>";
		email1.focus();
		}
	feedback=document.getElementById('cfeedback');
	if (feedback.value=='')
		{
		error_msg += "Please Enter Your Feedback ";
		feedback.focus();
		}
	xajax_clientfeedback(xajax.getFormValues('clientform'),error_msg);
}



function FrontPage_Form1_Validator()
{
	var mil= /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;

 var error_msg = '';
	var flag = false;
	var error_ctl = '';
	ctl=document.getElementById('name');
	if(ctl.value=='')
	{   
	    
		error_msg += "Please Enter Name\n";
		flag = true;
		error_ctl=ctl;
		
	}
	ctl2=document.getElementById('phone');
	if(ctl2.value=='')
	{   
	    
		error_msg += "Please Enter Phone Number\n";
		flag = true;
		error_ctl=ctl2;
		
	}
	email1=document.getElementById('email');
		if (email1.value.search(mil)==-1)
		{
		error_msg += "Please Enter Valid Email Id.";
		flag = true;
		error_ctl=email1;
		}
	
	
		
	if(flag == true)
	{
		alert(error_msg);
		error_ctl.focus();
		return false;
		
	}

xajax_usercontactpage(xajax.getFormValues('FrontPage_Form1'));
  
 /* return (true);*/
}




function IsBlank(argStr)
{
       var s = new String(argStr);
       var cnt=0;
       len = s.length;
       if ((cnt==len)||(cnt==0&&len==0))
       {
               return true;
       }
       return false;
	   }
	   
	  

function performValidation(X)
{

	var error_msg = '';
	var missingInfo = "";
	
	if(IsBlank(X.aplicnt_last.value))
	{
	 missingInfo +="\n Please Enter Applicant Last Name";
	}
	else if(X.aplicnt_last.value.length>35)
	{
	 missingInfo +="\n Applicant Last Name is so long!";
	}
	else if(!isNaN(X.aplicnt_last.value))
	{
		missingInfo +="\n Invalid Applicant Last Name";
	}
	if(IsBlank(X.aplicnt_first.value))
	{
		missingInfo +="\n Please Enter Applicant First Name";
	}
	else if(X.aplicnt_last.value.length>35)
	{
	 missingInfo +="\n Applicant First Name is so long!";
	}
	else if(!isNaN(X.aplicnt_last.value))
	{
		missingInfo +="\n Invalid Applicant First Name";
	}
	if(IsBlank(X.aplicnt_street.value))
	{
		missingInfo +="\n Please Enter Applicant Street";
	}
	if(IsBlank(X.aplicnt_city.value))
	{
		missingInfo +="\n Please Enter Applicant City";
	}
	if(IsBlank(X.aplicnt_zip.value))
	{
		missingInfo +="\n Please Enter Applicant Zip";
	}
	else if(isNaN(X.aplicnt_zip.value))
	{
		missingInfo +="\n Please Enter Valid Applicant Zip Code";
	}
	if(IsBlank(X.aplicnt_tel.value))
	{
		missingInfo +="\n Please Enter Applicant Telephone";
	}
	//else if(isNaN(X.aplicnt_tel.value))
//	{
//		missingInfo +="\n Please Enter Valid Applicant Telephone";
//	}
	
	if(IsBlank(X.aplicnt_email.value))
	{
		missingInfo +="\n Please Enter Applicant Email";
	}
	else if (!(X.aplicnt_email.value.search (/[@]/) >= 0))
	{
	
		missingInfo +="\n Please Enter Valid Applicant Email";
		
		}
	else if (!(X.aplicnt_email.value.search (/[.]/) >= 0))
	{
		
		missingInfo +="\n Please Enter Valid Applicant Email";
		
	}
	
	if(IsBlank(X.aplicnt_age.value))
	{
		missingInfo +="\n Please Enter Applicant Age";
	}
	if(IsBlank(X.aplicnt_grade.value))
	{
		missingInfo +="\n Please Enter Applicant Grade";
	}
	if(IsBlank(X.aplicnt_school.value))
	{
		missingInfo +="\n Please Enter Applicant School";
	}
	if(IsBlank(X.aplicnt_address.value))
	{
		missingInfo +="\n Please Enter Applicant Address";
	}
	if(IsBlank(X.aplicnt_area.value))
	{
		missingInfo +="\n Please Enter Applicant City,State,Zip";
	}
	
	if(IsBlank(X.guard_last.value))
	{
		missingInfo +="\n Please Enter Guardian Last Name";
	}
	else if(X.guard_last.value.length>35)
	{
	 missingInfo +="\n Guradian Last Name is so long!";
	}
	else if(!isNaN(X.guard_last.value))
	{
		missingInfo +="\n Invalid Guardian Last Name";
	}
	if(IsBlank(X.guard_first.value))
	{
		missingInfo +="\n Please Enter Guardian First Name";
	}
	else if(X.guard_first.value.length>35)
	{
	 missingInfo +="\n Guradian First Name is so long!";
	}
	else if(!isNaN(X.guard_first.value))
	{
		missingInfo +="\n Invalid Guardian first Name";
	}
	if(IsBlank(X.guard_street.value))
	{
		missingInfo +="\n Please Enter Guardian Street";
	}
	if(IsBlank(X.guard_city.value))
	{
		missingInfo +="\n Please Enter Guardian City";
	}
	if(IsBlank(X.guard_zip.value))
	{
		missingInfo +="\n Please Enter Guardian Zip";
	}
	else if(isNaN(X.guard_zip.value))
	{
		missingInfo +="\n Please Enter Valid Guardian Zip Code";
	}
	if(IsBlank(X.guard_tel.value))
	{
		missingInfo +="\n Please Enter Guardian Telephone";
	}
	//else if(isNaN(X.guard_tel.value))
//	{
//		missingInfo +="\n Please Enter Valid Guardian Telephone";
//	}
	if(IsBlank(X.guard_rel.value))
	{
		missingInfo +="\n Please Enter Guardian Relationship";
	}
	
	
		
               
	if (missingInfo != "") 
	{
		missingInfo ="_____________________________\n" +
		"Please fill in the following fields :\n" +
		missingInfo + "\n_____________________________" ;
		alert(missingInfo);
		return false;
	}
	
	
	xajax_StudentRegistrationForm(xajax.getFormValues('regfrm'),error_msg);
}

