// JavaScript Document

//function for popup window
function popupmenus(url)
{
	width=screen.width;
	//height=screen.height;
	center=width/2;
	//center1=height/2;
	leftpos=center-244;
	//toppos=center1-150;
	newwindow=window.open(url,'ImageDisplay','height=700,width=500,left='+leftpos+',top=0,resizable=yes,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

//Reservation form script
function reservevalidate()
{	
	if(document.reserve.email.value == "")
	{
		alert("Please enter the Email Address");
		document.reserve.email.focus();
		return false;
	}
	if (!validateEmail(document.reserve.email.value,1,1)) 
	 {
	 document.reserve.email.focus();
	 return false;
	 }
	 if(document.reserve.name.value == "")
	{
		alert("Please enter the Name");
		document.reserve.name.focus();
		return false;
	}
	if(document.reserve.address.value == "")
	{
		alert("Please enter the Address");
		document.reserve.address.focus();
		return false;
	}
	if(document.reserve.zipcode.value == "")
	{
		alert("Please enter the Zipcode");
		document.reserve.zipcode.focus();
		return false;
	}
	if(document.reserve.phone.value == "")
	{
		alert("Please enter the Phone");
		document.reserve.phone.focus();
		return false;
	}
	if(document.reserve.servicetype.value == "")
	{
		alert("Please enter the Service Type");
		document.reserve.servicetype.focus();
		return false;
	}
	if(document.reserve.food.value == "")
	{
		alert("Please enter the Food Options");
		document.reserve.food.focus();
		return false;
	}
	if(document.reserve.services.value == "")
	{
		alert("Please enter the Services");
		document.reserve.services.focus();
		return false;
	}
	if(document.reserve.moreservices.value == "")
	{
		alert("Please enter the More Services");
		document.reserve.moreservices.focus();
		return false;
	}
	if(document.reserve.dtstart.value == "")
	{
		alert("Please enter the Reservation start date");
		document.reserve.dtstart.focus();
		return false;
	}
	if(document.reserve.chkintime.value == "")
	{
		alert("Please enter the Check in Time");
		document.reserve.chkintime.focus();
		return false;
	}
	if(document.reserve.dtEnd.value == "")
	{
		alert("Please enter the Reservation end date");
		document.reserve.dtEnd.focus();
		return false;
	}
	if(document.reserve.chkouttime.value == "")
	{
		alert("Please enter the Check out Time");
		document.reserve.chkouttime.focus();
		return false;
	}
	if(document.reserve.paymethod.value == "")
	{
		alert("Please enter the Payment Method");
		document.reserve.paymethod.focus();
		return false;
	}
	if(document.reserve.confirmemail.value == "")
	{
		alert("Please enter the Email Address");
		document.reserve.confirmemail.focus();
		return false;
	}
	
	
}
//End script of Reservation Application

//Franchise Application
function applicationvalidate()
{	
	if(document.application.email.value == "")
	{
		alert("Please enter the Email Address");
		document.application.email.focus();
		return false;
	}
	if (!validateEmail(document.application.email.value,1,1)) 
	 {
	 document.application.email.focus();
	 return false;
	 }
	if(document.application.name.value == "")
	{
		alert("Please enter Your First and Last Name");
		document.application.name.focus();
		return false;
	}
	if(document.application.securityno.value == "")
	{
		alert("Please enter the Social Security Number");
		document.application.securityno.focus();
		return false;
	}
	if(document.application.street.value == "")
	{
		alert("Please enter the Street Address");
		document.application.street.focus();
		return false;
	}
	if(document.application.city.value == "")
	{
		alert("Please enter the city,state and zip");
		document.application.city.focus();
		return false;
	}
	if(document.application.length.value == "")
	{
		alert("Please enter the Length at address");
		document.application.length.focus();
		return false;
	}	
	if(document.application.income.value == "")
	{
		alert("Please enter the Annual Income");
		document.application.income.focus();
		return false;
	}	
	if(document.application.crime.value == "")
	{
		alert("Please enter Your Crime");
		document.application.crime.focus();
		return false;
	}
	if(document.application.reference1.value == "")
	{
		alert("Please enter the Reference One");
		document.application.reference1.focus();
		return false;
	}
	if(document.application.reference2.value == "")
	{
		alert("Please enter the Reference Two");
		document.application.reference2.focus();
		return false;
	}
	if(document.application.reference3.value == "")
	{
		alert("Please enter the Reference Three");
		document.application.reference3.focus();
		return false;
	}
	if(document.application.franchise.value == "")
	{
		alert("Please enter the state of why you want to own franchise");
		document.application.franchise.focus();
		return false;
	}
	if(document.application.experience.value == "")
	{
		alert("Please enter the Experience");
		document.application.experience.focus();
		return false;
	}
	if(document.application.barriers.value == "")
	{
		alert("Please enter the Barriers explain details");
		document.application.barriers.focus();
		return false;
	}
	if(document.application.franchiseowner.value == "")
	{
		alert("Please enter the enter the details for Franchise Ownership");
		document.application.franchiseowner.focus();
		return false;
	}
	if(document.application.bus_mgnt.value == "")
	{
		alert("Please enter the Business Managment and Ownership Experience");
		document.application.bus_mgnt.focus();
		return false;
	}
	if(document.application.franchisegoals.value == "")
	{
		alert("Please enter the Franchise Related Goals");
		document.application.franchisegoals.focus();
		return false;
	}
	if(document.application.mgntstyle.value == "")
	{
		alert("Please enter the Management Style");
		document.application.mgntstyle.focus();
		return false;
	}
	if(document.application.bus_prepare.value == "")
	{
		alert("Please enter the own business Preparation");
		document.application.bus_prepare.focus();
		return false;
	}
	if(document.application.funds.value == "")
	{
		alert("Please enter the Secure Funds");
		document.application.funds.focus();
		return false;
	}
	if(document.application.greatsupport.value == "")
	{
		alert("Please enter the Great Support of the your own business");
		document.application.greatsupport.focus();
		return false;
	}
	if(document.application.philosophy.value == "")
	{
		alert("Please enter the Philosophy");
		document.application.philosophy.focus();
		return false;
	}
	if(document.application.email2.value == "")
	{
		alert("Please enter the Email Address");
		document.application.email2.focus();
		return false;
	}
	
	if (!validateEmail(document.application.email2.value,1,1)) 
	 {
	 document.application.email2.focus();
	 return false;
	 }
	if(document.application.homephone.value == "")
	{
		alert("Please enter the Home Phone Number");
		document.application.homephone.focus();
		return false;
	}
}
//End script of Franchise Application

//Contactus Validation.
function contactus_validation()
{
	if(document.contact_frm.fullname.value == "")
	{
		alert("Please enter the Name");
		document.contact_frm.fullname.focus();
		return false;
	}
	if(document.contact_frm.phone.value == "")
	{
		alert("Please enter the Phone Numeber");
		document.contact_frm.phone.focus();
		return false;
	}
	if(isNaN(document.contact_frm.phone.value))
	{
		alert("Phone Number Must be Numeric");
		document.contact_frm.phone.focus();
		return false;
	}
	if(document.contact_frm.email.value == "")
	{
		alert("Please enter the Email Address");
		document.contact_frm.email.focus();
		return false;
	}
	
	if (!validateEmail(document.contact_frm.email.value,1,1)) 
	 {
	 document.contact_frm.email.focus();
	 return false;
	 }

	if(document.contact_frm.comment.value == "")
	{
		alert("Please enter Your Comments");
		document.contact_frm.comment.focus();
		return false;
	}

}
//End script of Contactus Validation.

//Ourteam validation.
function ourteam_validation()
{
	if(document.ourteam_frm.email_addy.value == "")
	{
		alert("Please enter the Email Address");
		document.ourteam_frm.email_addy.focus();
		return false;
	}
	
	if (!validateEmail(document.ourteam_frm.email_addy.value,1,1)) 
	 {
	 document.ourteam_frm.email_addy.focus();
	 return false;
	 }
	if(document.ourteam_frm.f108.value == "")
	{
		alert("Please enter the Name");
		document.ourteam_frm.f108.focus();
		return false;
	}
	if(document.ourteam_frm.f109.value == "")
	{
		alert("Please enter the Phone Numeber");
		document.ourteam_frm.f109.focus();
		return false;
	}
	if(isNaN(document.ourteam_frm.f109.value))
	{
		alert("Phone Number Must be Numeric");
		document.ourteam_frm.f109.focus();
		return false;
	}
	if(document.ourteam_frm.f110.value == "")
	{
		alert("Please enter the Comments");
		document.ourteam_frm.f110.focus();
		return false;
	}
}
//End script of Ourteam validation


//TESTIMONIALS
function testimonialvalidate()
{
	
	 	if(document.testimonial.email.value == "")
	{
		alert("Please enter the Email Address");
		document.testimonial.email.focus();
		return false;
	}
	if (!validateEmail(document.testimonial.email.value,1,1)) 
	 {
	 document.testimonial.email.focus();
	 return false;
	 }
	 	if(document.testimonial.comments.value == "")
	{
		alert("Please enter the text");
		document.testimonial.comments.focus();
		return false;
	}
	
}

function check() 
    {    
	 document.viewcartform.action="checkout.php";
	 document.viewcartform.submit();
    }
	
function callcheck()
{
//alert(document.chkout.varFName.value);
	if(document.chkout.ShipAddress.checked)
	{
	document.chkout.varShipFName.value= document.chkout.varFName.value;
	document.chkout.varShipLName.value= document.chkout.varLName.value;
	document.chkout.varShipEmail.value= document.chkout.varEmail.value;
	document.chkout.varShipAddress.value= document.chkout.varAddress.value;
	document.chkout.varShipCity.value= document.chkout.varCity.value;
	document.chkout.varShipZip.value= document.chkout.varZip.value;
	document.chkout.txtShipCountry.value= document.chkout.txtCountry.value;
	document.chkout.varShipPhone.value= document.chkout.varPhone.value;
	}
	else
	{
	document.chkout.varShipFName.value= "";
	document.chkout.varShipLName.value= "";
	document.chkout.varShipEmail.value= "";
	document.chkout.varShipAddress.value= "";
	document.chkout.varShipCity.value= "";
	document.chkout.varShipZip.value= "";
	document.chkout.txtShipCountry.value= "";
	document.chkout.varShipPhone.value= "";
	}
}

// COUPONCODE VALIDATION ADDFORM and EDIT FORM
function codevalidate()
{
	alert(ok);	 
	var code= document.code.couponcode.value;
		 if (code== "" )
		 { 
		 
			 alert ("Please enter the Coupon Code");
			 document.code.couponcode.focus();
			 return false;
		 }		 
}
// END COUPONCODE VALIDATION

function checkout_validate()
{
	
	 	if(document.chkout.varFName.value == "")
	{
		alert("Please enter the Firstname");
		document.chkout.varFName.focus();
		return false;
	}
	 	if(document.chkout.varLName.value == "")
	{
		alert("Please enter the Lastname");
		document.chkout.varLName.focus();
		return false;
	}
	 	if(document.chkout.varEmail.value == "")
	{
		alert("Please enter the Email Address");
		document.chkout.varEmail.focus();
		return false;
	}
	 if (!validateEmail(document.chkout.varEmail.value,1,1)) 
		 {
		 document.chkout.varEmail.focus();
		 return false;
		 }		
	if(document.chkout.varAddress.value == "")
	{
		alert("Please enter the Address");
		document.chkout.varAddress.focus();
		return false;
	}
	if(document.chkout.varCity.value == "")
	{
		alert("Please enter the  City");
		document.chkout.varCity.focus();
		return false;
	}
		if(document.chkout.varZip.value =="")
	{
		alert("Please enter the zipcode");
		document.chkout.varZip.focus();
		return false;
	}	
	 	if(isNaN(document.chkout.varZip.value))
	{
		alert("Please Zipcode Must ber Numeric");
		document.chkout.varZip.focus();
		return false;
	}
	if(document.chkout.txtCountry.value == "Choose")
	{
		alert("Please enter the State");
		document.chkout.txtCountry.focus();
		return false;
	}
	if (document.chkout.varPhone.value == "") 
	{
		alert("Enter the  phone number");
		document.chkout.varPhone.focus();
		return false;
	} 
	 if (isNaN(document.chkout.varPhone.value)) 
	{
		alert("Phone Number Must be Numeric");
		document.chkout.varPhone1.focus();
		return false;
	}
				
				
				
	if(document.chkout.varShipFName.value == "")
	{
		alert("Please enter the  Shipping First Name");
		document.chkout.varShipFName.focus();
		return false;
	}
	
	 	if(document.chkout.varShipLName.value == "")
	{
		alert("Please enter the Lastname");
		document.chkout.varShipLName.focus();
		return false;
	}
	 	if(document.chkout.varShipEmail.value == "")
	{
		alert("Please enter the Shipping Email Address");
		document.chkout.varShipEmail.focus();
		return false;
	}
	 if (!validateEmail(document.chkout.varShipEmail.value,1,1)) 
		 {
		 document.chkout.varShipEmail.focus();
		 return false;
		 }		
	if(document.chkout.varShipAddress.value == "")
	{
		alert("Please enter the Shipping Address");
		document.chkout.varShipAddress.focus();
		return false;
	}
	if(document.chkout.varShipCity.value == "")
	{
		alert("Please enter the  City");
		document.chkout.varShipCity.focus();
		return false;
	}
		if(document.chkout.varShipZip.value =="")
	{
		alert("Please enter the zipcode");
		document.chkout.varShipZip.focus();
		return false;
	}	
	 	if(isNaN(document.chkout.varShipZip.value))
	{
		alert("Please Zipcode Must ber Numeric");
		document.chkout.varShipZip.focus();
		return false;
	}
	if(document.chkout.txtShipCountry.value == "Choose")
	{
		alert("Please enter the State");
		document.chkout.txtShipCountry.focus();
		return false;
	}
	
	if (document.chkout.varShipPhone.value == "") 
	{
		alert("Enter the  phone number");
		document.chkout.varShipPhone.focus();
		return false;
	} 
	 if (isNaN(document.chkout.varShipPhone.value))
	{
		alert("Phone Number Must be Numeric");
		document.chkout.varShipPhone.focus();
		return false;
	}
	/*if (document.chkout.NameonCard.value == "") {
		alert ("Name on Card must be required");
		document.chkout.NameonCard.focus();
		return false;
	}
	
	if (document.chkout.Cardnum1.value == "" || document.chkout.Cardnum2.value == "" || document.chkout.Cardnum3.value == "" || document.chkout.Cardnum4.value == "") {
		alert ("Credit card number must be required");
		document.chkout.Cardnum1.focus();
		return false;
	}*/
	if (document.chkout.txtComments.value == "") 
	{
		alert("Enter the  Comments");
		document.chkout.txtComments.focus();
		return false;
	} 
}

	function dsMoveNext(dsObj, dsLength) {
		if (dsObj.value.length >= dsLength) {
			for (i = 0; i < chkout.elements.length; i++) {
				if(dsObj == chkout.elements[i]) {
					chkout.elements[i+1].focus();
					break;
				}
			}
		}
	}

function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}
	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}


