function validate_login()
{
	frm=document.frmlogin;

	un=frm.username.value;
	ps=frm.password.value;
	

	if (un=="")
	{
		alert("Please enter your Username!");
		frm.username.focus();
		return false;
	}
	if (ps=="")
	{
		alert("Please enter your Password!");
		frm.password.focus();
		return false;
	}
		
		return true;
}

function validate_emailadd()
{
	frm=document.forgetfrm;
	email=frm.email.value;
	if (email=="")
	{
		alert("Please enter your Mail Id!");
		frm.email.focus();
		return false;
	}
	if (!validate_emailaddress(email,true,false))
	{
		alert("Please enter your Mail Id!");
		frm.email.focus();
		return false;
	}
	
			return true;
}

function validate_passwordsettings()
{
	frm = document.frmsettings;

	op = frm.oldpassword.value;
	np = frm.newpassword.value;
	cp = frm.confirmnewpassword.value;

	if (op=="")
	{
		alert("Please enter your Old Password!");
		frm.oldpassword.focus();
		return false;
	}
	if (np=="")
	{
		alert("Please enter New Password!");
		frm.newpassword.focus();
		return false;
	}

	if (cp=="")
	{
		alert("Please retype your New Password!");
		frm.confirmnewpassword.focus();
		return false;
	}
	if (np!=cp)
	{
		alert("Your New Password and Retype Password  does not match!");
		frm.confirmnewpassword.focus();
		return false;
	}

	return true;
}

function validate_emailsettings()
{
	frm = document.frmsettings;

	em = frm.adminemail.value;

	if (!validate_emailaddress(em,true,false))
	{
		alert("Please enter your Valid Email Address!");
		frm.adminemail.focus();
		return false;
	}
	return true;
}