function confirmMsg(msg)
{
	if(!confirm(msg))
	 {
		 return false;
	 }
	 else
	 {
		window.location.href="login.php";
		return false;
	 }
}
//CONTACT FORM VALIDATION

function contact()
{
		 var fname= document.contactfrm.Name.value;
		 if (fname== "" )
		 { 
			 alert ("Please enter Your Name");
			 document.contactfrm.Name.focus();
			 return false;
		 }
		  var Email= document.contactfrm.Email.value;
		 if (Email== "" )
		 { 
			 alert ("Please enter Your Email Address");
			 document.contactfrm.Email.focus();
			 return false;
		 }
		 if (!validateEmail(document.contactfrm.Email.value,1,1)) 
		 {
		 document.contactfrm.Email.focus();
		 return false;
		 }		
		 var Company= document.contactfrm.Company.value;
		 if (Company== "" )
		 { 
			 alert ("Please enter Your Company Name");
			 document.contactfrm.Company.focus();
			 return false;
		 }
		  var Phone= document.contactfrm.Phone.value;
		 if (Phone== "" )
		 { 
			 alert ("Please enter Your Phone Number");
			 document.contactfrm.Phone.focus();
			 return false;
		 }		 
		 var Message= document.contactfrm.Message.value;
		 if (Message== "" )
		 { 
			 alert ("Please enter Your Project Description");
			 document.contactfrm.Message.focus();
			 return false;
		 }
		 
}		 
//END CONTACT FORM  VALIDATION

function quotevalidate()
{
		 var fname= document.quote_frm.FirstName.value;
		 if (fname== "" )
		 { 
			 alert ("Please enter Your FirstName");
			 document.quote_frm.FirstName.focus();
			 return false;
		 }
		 var lname= document.quote_frm.LastName.value;
		 if (lname== "" )
		 { 
			 alert ("Please enter Your LastName");
			 document.quote_frm.LastName.focus();
			 return false;
		 }
		 var Country= document.quote_frm.Country.value;
		 if (Country== "Choose" )
		 { 
			 alert ("Please select Your Country Name");
			 document.quote_frm.Country.focus();
			 return false;
		 }
		 var Company= document.quote_frm.Company.value;
		 if (Company== "" )
		 { 
			 alert ("Please enter Your Company Name");
			 document.quote_frm.Company.focus();
			 return false;
		 }
		  var Phone= document.quote_frm.Phone.value;
		 if (Phone== "" )
		 { 
			 alert ("Please enter Your Phone Number");
			 document.quote_frm.Phone.focus();
			 return false;
		 }
		 if (isNaN(document.quote_frm.Phone.value))
		 { 
			 alert ("Phone Number must be Numeric");
			 document.quote_frm.Phone.focus();
			 return false;
		 }
		  var Email= document.quote_frm.Email.value;
		 if (Email== "" )
		 { 
			 alert ("Please enter Your Email Address");
			 document.quote_frm.Email.focus();
			 return false;
		 }
		 if (!validateEmail(document.quote_frm.Email.value,1,1)) 
		 {
		 document.quote_frm.Email.focus();
		 return false;
		 }
		 var Message= document.quote_frm.Message.value;
		 if (Message== "" )
		 { 
			 alert ("Please enter Your Project Description");
			 document.quote_frm.Message.focus();
			 return false;
		 }
		 
}		 
//END QUOTE VALIDATION