function validate_emailaddress(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 validate_addcategory()
{
	frm=document.frmcategory;

	cn=frm.categoryname.value;
	de=frm.description.value;

	if (Trim(cn)=="")
	{
		alert("Category name cannot be empty!");
		frm.categoryname.focus();
		return false;
	}
	frm.categoryname.value = Trim(cn);
	if (Trim(de)=="")
	{
		alert("Description cannot be empty!");
		frm.description.focus();
		return false;
	}
	frm.description.value = Trim(de);
	return true;
}

function validate_addproject()
{
	frm=document.frmproject;
	
	 cal_price();
	
	pn=frm.projectnumber.value;
	sn=frm.solicitationnumber.value;
	pt=frm.projecttitle.value;
	id=frm.issuedate.value;
	bd=frm.biddate.value;
	rd=frm.reviseddate.value;
	np=frm.noofplans.value;
	ns=frm.noofspecifications.value;
	pvf=frm.projectvaluefrom.value;
	pvt=frm.projectvalueto.value;

	//ap=frm.amendmentplan.value;
	//ps=frm.projectsynopsis.value;

	pfc	= frm.pricefscompleteset.value;
	phc = frm.pricehscompleteset.value;
	pfp = frm.pricefspartials.value;
	php = frm.pricehspartials.value;
	psc = frm.pricespecscompleteset.value;
	psp = frm.pricespecspartials.value;
	rs1 = frm.reserved1.value;
	rs2 = frm.reserved2.value;

	pgm = frm.pricegovtmanual.value;
	ppc = frm.priceprojectcd.value;

	if (Trim(pn)=="")
	{
		alert("Please enter Project Number!");
		frm.projectnumber.focus();
		return false;
	}
	frm.projectnumber.value = Trim(pn);

	if (!(pn.match(/^[0-9]+$/)))
	{
	    alert("The Project Number contains illegal characters!");
		frm.projectnumber.focus();
		return false;
	}

	if (Trim(sn)=="")
	{
		alert("Please enter Solicitation Number!");
		frm.solicitationnumber.focus();
		return false;
	}
	frm.solicitationnumber.value = Trim(sn);

	//if (parseInt(sn)!= sn)
	//{
	//    alert("The Solicitation Number contains illegal characters!");
	//	frm.solicitationnumber.focus();
	//	return false;
	//}

	if (Trim(pt)=="")
	{
		alert("Please enter Project Title!");
		frm.projecttitle.focus();
		return false;
	}
	frm.projecttitle.value = Trim(pt);

	//if (Trim(id)=="")
	//{
	//	alert("Please enter issued date!");
	//	return false;
	//}
	//frm.issuedate.value = Trim(id);

	//if (Trim(bd)=="")
	//{
	//	alert("Please enter bid date!");
	//	return false;
	//}
	//frm.biddate.value = Trim(bd);

	//if (Trim(rd)=="")
	//{
	//	alert("Please enter revised date!");
	//	return false;
	//}
	//frm.reviseddate.value = Trim(rd);


	//if (Trim(np)=="")
	//{
	//	alert("Please enter number of plans!");
	//	frm.noofplans.focus();
	//	return false;
	//}
	//frm.noofplans.value = Trim(np);


	//if (parseInt(np)!= np)
	//{
	//   alert("Number of plan contains illegal characters!");
	//	frm.noofplans.focus();
	//	return false;
	//}

	//if (Trim(ns)=="")
	//{
	//	alert("Please enter no of specifications!");
	//	frm.noofspecifications.focus();
	//	return false;
	//}
	//frm.noofspecifications.value = Trim(ns);

	//if (parseInt(ns)!= ns)
	//{
	//    alert("Number of specifications contains illegal characters!");
	//	frm.noofspecifications.focus();
	//	return false;
	//}

	if (Trim(pvf)=="")
	{
		alert("Please enter project value!");
		frm.projectvaluefrom.focus();
		return false;
	}
	frm.projectvaluefrom.value = Trim(pvf);

	if (parseFloat(pvf) != pvf)
	{
	    alert("The Project value contains illegal characters!");
		frm.projectvaluefrom.focus();
		return false;
	}

	if (Trim(pvt)=="")
	{
		alert("Please enter project value!");
		frm.projectvalueto.focus();
		return false;
	}
	frm.projectvalueto.value = Trim(pvt);

	if (parseFloat(pvt) != pvt)
	{
	    alert("The Project value contains illegal characters!");
		frm.projectvalueto.focus();
		return false;
	}
	
	
	if (eval(Trim(pvt)) < eval(Trim(pvf)))
	{
		alert("Please enter first value is greater then or equal to second value!");
		frm.projectvalueto.focus();
		return false;
	}
	//if (Trim(ap)=="")
	//{
	//	alert("Please upload project amendment plan!");
	//	frm.amendmentplan.focus();
	//	return false;
	//}

	//if (Trim(ps)=="")
	//{
	//	alert("Please upload project synopsis!");
	//	frm.projectsynopsis.focus();
	//	return false;
	//}

	//if (Trim(pfc)=="")
	//{
	//	alert("Please enter price for fullscale completeset!");
	//	frm.pricefscompleteset.focus();
	//	return false;
	//}
	//frm.pricefscompleteset.value = Trim(pfc);

	//if (parseFloat(pfc) != pfc)
	//{
	//    alert("The price for fullscale completeset contains illegal characters!");
	//	frm.pricefscompleteset.focus();
	//	return false;
	//}

	//if (Trim(phc)=="")
	//{
	//	alert("Please enter price for  half scale completeset!");
	//	frm.pricehscompleteset.focus();
	//	return false;
	//}
	//frm.pricehscompleteset.value = Trim(phc);

	//if (parseFloat(phc) != phc)
	//{
	//    alert("The price for half scale completeset contains illegal characters!");
	//	frm.pricehscompleteset.focus();
	//	return false;
	//}

	//if (Trim(pfp)=="")
	//{
	//	alert("Please enter price for full scale partials !");
	//	frm.pricefspartials.focus();
	//	return false;
	//}
	//frm.pricefspartials.value = Trim(pfp);

	//if (parseFloat(pfp) != pfp)
	//{
	//    alert("The price for full scale partials contains illegal characters!");
	//	frm.pricefspartials.focus();
	//	return false;
	//}

	//if (Trim(php)=="")
	//{
	//	alert("Please enter price for half scale partials !");
	//	frm.pricehspartials.focus();
	//	return false;
	//}
	//frm.pricehspartials.value = Trim(php);

	//if (parseFloat(php) != php)
	//{
	//    alert("The price for  half scale partials contains illegal characters!");
	//	frm.pricehspartials.focus();
	//	return false;
	//}

	//if (Trim(psc)=="")
	//{
	//	alert("Please enter price for specs complete set!");
	//	frm.pricespecscompleteset.focus();
	//	return false;
	//}
	//frm.pricespecscompleteset.value = Trim(psc);

	//if (parseFloat(psc) != psc)
	//{
	//    alert("The price for specs complete set contains illegal characters!");
	//	frm.pricespecscompleteset.focus();
	//	return false;
	//}

	//if (Trim(psp)=="")
	//{
	//	alert("Please enter price for specs partials!");
	//	frm.pricespecspartials.focus();
	//	return false;
	//}
	//frm.pricespecspartials.value = Trim(psp);

	//if (parseFloat(psp) != psp)
	//{
	//    alert("The price for  specs partials contains illegal characters!");
	//	frm.pricespecspartials.focus();
	//	return false;
	//}

	//if (Trim(pgm)=="")
	//{
	//	alert("Please enter price for goverment health & safty manual!");
	//	frm.pricegovtmanual.focus();
	//	return false;
	//}
	//frm.pricegovtmanual.value = Trim(pgm);

	//if (parseFloat(pgm) != pgm)
	//{
	//    alert("The price for goverment health & safty manual contains illegal characters!");
	//	frm.pricegovtmanual.focus();
	//	return false;
	//}


	//if (Trim(ppc)=="")
	//{
	//	alert("Please enter price for project cd!");
	//	frm.priceprojectcd.focus();
	//	return false;
	//}
	//frm.priceprojectcd.value = Trim(ppc);

	//if (parseFloat(ppc) != ppc)
	//{
	//    alert("The price for project cd contains illegal characters!");
	//	frm.priceprojectcd.focus();
	//	return false;
	//}

	frm.issuedate.disabled = false;
	frm.biddate.disabled = false;
	frm.reviseddate.disabled = false;

	return true;
}

function validate_editproject()
{
	frm=document.frmproject;
	//alert('hello1');
	cal_price();
	pn=frm.projectnumber.value;
	sn=frm.solicitationnumber.value;
	pt=frm.projecttitle.value;

	//id=frm.issuedate.value;
	//bd=frm.biddate.value;
	//rd=frm.reviseddate.value;
	//np=frm.noofplans.value;
	//ns=frm.noofspecifications.value;
		
	pvf=frm.projectvaluefrom.value;
	pvt=frm.projectvalueto.value;
	//ap=frm.amendmentplan.value;
	//ps=frm.projectsynopsis.value;
	pfc	= frm.pricefscompleteset.value;
	phc = frm.pricehscompleteset.value;
	pfp = frm.pricefspartials.value;
	php = frm.pricehspartials.value;
	psc = frm.pricespecscompleteset.value;
	psp = frm.pricespecspartials.value;
	rs1 = frm.reserved1.value;
	rs2 = frm.reserved2.value;
	pgm = frm.pricegovtmanual.value;
	ppc = frm.priceprojectcd.value;

	if (Trim(pn)=="")
	{
		alert("Please enter Project Number!");
		frm.projectnumber.focus();
		return false;
	}
	frm.projectnumber.value = Trim(pn);

	if (!(pn.match(/^[0-9]+$/)))
	{
	    alert("The Project Number contains illegal characters!");
		frm.projectnumber.focus();
		return false;
	}

	if (Trim(sn)=="")
	{
		alert("Please enter Solicitation Number!");
		frm.solicitationnumber.focus();
		return false;
	}
	frm.solicitationnumber.value = Trim(sn);

	//if (parseInt(sn)!= sn)
	//{
	//    alert("The Solicitation Number contains illegal characters!");
	//	frm.solicitationnumber.focus();
	//	return false;
	//}

	if (Trim(pt)=="")
	{
		alert("Please enter Project Title!");
		frm.projecttitle.focus();
		return false;
	}
	frm.projecttitle.value = Trim(pt);

	//if (Trim(id)=="")
	//{
	//	alert("Please enter issued date!");
	//	return false;
	//}
	//frm.issuedate.value = Trim(id);

	//if (Trim(bd)=="")
	//{
	//	alert("Please enter bid date!");
	//	return false;
	//}
	//frm.biddate.value = Trim(bd);

	//if (Trim(rd)=="")
	//{
	//	alert("Please enter revised date!");
	//	return false;
	//}
	//frm.reviseddate.value = Trim(rd);


	//if (Trim(np)=="")
	//{
	//	alert("Please enter number of plans!");
	//	frm.noofplans.focus();
	//	return false;
	//}
	//frm.noofplans.value = Trim(np);


	//if (parseInt(np)!= np)
	//{
	//    alert("Number of plan contains illegal characters!");
	//	frm.noofplans.focus();
	//	return false;
	//}

	//if (Trim(ns)=="")
	//{
	//	alert("Please enter no of specifications!");
	//	frm.noofspecifications.focus();
	//	return false;
	//}
	//frm.noofspecifications.value = Trim(ns);

	//if (parseInt(ns)!= ns)
	//{
	//    alert("Number of specifications contains illegal characters!");
	//	frm.noofspecifications.focus();
	//	return false;
	//}

	if (Trim(pvf)=="")
	{
		alert("Please enter Project Value!");
		frm.projectvaluefrom.focus();
		return false;
	}
	frm.projectvaluefrom.value = Trim(pvf);

	if (parseFloat(pvf) != pvf)
	{
	    alert("The Project value contains illegal characters!");
		frm.projectvaluefrom.focus();
		return false;
	}

	if (Trim(pvt)=="")
	{
		alert("Please enter project value!");
		frm.projectvalueto.focus();
		return false;
	}
	frm.projectvalueto.value = Trim(pvt);

	if (parseFloat(pvt) != pvt)
	{
	    alert("The Project value contains illegal characters!");
		frm.projectvalueto.focus();
		return false;
	}
	
	if (eval(Trim(pvt)) < eval(Trim(pvf)))
	{
		alert("Please enter first value is greater then or equal to second value!");
		frm.projectvalueto.focus();
		return false;
	}

	//if (Trim(pfc)=="")
	//{
	//	alert("Please enter price for fullscale completeset!");
	//	frm.pricefscompleteset.focus();
	//	return false;
	//}
	//frm.pricefscompleteset.value = Trim(pfc);

	//if (parseFloat(pfc) != pfc)
	//{
	//  alert("The price for fullscale completeset contains illegal characters!");
	///	frm.pricefscompleteset.focus();
	//	return false;
	//}

	//if (Trim(phc)=="")
	//{
	//	alert("Please enter price for  half scale completeset!");
	//	frm.pricehscompleteset.focus();
	//	return false;
	//}
	//frm.pricehscompleteset.value = Trim(phc);

	//if (parseFloat(phc) != phc)
	///{
	//    alert("The price for half scale completeset contains illegal characters!");
	//	frm.pricehscompleteset.focus();
	//	return false;
	//}

	//if (Trim(pfp)=="")
	//{
	//	alert("Please enter price for full scale partials !");
	//	frm.pricefspartials.focus();
	//	return false;
	//}
	//frm.pricefspartials.value = Trim(pfp);

	//if (parseFloat(pfp) != pfp)
	//{
	//    alert("The price for full scale partials contains illegal characters!");
	//	frm.pricefspartials.focus();
	//	return false;
	//}

	//if (Trim(php)=="")
	//{
	//	alert("Please enter price for half scale partials !");
	//	frm.pricehspartials.focus();
	//	return false;
	//}
	//frm.pricehspartials.value = Trim(php);

	//if (parseFloat(php) != php)
	//{
	//   alert("The price for  half scale partials contains illegal characters!");
	//	frm.pricehspartials.focus();
	//	return false;
	//}

	//if (Trim(psc)=="")
	//{
	//	alert("Please enter price for specs complete set!");
	//	frm.pricespecscompleteset.focus();
	//	return false;
	//}
	//frm.pricespecscompleteset.value = Trim(psc);

	//if (parseFloat(psc) != psc)
	//{
	//    alert("The price for specs complete set contains illegal characters!");
	//	frm.pricespecscompleteset.focus();
	//	return false;
	//}

	//if (Trim(psp)=="")
	//{
	//	alert("Please enter price for specs partials!");
	//	frm.pricespecspartials.focus();
	//	return false;
	//}
	//frm.pricespecspartials.value = Trim(psp);

	//if (parseFloat(psp) != psp)
	//{
	//    alert("The price for  specs partials contains illegal characters!");
	//	frm.pricespecspartials.focus();
	//	return false;
	//}

	//if (Trim(pgm)=="")
	//{
	//	alert("Please enter price for goverment health & safty manual!");
	//	frm.pricegovtmanual.focus();
	//	return false;
	//}
	//frm.pricegovtmanual.value = Trim(pgm);

	//if (parseFloat(pgm) != pgm)
	//{
	//    alert("The price for goverment health & safty manual contains illegal characters!");
	//	frm.pricegovtmanual.focus();
	//	return false;
	//}


	//if (Trim(ppc)=="")
	//{
	//	alert("Please enter price for project cd!");
	//	frm.priceprojectcd.focus();
	//	return false;
	//}
	//frm.priceprojectcd.value = Trim(ppc);

	//if (parseFloat(ppc) != ppc)
	//{
	//    alert("The price for project cd contains illegal characters!");
	//	frm.priceprojectcd.focus();
	//	return false;
	//}

	frm.issuedate.disabled = false;
	frm.biddate.disabled = false;
	frm.reviseddate.disabled = false;

	return true;
}


function openpopup(url)
{
	win=window.open(url,'win','top=200,left=200,width=650,height=400,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
	return true;
}

function openmypopup(url, width, height)
{
	win=window.open(url,'win','top=100,left=200,width='+width+',height='+height+',status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
	return true;
}


function validate_addmember()
{
	//alert("validate+add member");

frm=document.frmmember;

	un=frm.username.value;
	pw=frm.password.value;
	cp=frm.confirmpassword.value;

	bco=frm.billingcompany.value;
	bcp=frm.billingcontact.value;
	ba1=frm.billingaddress1.value;
	bci=frm.billingcity.value;
	bzi=frm.billingzip.value;
	bem=frm.billingemail.value;
	bph=frm.billingphone.value;
	fax_b= frm.billingfax.value;

	sco=frm.shippingcompany.value;
	scp=frm.shippingcontact.value;
	sa1=frm.shippingaddress1.value;
	sci=frm.shippingcity.value;
	szi=frm.shippingzip.value;
	sem=frm.shippingemail.value;
	sph=frm.shippingphone.value;
		
	/*------------------------------------------Payment Information payment via Validation-------------*/
	
/*-------------------------------------------------UserName Validation-------------*/
	
	if (Trim(frm.username.value)=="")
	{	
	
		alert("Please enter Username!");
			
		frm.username.focus();
		return false;
	}
	if(frm.username.value.match(/[&<>]+/))
	{
		alert("please enter Valid Username");
		frm.username.focus();
		return false;
	}
	if(frm.username.value.length<4)
	{
		alert("Username Should be mininum 4 characters");
		frm.username.focus();
		return false;
	}
	frm.username.value = Trim(un);
/*-------------------------------------------------Password Validation-------------*/
	if (Trim(frm.password.value)=="")
	{
		alert("Please enter Password!");
		frm.password.focus();
		return false;
	}
	if(frm.password.value.length<6)
	{
		alert("Password Should be mininum 6 characters");
		frm.password.focus();
		return false;
	}
	if(frm.password.value.length>20)
		{
			alert("Password must be maximum of 20 letters");
			frm.password.focus();
			return false;
		}
	frm.password.value = Trim(pw);
	/*---------------------------------------------ConfirmPassword Validation-------------*/

	if (Trim(frm.confirmpassword.value)=="")
	{
		alert("Please enter Confirm Password!");
		frm.confirmpassword.focus();
		return false;
	}
	if(frm.confirmpassword.value.length<6)
	{
		alert("Confirm Password Should be mininum 6 characters");
		frm.confirmpassword.focus();
		return false;
	}
	if(frm.confirmpassword.value.length>20)

		{
			alert("Confirm Password must be maximum of 20 letters");
			frm.confirmpassword.focus();
			return false;
		}
	frm.confirmpassword.value = Trim(cp);

	if (pw!=cp)
	{
		alert("Password and Confirm Password, does not match");
		frm.confirmpassword.focus();
		return false;
	}
	
	/*-------------------------------------------------Billing Company Validation-------------*/
                                    
	if (Trim(bco)=="")
	{
		alert("Please enter Company Name!");
		frm.billingcompany.focus();
		return false;
	}
	if (!isNaN(frm.billingcompany.value))
	{
		alert("Please enter valid Company Name!");
		frm.billingcompany.focus();
		return false;
	}
	frm.billingcompany.value = Trim(bco);
	/*-------------------------------------------------Billing Contact Validation-------------*/

	if (Trim(bcp)=="")
	{
		alert("Please enter Attention Name!");
		frm.billingcontact.focus();
		return false;
	}
	if (!isNaN(frm.billingcontact.value))
	{
		alert("Please enter valid Attention Name!");
		frm.billingcontact.focus();
		return false;
	}
	frm.billingcontact.value = Trim(bcp);
	/*-----------------------------------------billing last name------------------------
	
	if (Trim(frm.billinglastname.value)=="")
	{
		alert("Please enter Last Name!");
		frm.billinglastname.focus();
		return false;
	}
	if (!isNaN(frm.billinglastname.value))
	{
		alert("Please enter valid Last Name!");
		frm.billinglastname.focus();
		return false;
	}
	frm.billinglastname.value = Trim(frm.billinglastname.value); */

	
 	/*------------------------------------------Billing Company  adddress Validation-------------*/

	if (Trim(ba1)=="")
	{
		alert("Please enter Address!");
		frm.billingaddress1.focus();
		return false;
	}
	frm.billingaddress1.value = Trim(ba1);
	/*------------------------------------------Billing Company  city Validation-------------*/
	if (Trim(bci)=="")
	{
		alert("Please enter City!");
		frm.billingcity.focus();
		return false;
	}
	if (!isNaN(frm.billingcity.value))
	{
		alert("Please enter valid City Name!");
		frm.billingcity.focus();
		return false;
	}
	frm.billingcity.value = Trim(bci);
   /*------------------------------------------Billing Company  Zipcode Validation-------------*/
	if (Trim(bzi)=="")
	{
		alert("Please enter Zip!");
		frm.billingzip.focus();
		return false;
	}
	if (isNaN(frm.billingzip.value))
	{
		alert("Please enter valid Zipcode!");
		frm.billingzip.focus();
		return false;
	}
	if(frm.billingzip.value.length<3)
	{
		alert("Zip Should be mininum 3 characters");
		frm.billingzip.focus();
		return false;
	}
	frm.billingzip.value = Trim(bzi);
   /*------------------------------------------Billing Company  Emailadddress Validation-------------*/
	if (!validate_emailaddress(bem,true,false))
	{
		alert("Please enter valid Email Address!");
		frm.billingemail.focus();
		return false;
	}
	/*------------------------------------------Billing Company  phonenumber Validation-------------*/
	if (Trim(bph)=="")
	{
		alert("Please enter Phone!");
		frm.billingphone.focus();
		return false;
	}
//	if (isNaN(frm.billingphone.value))
	if(!(frm.billingphone.value.match(/^[0-9-]+$/)))
	{
		alert("Please enter valid Phone Number!");
		frm.billingphone.focus();
		return false;
	}
	if(frm.billingphone.value.length < 10)
	{
		alert("Phone number Should have 10 characters!");
		frm.billingphone.focus();
		return false;
	}
	frm.billingphone.value = Trim(bph);
	
	//------------------------------fax
	if(fax_b != "")
	{
				if(!(frm.billingfax.value.match(/^[0-9-]+$/)))
				{
					alert("Please enter valid Fax number!");
					frm.billingfax.focus();
					return false;
				}
				if(frm.billingfax.value.length < 10)
				{
					alert("Fax number Should have 10 characters!");
					frm.billingfax.focus();
					return false;
				}
				frm.billingfax.value = Trim(fax_b);
			
	}
  
	/*------------------------------------------Shipping Contact  Name Validation-------------*/

	if (Trim(scp)=="")
	{
		alert("Please enter Attention Name!");
		frm.shippingcontact.focus();
		return false;
	}
	if (!isNaN(frm.shippingcontact.value))
	{
		alert("Please enter valid Attention Name!");
		frm.shippingcontact.focus();
		return false;
	}
	frm.shippingcontact.value = Trim(scp);
		/*------------------------------------------Shipping last  Name Validation-------------

	if (Trim(frm.shippinglastname.value)=="")
	{
		alert("Please enter Last Name!");
		frm.shippinglastname.focus();
		return false;
	}
	if (!isNaN(frm.shippinglastname.value))
	{
		alert("Please enter valid Last Name!");
		frm.shippinglastname.focus();
		return false;
	}
	frm.shippinglastname.value = Trim(frm.shippinglastname.value); */
	
	 /*------------------------------------------Shipping Company  Name Validation-------------*/

	if (Trim(sco)=="")
	{
		alert("Please enter Company Name!");
		frm.shippingcompany.focus();
		return false;
	}
	if (!isNaN(frm.shippingcompany.value))
	{
		alert("Please enter valid Company Name!");
		frm.shippingcompany.focus();
		return false;
	}
	frm.shippingcompany.value = Trim(sco);
	/*------------------------------------------Shipping Address Validation-------------*/

	if (Trim(sa1)=="")
	{
		alert("Please enter Address!");
		frm.shippingaddress1.focus();
		return false;
	}
	frm.shippingaddress1.value = Trim(sa1);
	/*------------------------------------------Shipping City Validation-------------*/
	if (Trim(sci)=="")
	{
		alert("Please enter City!");
		frm.shippingcity.focus();
		return false;
	}
	if (!isNaN(frm.shippingcity.value))
	{
		alert("Please enter valid City Name!");
		frm.shippingcity.focus();
		return false;
	}
	frm.shippingcity.value = Trim(sci);
	/*------------------------------------------Shipping Zipcode Validation-------------*/
	if (Trim(szi)=="")
	{
		alert("Please enter Zip!");
		frm.shippingzip.focus();
		return false;
	}
	if (isNaN(frm.shippingzip.value))
	{
		alert("Please enter valid Zipcode!");
		frm.shippingzip.focus();
		return false;
	}
	if(frm.shippingzip.value.length<3)
	{
		alert("Zip Should be mininum 3 characters");
		frm.shippingzip.focus();
		return false;
	}
	frm.shippingzip.value = Trim(szi);
	/*------------------------------------------Shipping Emailaddress Validation-------------*/
	if (!validate_emailaddress(sem,true,false))
	{
		alert("Please enter valid Email Address!");
		frm.shippingemail.focus();
		return false;
	}
	/*------------------------------------------Shipping PhoneNumber Validation-------------*/

	if (Trim(sph)=="")
	{
		alert("Please enter Phone!");
		frm.shippingphone.focus();
		return false;
	}
	//if (isNaN(frm.shippingphone.value))
	if(!(frm.shippingphone.value.match(/^[0-9-]+$/)))
	{
		alert("Please enter valid Phone Number!");
		frm.shippingphone.focus();
		return false;
	}
	if(frm.shippingphone.value.length < 10)
	{
		alert("Phone Should have 10 characters");
		frm.shippingphone.focus();
		return false;
	}
	frm.shippingphone.value = Trim(sph);
	//--------------------------fax shipp
	if(frm.shippingfax.value != "")
	{
			if(!(frm.shippingfax.value.match(/^[0-9-]+$/)))
			{
				alert("Please enter valid Fax Number!");
				frm.shippingfax.focus();
				return false;
			}
			if(frm.shippingfax.value.length < 10)
			{
				alert("Fax Number Should have 10 characters");
				frm.shippingfax.focus();
				return false;
			}
			frm.shippingfax.value = Trim(frm.shippingfax.value);
		
	}
	
	ppv=frm.payment_via.value;
	//ped=frm.exp_date.value;
	pcn=frm.card_no.value;
	mm=frm.month.value;
	yyyy=frm.year.value;

	 if (!(ppv == "Use Card on File" || ppv == "ApprovedAccount" || ppv == "CompanyChe"))
	{
						
							
							if(pcn == "")
							{
								alert("Please enter Card Number!");
								frm.card_no.focus();
								return false;
							}
							else
							{
								if(!(pcn.match(/^[0-9]+$/)))
								{
									alert("Please enter valid Card Number!");
									frm.card_no.focus();
									return false;
								}
							}
					
							if (mm == "month")
							{
								alert("Please select Month for Expire Date!");
								frm.month.focus();
								return false;
							}
					
							if (yyyy == "year")
							{
								alert("Please select Year for Expire Date!");
								frm.year.focus();
								return false;
							}
					
	}
	else
	{
			
			//------------------------------------------Payment Information Card Number Validation-------------/
				
				if (Trim(pcn) != "")
				{
					alert("First select Payment Type, Then enter Card Number!");
					//frm.card_no.focus();
					return false;
				}
		
	}
	
if(document.frmmember.term_hidd.value == 1)
{	 
	if(document.frmmember.terms.checked == false)
	{	 
		alert("You must agree to the Terms & Conditions");
		document.frmmember.terms.focus();
		return false;
	}	  
}
	
	
	return true;
}

function validate_search(frm)
{

	if (frm.field.value=="anyfield")
	{
		alert("Please select any one of the Field!");
		frm.field.focus();
		return false;
	}
	if (frm.operator.value=="0")
	{
		alert("Please select any one of the Operator!");
		frm.operator.focus();
		return false;
	}
	if (frm.value.value=="")
	{
		alert("Please enter value for the Field!");
		frm.value.focus();
		return false;
	}
	return true;
}

function validate_editorder()
{
	frm = document.frmorder;


	if (frm.paid[1].checked==true && frm.paymentstatus.value=="pending")
	{
		alert("You mentioned paid status is 'Yes' and payment status is 'Pending', Please make it as 'Completed'");
		frm.paymentstatus.focus();
		return false;
	}
	if (frm.shipped[1].checked==true  && frm.shippeddate.value=="")
	{
		alert("You mentioned shipped status is 'Yes', So please select 'Shipped Date' ");
		frm.shippeddate.focus();
		return false;

	}

	if (frm.shippeddate.value!="")
	{
		od = frm.orderdate.value;
		sd = frm.shippeddate.value;

		if (compare_dates(od,sd)==1)
		{
			alert("The 'shipped date' less than then the 'order date', Please choose correct one!");
			frm.shippeddate.focus();
			return false;
		}
		return false;
	}
	
	
	frm.exp_date.disabled = false;
	return true;
}

function compare_dates(value1, value2) {

	// return value 1 => d1 > d2, -1 => d1 < d2, 0 => d1 = d2	

   var date1, date2;
   var month1, month2;
   var year1, year2;

   year1 = value1.substring (0, value1.indexOf ("-"));
   month1 = value1.substring (value1.indexOf ("-")+1, value1.lastIndexOf ("-"));
   date1 = value1.substring (value1.lastIndexOf ("-")+1, value1.length);

   year2 = value2.substring (0, value2.indexOf ("-"));
   month2 = value2.substring (value2.indexOf ("-")+1, value2.lastIndexOf ("-"));
   date2 = value2.substring (value2.lastIndexOf ("-")+1, value2.length);

   if (year1 > year2) return 1;
   else if (year1 < year2) return -1;
   else if (month1 > month2) return 1;
   else if (month1 < month2) return -1;
   else if (date1 > date2) return 1;
   else if (date1 < date2) return -1;
   else return 0;
} 

function cancelLink () 
{
  return false;
}

function disableLink (link) 
{
  if (link.onclick)
    link.oldOnClick = link.onclick;
  link.onclick = cancelLink;
  if (link.style)
    link.style.cursor = 'default';
}

function enableLink (link) 
{
  link.onclick = link.oldOnClick ? link.oldOnClick : null;
  if (link.style)
    link.style.cursor = 
      document.all ? 'hand' : 'pointer';
}

function toggleLink (link) 
{
  if (link.disabled) 
    enableLink (link)
  else 
    disableLink (link);
  link.disabled = !link.disabled;
}


function validate_testemail()
{
	frm = document.frmmail;

	if (frm.subject.value=="")
	{
		alert("Please enter Subject!");
		frm.subject.focus();
		return false;
	}
	if (frm.message.value=="")
	{
		alert("Please enter Message!");
		frm.message.focus();
		return false;
	}
	if (!validate_emailaddress(frm.testemailid.value,true,false))
	{
		alert("Please enter valid Test Email Address!");
		frm.testemailid.focus();
		return false;
	}
	return true;
}


function validate_sendemail()
{
	frm = document.frmmail;

	if(frm.totype[1].checked==true)
	{
		emailids=frm.emailids.value;	

		if (emailids=="")
		{
			alert("Please enter User Email Ids, Since you have selects 'selected users'!");
			frm.emailids.focus();
			return false;
		}
		else
		{

			var valid = 1;
			var eids=new Array();
			eids = emailids.split(",");
			var lengt=eids.length;
			for(i=0;i<lengt;i++)
			{ 
				// emailid=trim(eids[i]);
				var emailid=eids[i];
				emailid=Trim(emailid);
				if (!validate_emailaddress(emailid,true,false))
				{
					valid=0;
					break;
				}
		    }

			if (valid==0)
			{
				   alert("One of the Users Email Id is invalid, Please check and enter Valid Email Addresses!");
				   frm.emailids.focus();
				   return false;
			}	
		
		}
	}

	if (frm.subject.value=="")
	{
		alert("Please enter Subject!");
		frm.subject.focus();
		return false;
	}
	if (frm.message.value=="")
	{
		alert("Please enter Message!");
		frm.message.focus();
		return false;
	}

	return true;
}

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function



function validate_addsubcategory()
{
	frm=document.frmsubcategory;

	cn=frm.subcategoryname.value;
	de=frm.subcategorydescription.value;

	if (cn=="")
	{
		alert("Please enter Category Name!");
		frm.subcategoryname.focus();
		return false;
	}
	if (de=="")
	{
		alert("Please enter Category Description!");
		frm.subcategorydescription.focus();
		return false;
	}
	return true;
}


function hidediv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('hideShow').style.visibility = 'hidden'; 
	} 
	else
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.hideShow.visibility = 'hidden'; 
		} 
		else 
		{ // IE 4 
			document.all.hideShow.style.visibility = 'hidden'; 
		} 
	} 
} 