//CLIENTS REG VALIDATION
function clients()
{
		 var fname= document.client_frm.FirstName.value;
		 if (fname== "" )
		 { 
			 alert ("Please enter Your FirstName");
			 document.client_frm.FirstName.focus();
			 return false;
		 }
		 var lname= document.client_frm.LastName.value;
		 if (lname== "" )
		 { 
			 alert ("Please enter Your LastName");
			 document.client_frm.LastName.focus();
			 return false;
		 }
		 var Country= document.client_frm.Country.value;
		 if (Country== "Choose" )
		 { 
			 alert ("Please select Your Country Name");
			 document.client_frm.Country.focus();
			 return false;
		 }
		 var Company= document.client_frm.Company.value;
		 if (Company== "" )
		 { 
			 alert ("Please enter Your Company Name");
			 document.client_frm.Company.focus();
			 return false;
		 }
		  var Phone= document.client_frm.Phone.value;
		 if (Phone== "" )
		 { 
			 alert ("Please enter Your Phone Number");
			 document.client_frm.Phone.focus();
			 return false;
		 }
		 if (isNaN(document.client_frm.Phone.value))
		 { 
			 alert ("Phone Number must be Numeric");
			 document.client_frm.Phone.focus();
			 return false;
		 }
		  var Email= document.client_frm.Email.value;
		 if (Email== "" )
		 { 
			 alert ("Please enter Your Email Address");
			 document.client_frm.Email.focus();
			 return false;
		 }
		 if (!validateEmail(document.client_frm.Email.value,1,1)) 
		 {
		 document.client_frm.Email.focus();
		 return false;
		 }
		 var Message= document.client_frm.Message.value;
		 if (Message== "" )
		 { 
			 alert ("Please enter the details for arrange clientings");
			 document.client_frm.Message.focus();
			 return false;
		 }
		 
}		 
//END CLIENTS REG VALIDATION

function login_validation()
{
	//alert();
	var user = document.login.varUsername.value;
	if( user == "" )
	{
		alert("Please enter the Username");
		document.login.varUsername.focus();
		return false;
	}
	var pass = document.login.varPassword.value;
	if( pass == "" )
	{
		alert("Please enter the Password");
		document.login.varPassword.focus();
		return false;
	}
}

function opencart(rows)
{
	   if(rows == 1)
	   {
			quantity = document.viewcartform.ONE.value;
			stockvalue = document.viewcartform.ROWS.value;
				if( (quantity == ""))
				{
					alert("Type the valid quantity");
						document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
						return false;
				}
				else if((quantity == 0))
				{
					alert("Type the valid quantity");
						document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
						return false;
				}
				
				else if(isNaN(quantity))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
							return false;
				}
				else if((quantity.indexOf("-") >= 0))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
							return false;
				}
				else if((quantity.indexOf(".") >= 0))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
							return false;
				}
				else if((quantity > 65535))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE.focus();
						document.viewcartform.ONE.value=document.viewcartform.ROWS.value;
							return false;
				}				
	   }
		   else
		   {
			   var flag=0;
		  	for(var index=0;index<rows;index++)
			{
			quantity = document.viewcartform.ONE[index].value;
			stockvalue = document.viewcartform.ROWS[index].value;			
				if( (quantity == ""))
				{
					alert("Type the valid quantity");
						document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
						return false;
				}
				else if((quantity == 0))
				{
					alert("Type the valid quantity");
						document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
						return false;
				}
				
				else if(isNaN(quantity))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
							return false;
				}
				else if((quantity.indexOf("-") >= 0))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
							return false;
				}
				else if((quantity.indexOf(".") >= 0))
				{
					alert("Type the valid quantity");
							document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
							return false;
				}
				else if((quantity > 65535))
				{
						alert("Type the valid quantity");
						document.viewcartform.ONE[index].focus();
						document.viewcartform.ONE[index].value=document.viewcartform.ROWS[index].value;
						return false;
				}			
						
			}
		   }
}