function showdiv() 
{ 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		document.getElementById('hideShow').style.visibility = 'visible'; 
	} 
	else
	{ 
		if (document.layers) 
		{ // Netscape 4 
			document.hideShow.visibility = 'visible'; 
		} 
		else
		{ // IE 4 
			document.all.hideShow.style.visibility = 'visible'; 
		} 
	} 
} 


function validate_forgotpassword(val)
{
	frm=document.frmpassword;

	if (val==1)
	{
		un = frm.username1.value;
		if (Trim(un)=="")
		{
			alert("Please enter Username!");
			frm.username1.focus();
			return false;
		}
		frm.username1.value=Trim(un);
	}
	else if (val==2)
	{
		em = frm.email.value;
		if (!validate_emailaddress(em,true,false))
		{
			alert("Please enter Valid Email Address!");
			frm.email.focus();
			return false;
		}
	}
	return true;
}



function validate_editprofile()
{
	frm=document.frmuser;

	pw=frm.password.value;
	cp=frm.confirmpassword.value;
	fn=frm.firstname.value;
	//ln=frm.lastname.value;
	a1=frm.address1.value;
	//a2=frm.address2.value;
	ci=frm.city.value;
	st=frm.state.options[frm.state.selectedIndex].value;
	//co=frm.country.value;
	zi=frm.zip.value;
	em=frm.email.value;
	ph=frm.phone.value;
	os=frm.otherstate.value;

	if (Trim(pw)=="")
	{
		alert("Please enter Password!");
		frm.password.focus();
		return false;
	}
	frm.password.value = Trim(pw);

	if (Trim(cp)=="")
	{
		alert("Please enter Confirm Password!");
		frm.confirmpassword.focus();
		return false;
	}
	frm.confirmpassword.value = Trim(cp);

	if (pw!=cp)
	{
		alert("Password and Confirm Password are does not match!");
		frm.confirmpassword.focus();
		return false;
	}
	
	if (Trim(fn)=="")
	{
		alert("Please enter Attention Name!");
		frm.firstname.focus();
		return false;
	}
	frm.firstname.value = Trim(fn);
/*
	if (Trim(ln)=="")
	{
		alert("Please enter Lastname!");
		frm.lastname.focus();
		return false;
	}
	frm.lastname.value = Trim(ln);
*/
	if (Trim(a1)=="")
	{
		alert("Please enter Address1!");
		frm.address1.focus();
		return false;
	}
	frm.address1.value = Trim(a1);

	/*if (Trim(a2)=="")
	{
		alert("Please enter Address2!");
		frm.address2.focus();
		return false;
	}
	frm.address2.value = Trim(a2);
	*/
	

	if (Trim(ci)=="")
	{
		alert("Please enter City!");
		frm.city.focus();
		return false;
	}
	frm.city.value = Trim(ci);

	if (st=="Others")
	{
		if (Trim(os)=="")
		{
			alert("Please specify the State!");
			frm.otherstate.focus();
			return false;
		}
		frm.otherstate.value = Trim(os);
	}


	if (Trim(zi)=="")
	{
		alert("Please enter Zip!");
		frm.zip.focus();
		return false;
	}
	frm.zip.value = Trim(zi);

	if (!validate_emailaddress(em,true,false))
	{
		alert("Please enter Valid Email Address!");
		frm.email.focus();
		return false;
	}
	if (Trim(ph)=="")
	{
		alert("Please Enter Phone!");
		frm.phone.focus();
		return false;
	}
	frm.phone.value = Trim(ph);

	return true;
}




function validate_addplandiscipline()
{
	frm=document.frmplandiscipline;

	di=frm.disciplinename.value;

	if (Trim(di)=="")
	{
		alert("Please enter Plan Discipline name!");
		frm.disciplinename.focus();
		return false;
	}
	frm.disciplinename.value = Trim(di);

	return true;
}

function validate_addspecdivision()
{
	frm=document.frmspecdivision;

	sd=frm.divisionname.value;

	if (Trim(sd)=="")
	{
		alert("Please enter Spec Division name!");
		frm.divisionname.focus();
		return false;
	}
	frm.divisionname.value = Trim(sd);

	return true;
}

function validate_addamendment()
{
	frm=document.frmamendment;

	am=frm.amendmentname.value;

	if (Trim(am)=="")
	{
		alert("Please enter Amendment name!");
		frm.amendmentname.focus();
		return false;
	}
	frm.amendmentname.value = Trim(am);

	return true;
}
function project_search()
{
	frm=document.pro_search_frm;
	pno=frm.project_number.value;
	if(Trim(pno) == "")
	{
		alert("Please enter Project Number!");
		frm.project_number.focus();
		return false;
	}
	else
	{
		if(isNaN(Trim(pno)))
		{
			alert("Please enter Numbers only!");
			frm.project_number.value="";
			frm.project_number.focus();
			return false;
		}
	}
}