// Valid Email  Script
function validateEmail(addr,man,db) {
	if (addr == '' && man) {
	   if (db) alert('Email address is mandatory');
	   return false;
	}
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
	   if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		  if (db) alert('Email address contains invalid characters');
		  return false;
	   }
	}
	for (i=0; i<addr.length; i++) {
	   if (addr.charCodeAt(i)>127) {
		  if (db) alert("Email address contains non ascii characters.");
		  return false;
	   }
	}
	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
	   if (db) alert('Email address must contain an @');
	   return false;
	}
	if (atPos == 0) {
	   if (db) alert('Email address must not start with @');
	   return false;
	}
	if (addr.indexOf('@', atPos + 1) > - 1) {
	   if (db) alert('Email address must contain only one @');
	   return false;
	}
	if (addr.indexOf('.', atPos) == -1) {
	   if (db) alert('Email address must contain a period in the domain name');
	   return false;
	}
	if (addr.indexOf('@.',0) != -1) {
	   if (db) alert('period must not immediately follow @ in email address');
	   return false;
	}
	if (addr.indexOf('.@',0) != -1){
	   if (db) alert('period must not immediately precede @ in email address');
	   return false;
	}
	if (addr.indexOf('..',0) != -1) {
	   if (db) alert('two periods must not be adjacent in email address');
	   return false;
	}
	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	   if (db) alert('invalid primary domain in email address');
	   return false;
	}
return true;
}
 //Function phone validation Script
// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()-. ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function contactvalidation(){
	 var first= document.contact.firstname.value;
		 if (first== "" )
		 { 
			 alert ("Please enter Your First Name");
			 document.contact.firstname.focus();
			 return false;
		 }
		  var lastname= document.contact.lastname.value;
		 if (lastname== "" )
		 { 
			 alert ("Please enter Your Last name");
			 document.contact.lastname.focus();
			 return false;
		 }
	   var Email= document.contact.email.value;
		 if (Email== "" )
		 { 
			 alert ("Please enter Your Email Address");
			 document.contact.email.focus();
			 return false;
		 }
		 if (!validateEmail(document.contact.email.value,1,1)) 
		 {
		 document.contact.email.focus();
		 return false;
		 }
		  var hear= document.contact.hear.value;
		 if (Message== "" )
		 { 
			 alert ("Please enter How did you hear about us");
			 document.contact.hear.focus();
			 return false;
		 }
	 var Phone= document.contact.phone.value;
		 if (Phone== "" )
		 { 
			 alert ("Please enter Your Phone Number");
			 document.contact.phone.focus();
			 return false;
		 }
		 if (isNaN(document.contact.phone.value))
		 { 
			 alert ("Phone Number must be Numeric");
			 document.contact.phone.focus();
			 return false;
		 }
		
		 var Message= document.contact.comments.value;
		 if (Message== "" )
		 { 
			 alert ("Please enter YourComments");
			 document.contact.comments.focus();
			 return false;
		 }
}