function validate_orderform()
{
	frm=document.orderfrm;

	cmp=frm.company.value;
	na=frm.name.value;
	ad=frm.address.value;
	city=frm.city.value;
	state=frm.state.value;
	zip=frm.zip.value;
	email=frm.email.value;

	phone=frm.phone.value;
	fax=frm.fax.value;
	svia=frm.ship_via.value;
	//pvia=frm.payment_via.value;
	payment=frm.payment.value;
	month=frm.month.value;
	year=frm.year.value;
	planfs=frm.planfs_no_set.value;
	planhs=frm.planhs_no_set.value;
	spec_no_set=frm.spescc_no_set.value;
	spescpnoset=frm.spescp_no_set.value;
	
	if(frm.planfs1.checked)
	{
	pfs1=frm.planfs1.value;
	}
	else
	{
	pfs1=0;
	}
	if(frm.planfs2.checked)
	{
	pfs2=frm.planfs2.value;
	}
	else
	{
	pfs2=0;
	}
	pfscom=frm.planfs_com.value;
	
	if(frm.planhs1.checked)
	{
	phs1=frm.planhs1.value;
	}
	else
	{
	phs1=0;
	}
	
	if(frm.planhs2.checked)
	{
	phs2=frm.planhs2.value;
	}
	else
	{
	phs2=0;
	}
	phscom=frm.planhs_com.value;
	/*------------------------Plan Full set NO of set----------------*/
	if(planfs != "")
	{
		if(isNaN(planfs))		
		{
			alert("Please enter numbers only!");
			frm.planfs_no_set.focus();
			return false;
		}
		
		if((eval(pfs1) == 0) && (eval(pfs2) == 0))
		{
		alert("If enter Number Of Set, you must choose either Full Scale or Half Scale!");
		frm.planfs_no_set.focus();
		return false;
		}
	}
	
			if((planfs == "") && ((pfs1) == 1 || (pfs2) == 2))
			{
			alert("If you choose either Full Scale or Half Scale, you must enter Number of set field!");
			frm.planfs_no_set.focus();
			return false;
			}
		
			if((planfs == "") && (pfscom != ""))
			{
			alert("If you enter Comment, you must enter Number of set field!");
			frm.planfs_no_set.focus();
			return false;
			}
		
		/*------------------------plan Half set NO of set----------------*/
	if(planhs != "")
	{
		if(isNaN(planhs))		
		{
			alert("Please enter numbers only!");
			frm.planhs_no_set.focus();
			return false;
		}
		
		if((eval(phs1) == 0) && (eval(phs1) == 0))
		{
		alert("If enter Number Of Set, you must choose either Full Scale or Half Scale!");
		frm.planhs_no_set.focus();
		return false;
		}
	}
	
		if((planhs == "") && ((phs1) == 1 || (phs2) == 2))
			{
			alert("If you choose either Full Scale or Half Scale, you must enter Number of set field!");
			frm.planhs_no_set.focus();
			return false;
			}
			
			if((planhs == "") && (phscom != ""))
			{
			alert("If you enter Comment, you must enter Number of set field!");
			frm.planhs_no_set.focus();
			return false;
			}
		/*------------------------------------------------- CVR/NDX   -  MISC -------------*/
		var box=new Array(15);
		for(var ikl = 3; ikl < 14; ikl++)
		{
			if(eval('document.orderfrm.discipline'+ikl+'.value') != "")
			{
				if(isNaN(eval('document.orderfrm.discipline'+ikl+'.value')))
				{
				    alert("Please enter numbers only!");
					eval('document.orderfrm.discipline'+ikl+'.focus()');
					return false;
				}
			}
		}
		
			//------------------------------------------------- SPESC  (per set) Complete Set Number of set-------------

	if(spec_no_set != "")
	{
		if(isNaN(spec_no_set))		
		{
			alert("Please enter numbers only!");
			//frm.planhs_no_set.value="";
			frm.spescc_no_set.focus();
			return false;
		}
	}
	
	//------------------------------------------------- SPESC (per set) Partials/Amendmentst Number of set-------------

	if(spescpnoset != "")
	{
		if(isNaN(spescpnoset))		
		{
			alert("Please enter numbers only!");
			frm.spescp_no_set.focus();
			return false;
		}
	}
	
	/*------------------------------------------------- Specdiscipline Number of set -------------*/
		for(var speinc = 2; speinc < 23; speinc++)
		{
			if(eval('document.orderfrm.specdiscipline'+speinc+'.value') != "")
			{
				if(isNaN(eval('document.orderfrm.specdiscipline'+speinc+'.value')))
				{
				    alert("Please enter numbers only!");
					eval('document.orderfrm.specdiscipline'+speinc+'.focus()');
					return false;
				}
			}
		}
		
		/*------------------------------------------------- Amendment Number of set -------------*/
		for(var amdi = 2; amdi < 14; amdi++)
		{
			if(eval('document.orderfrm.noset'+amdi+'.value') != "")
			{
				if(isNaN(eval('document.orderfrm.noset'+amdi+'.value')))
				{
				    alert("Please enter numbers only!");
					eval('document.orderfrm.noset'+amdi+'.focus()');
					return false;
				}
			}
		}
	/*------------------------------------------------- Company Validation-------------*/
                                    
	if (Trim(cmp)=="")
	{
		alert("Please enter Company!");
		frm.company.focus();
		return false;
	}
	frm.company.value = Trim(cmp);
	/*-------------------------------------------------name Validation-------------*/

	if (Trim(na)=="")
	{
		alert("Please enter Name");
		frm.name.focus();
		return false;
	}
	frm.name.value = Trim(na);
 	/*------------------------------------------adddress Validation-------------*/

	if (Trim(ad)=="")
	{
		alert("Please enter Address!");
		frm.address.focus();
		return false;
	}
	frm.address.value = Trim(ad);
	/*------------------------------------------ city Validation-------------*/
	if (Trim(city)=="")
	{
		alert("Please enter City!");
		frm.city.focus();
		return false;
	}
	frm.city.value = Trim(city);
	/*------------------------------------------State Validation-------------*/
	if (Trim(state)=="")
	{
		alert("Please enter State!");
		frm.state.focus();
		return false;
	}
	frm.state.value = Trim(state);
   /*------------------------------------------Billing Zipcode Validation-------------*/
	if (Trim(zip)=="")
	{
		alert("Please enter Zip!");
		frm.zip.focus();
		return false;
	}
	if (isNaN(frm.zip.value))
	{
		alert("Please enter Valid Zipcode!");
		frm.zip.focus();
		return false;
	}
	if(frm.zip.value.length<3)
	{
		alert("Zip Should be mininum 3 characters");
		frm.zip.focus();
		return false;
	}
	frm.zip.value = Trim(zip);
   /*------------------------------------------Emailadddress Validation-------------*/
	if (!validate_emailaddress(email,true,false))
	{
		alert("Please enter valid Email Address!");
		frm.email.focus();
		return false;
	}
	/*------------------------------------------  phonenumber Validation-------------*/
	if (Trim(phone)=="")
	{
		alert("Please enter Phone!");
		frm.phone.focus();
		return false;
	}
//	if (isNaN(frm.billingphone.value))
	if(!(frm.phone.value.match(/^[0-9-]+$/)))
	{
		alert("Please enter Valid Phone Number!");
		frm.phone.focus();
		return false;
	}
	if(frm.phone.value.length < 10)
	{
		alert("Phone number Should have 10 characters!");
		frm.phone.focus();
		return false;
	}
	frm.phone.value = Trim(phone);
	 /*------------------------------------------Fax Validation-------------*/
	if (fax !="")
	{
		if(!(fax.match(/^0-9-]+$/)))
		{					   
		alert("Please enter valid Fax Number!");
		frm.fax.focus();
		return false;
		}
			if(fax.length < 10)
			{
				alert("Fax number Should have 10 characters!");
				frm.fax.focus();
				return false;
			}

		
frm.fax.value = Trim(fax);
	}
	
   /*------------------------------------------Sipping Method Validation-------------*/

	if (Trim(svia)==1)
	{
		alert("Please select Sipping Method!");
		frm.ship_via.focus();
		return false;
	}
	
	frm.ship_via.value = Trim(svia);
	/*------------------------------------------Payment Method Validation-------------*/

/*	if (Trim(pvia)=="Use Card on File")
	{
		alert("Please select Charge To Approved Account!");
		frm.payment_via.focus();
		return false;
	}
	
	frm.payment_via.value = Trim(pvia); */
	/*------------------------------------------payment Validation-------------*/

	if (Trim(payment)=="")
	{
		alert("Please enter Payment!");
		frm.payment.focus();
		return false;
	}
	frm.payment.value = Trim(payment);
	/*------------------------------------------month Validation-------------*/
	if (Trim(month)=="month")
	{
		alert("Please select Month!");
		frm.month.focus();
		return false;
	}
	frm.month.value = Trim(month);
	/*------------------------------------------year Validation-------------*/
	if (Trim(year)=="year")
	{
		alert("Please select Year!");
		frm.year.focus();
		return false;
	}
	frm.year.value = Trim(year);
	return true;
}
function cal_price()
{

	no_of_plans = frm.noofplans.value;
	if(isNaN(no_of_plans))
	{
		alert("Please enter numeric values only");
		frm.noofplans.focus();
		return false;
	}
	
	size = frm.originalsize.value;
	price_per_sf = frm.price_per_sf.value;
	if(isNaN(price_per_sf))
	{
		alert("Please enter numeric values only");
		frm.price_per_sf.focus();
		return false;
	}
	//pricefscompleteset
	var newFSCom_set = no_of_plans * size * price_per_sf;
	
		var newPR_FS_C = newFSCom_set * 0.01 ;
		frm.pricefscompleteset.value = newPR_FS_C.toFixed(2);
			
	
	//frm.pricefscompleteset.value 
	//alert('pricefscompleteset='+frm.pricefscompleteset.value);
	//pricehscompleteset
			var newHS_COM_set= frm.pricefscompleteset.value / 2 ;
		//frm.pricehscompleteset.value = newHS_COM_set.toFixed(2);
		
	
	if(isNaN(frm.pricefspartials.value))
	{
		alert("Please enter numeric values only");
		frm.pricefspartials.focus();
		return false;
	}
	//price hs partials
	var newFS_PaR_val= size * 0.15 ;
//frm.pricefspartials.value = newFS_PaR_val.toFixed(2);
var pfsspan= newFS_PaR_val.toFixed(2);

	//alert('pricefspartials'+frm.pricefspartials.value);
	var newhS_Par_val= pfsspan / 2 ;	
	//frm.pricehspartials.value = newhS_Par_val.toFixed(2);
//alert(frm.pricehspartials.value);
noofspecifications = frm.noofspecifications.value;
	if(isNaN(frm.noofspecifications.value))
	{
		alert("Please enter numeric values only");
		frm.noofspecifications.focus();
		return false;
	}
	
	price_per_spec_page =  frm.price_per_spec_page.value;

	if(isNaN(frm.price_per_spec_page.value))
	{
		alert("Please enter numeric values only");
		frm.price_per_spec_page.focus();
		return false;
	}

	pricespecscompleteset =  noofspecifications * price_per_spec_page * 0.01;	
	if(noofspecifications == 0)
	{
			frm.pricespecscompleteset.value = 0;
	}
	else
	{
		
				frm.pricespecscompleteset.value = pricespecscompleteset.toFixed(2);
			
	}
	


}


function TotalAmount()
{	
	
	//Bill firstname
	var battention=document.orderfrm.billingfirstname.value;
	if (Trim(battention)=="")
	{
		alert("Please enter Attention Name!");
		document.orderfrm.billingfirstname.focus();
		return false;
	}
	//Bill last name
/*	var billinglastname=document.orderfrm.billinglastname.value;
	if (Trim(billinglastname)=="")
	{
		alert("Please enter Last Name!");
		document.orderfrm.billinglastname.focus();
		return false;
	}
*/
//Company 
	var bname=document.orderfrm.BillName1.value;
	if (Trim(bname)=="")
	{
		alert("Please enter Company Name!");
		document.orderfrm.BillName1.focus();
		return false;
	}
	
	//Bill Address1
	var badd1=document.orderfrm.Address1.value;
	if (Trim(badd1)=="")
	{
		alert("Please enter Bill Address 1");
		document.orderfrm.Address1.focus();
		return false;
	}
	//Bill Address2
	/*var badd2=document.orderfrm.Address2.value;
	if (Trim(badd2)=="")
	{
		alert("Please enter Bill Address 2");
		document.orderfrm.Address2.focus();
		return false;
	}*/
	//Bill City1
	var bcity=document.orderfrm.City1.value;
	if (Trim(bcity)=="")
	{
		alert("Please enter Bill City");
		document.orderfrm.City1.focus();
		return false;
	}
	
	
	//Bill zip start
	var bzip=document.orderfrm.Zip1.value;
	if (Trim(bzip)=="")
	{
		alert("Please enter Zip!");
		document.orderfrm.Zip1.focus();
		return false;
	}
	if (isNaN(bzip))
	{
		alert("Please enter Valid Zipcode!");
		document.orderfrm.Zip1.focus();
		return false;
	}
	if(bzip.length<3)
	{
		alert("Zip Should be mininum 3 characters");
		document.orderfrm.Zip1.focus();
		return false;
	}
	document.orderfrm.Zip1.value = Trim(bzip);
	
	
		//Bill zip end
		
	// Bill Telephone1 start
	var bphone=document.orderfrm.Telephone1.value;
	if(Trim(bphone)=="")
	{
		alert("Please enter Phone!");
		document.orderfrm.Telephone1.focus();
		return false;
	}
//	if (isNaN(frm.billingphone.value))
	if(!(bphone.match(/^[0-9-]+$/)))
	{
		alert("Please enter Valid Phone Number!");
		document.orderfrm.Telephone1.focus();
		return false;
	}
	if(bphone.length < 10)
	{
		alert("Phone number should have 10 characters!");
		document.orderfrm.Telephone1.focus();
		return false;
	}
	document.orderfrm.Telephone1.value = Trim(bphone);
	document.orderfrm.Telephone1.focus();
	// Bill Telephone1 end
	
	 /*------------------------------------------Fax Validation-------------*/
	var bfax=document.orderfrm.Fax1.value;
	if (bfax !="")
	{
		if(!(bfax.match(/^[0-9-]+$/)))
		{					   
		alert("Please enter valid Fax Number!");
		document.orderfrm.Fax1.focus();
		return false;
		}
		if(bfax.length < 10)
		{
			alert("Fax Number should have 10 characters!");
			document.orderfrm.Fax1.focus();
			return false;
		}
		document.orderfrm.Fax1.value = Trim(bfax);
		document.orderfrm.Fax1.focus();
	}
	
	//Email Validation for bill
	if (!validate_emailaddress(document.orderfrm.Email1.value,true,false))
	{
		alert("Please enter valid Email Address!");
		document.orderfrm.Email1.focus();
		return false;
	}
	if (!validate_emailaddress(document.orderfrm.Email2.value,true,false))
	{
		alert("Please enter valid Email Address!");
		document.orderfrm.Email2.focus();
		return false;
	}
	
	if(document.orderfrm.TotalOrderAmount.value == 0)
	{
	alert("Calculate Order Amount");
	document.orderfrm.Calculate.focus();
	return false;
	}
//	return testCreditCard();


	//Ship firstname
	var sattention=document.orderfrm.shippingfirstname.value;
	if (Trim(sattention)=="")
	{
		alert("Please enter Attention Name!");
		document.orderfrm.shippingfirstname.focus();
		return false;
	}
//Ship lastname
/*
	var sshippinglastname=document.orderfrm.shippinglastname.value;
	if (Trim(sshippinglastname)=="")
	{
		alert("Please enter Last Name!");
		document.orderfrm.shippinglastname.focus();
		return false;
	}
*?
//Ship Name
	var sname=document.orderfrm.ShipName2.value;
	if (Trim(sname)=="")
	{
		alert("Please enter Company Name!");
		document.orderfrm.ShipName2.focus();
		return false;
	}
	//Ship Address1
	var sadd1=document.orderfrm.ShipAddress1.value;
	if (Trim(sadd1)=="")
	{
		alert("Please enter Ship Address 1");
		document.orderfrm.ShipAddress1.focus();
		return false;
	}
	//Ship Address2
	/*var sadd2=document.orderfrm.ShipAddress2.value;
	if (Trim(sadd2)=="")
	{
		alert("Please enter Ship Address 2");
		document.orderfrm.ShipAddress2.focus();
		return false;
	}*/
	//Ship City1
	var scity=document.orderfrm.City2.value;
	if (Trim(scity)=="")
	{
		alert("Please enter Ship City");
		document.orderfrm.City2.focus();
		return false;
	}
	

	
	//Ship zip start
	var szip=document.orderfrm.Zip2.value;
	if (Trim(szip)=="")
	{
		alert("Please enter Zip!");
		document.orderfrm.Zip2.focus();
		return false;
	}
	if (isNaN(szip))
	{
		alert("Please enter Valid Zipcode!");
		document.orderfrm.Zip2.focus();
		return false;
	}
	if(szip.length<3)
	{
		alert("Zip Should be mininum 3 characters");
		document.orderfrm.Zip2.focus();
		return false;
	}
	document.orderfrm.Zip2.value = Trim(szip);
	document.orderfrm.Zip2.focus();
	
		//Ship zip end
		
	// Ship Telephone1 start
	var sphone=document.orderfrm.Telephone2.value;
	if(Trim(sphone)=="")
	{
		alert("Please enter Phone!");
		document.orderfrm.Telephone2.focus();
		return false;
	}
//	if (isNaN(frm.billingphone.value))
	if(!(sphone.match(/^[0-9-]+$/)))
	{
		alert("Please enter Valid Phone Number!");
		document.orderfrm.Telephone2.focus();
		return false;
	}
	if(sphone.length < 10)
	{
		alert("Phone number Should have 10 characters!");
		document.orderfrm.Telephone2.focus();
		return false;
	}
	document.orderfrm.Telephone2.value = Trim(sphone);
	document.orderfrm.Telephone2.focus();
	// Ship Telephone1 end
	
	 /*------------------------------------------Fax Validation-------------*/
	var sfax=document.orderfrm.Fax2.value;
	if (sfax !="")
	{
		if(!(sfax.match(/^[0-9-]+$/)))
		{					   
		alert("Please enter valid Fax Number!");
		document.orderfrm.Fax2.focus();
		return false;
		}
			if(sfax.length < 10)
			{
				alert("Fax number Should have 10 characters!");
				document.orderfrm.Fax2.focus();
				return false;
			}
		document.orderfrm.Fax2.value = Trim(sfax);
	}	document.orderfrm.Fax2.focus();
	
//		return true;
			//credit card
	if(!((document.orderfrm.payment_via.value == "ApprovedAccount") || (document.orderfrm.payment_via.value == "CompanyChe")))
	{
		if(document.orderfrm.card_no.value == "")
		{
		alert("Please enter Credit Card Number");
		document.orderfrm.card_no.focus();
		return false;
		}
		if(document.orderfrm.card_no.value.length < 11)
		{
			alert("Please enter valid Credit Card Number");
			document.orderfrm.card_no.focus();
			return false;
		}
		if(!(document.orderfrm.card_no.value.match(/^[0-9]+$/)))
		{
		alert("Please enter valid Credit Card Number");
		document.orderfrm.card_no.focus();
		return false;
		}
		
		if(document.orderfrm.month.value == "month")
		{
		alert("Please select new Month");
		document.orderfrm.month.focus();
		return false;
		}
		if(document.orderfrm.year.value == "year")
		{
		alert("Please select new Year");
		document.orderfrm.year.focus();
		return false;
		}
	}
	
}
