//this is for change pwd
function pass_validate()
{
	
	     var Old = document.frm_change.Old.value;
		 if (Old == "" )
		 { 
			 alert ("Please enter Your Old Password");
			 document.frm_change.Old.focus();
			 return false;
		 }
		 var Password = document.frm_change.Password.value;
		 if (Password == "" )
		 { 
			 alert ("Please enter Your New Password");
			 document.frm_change.Password.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword.value;
		 if (Conpassword == "" )
		 { 
			 alert ("Please enter Your Confirm Password");
			 document.frm_change.Conpassword.focus();
			 return false;
		 }
		 var Conpassword = document.frm_change.Conpassword.value;
		 if (document.frm_change.Conpassword.value != document.frm_change.Password.value)
		 { 
			 alert ("Paasword and Confirm Password must be same");
			 document.frm_change.Conpassword.focus();
			 return false;
		 }
}


//Edit profile
function member_validation1()
{
var firstname=document.member_frm1.txtFirstname.value;
if(firstname=="")
{
alert("Please enter the First Name");
document.member_frm1.txtFirstname.focus();
return false;
}
var lastname=document.member_frm1.txtLastname.value;
if(lastname=="")
{
alert("Please enter the Last Name");
document.member_frm1.txtLastname.focus();
return false;
}
var email=document.member_frm1.txtEmail.value;
if(email=="")
{
alert("Please enter the Email ID");
document.member_frm1.txtEmail.focus();
return false;
}

 if (!validateEmail(document.member_frm1.txtEmail.value,1,1)) 
	 {
	 document.member_frm1.txtEmail.focus();
	 return false;
	 }
var address1=document.member_frm1.txtAddress1.value;
if(address1=="")
{
alert("Please enter the Address1");
document.member_frm1.txtAddress1.focus();
return false;
}
var city=document.member_frm1.txtCity.value;
if(city=="")
{
alert("Please enter the City");
document.member_frm1.txtCity.focus();
return false;
}
var state=document.member_frm1.txtState.value;
if(state=="")
{
alert("Please enter the State");
document.member_frm1.txtState.focus();
return false;
}
var postcode=document.member_frm1.intPostcode.value;
if(postcode=="")
{
alert("Please enter the Postcode");
document.member_frm1.intPostcode.focus();
return false;
}
 if (isNaN(document.member_frm1.intPostcode.value))
    { 
	   alert ("No of Postcode must be Numeric");
	   document.member_frm1.intPostcode.focus();
	   return false;
	}
var telephone=document.member_frm1.intTelephone.value;
if(telephone=="")
{
alert("Please enter the Telephone");
document.member_frm1.intTelephone.focus();
return false;
}
 if (isNaN(document.member_frm1.intTelephone.value))
    { 
	   alert ("No of Telephone must be Numeric");
	   document.member_frm1.intTelephone.focus();
	   return false;
	}
var username=document.member_frm1.txtUsername.value;
if(username=="")
{
alert("Please enter the Username");
document.member_frm1.txtUsername.focus();
return false;
}
var password=document.member_frm1.txtPassword.value;
if(password=="")
{
alert("Please enter the Password");
document.member_frm1.txtPassword.focus();
return false;
}
}

//This is for comments
function commentsvalidate()
{
	var varComments=document.commentsfrm.varComments.value;
	if(varComments=="")
	{
		alert("Please enter  your comments");
		document.commentsfrm.varComments.focus();
		return false;
	}
}

function calldel(m)
{
  if(!confirm(m))
  {
    return false;
  }
  else
  return true;
}
function login_validation()
{	
	 var txtUsername = document.Login.txtUsername.value;
	 if (txtUsername == "" )
	 { 
	 alert ("Please enter the  User Name");
	 document.Login.txtUsername.focus();
	 return false;
	 }
	
	var txtPassword = document.Login.txtPassword.value;
	 if (txtPassword == "" )
	 { 
	 alert ("Please enter the  Password");
	 document.Login.txtPassword.focus();
	 return false;
	 }
}


/*
function member_reg()
{	
	var firstname = document.CustomersForm.firstname.value;
	 if (firstname == "" )
	 { 
	 alert ("Please enter the First Name");
	 document.CustomersForm.firstname.focus();
	 return false;
	 }
	 var lastname = document.CustomersForm.lastname.value; 
	 if (lastname == "")
	 { 
	 alert ("Please enter the Last Name");
	 document.CustomersForm.lastname.focus();
	 return false;
	 }
	 var address = document.CustomersForm.address.value; 
	 if (address == "")
	 { 
	 alert ("Please enter the Address1");
	 document.CustomersForm.address.focus();
	 return false;
	 }
	  var city = document.CustomersForm.city.value; 
	 if (city == "")
	 { 
	 alert ("Please enter the City");
	 document.CustomersForm.city.focus();
	 return false;
	 }
	 var state = document.CustomersForm.state.value; 
	 if (state == "Choose")
	 { 
	 alert ("Please enter the State");
	 document.CustomersForm.state.focus();
	 return false;
	 }
	  var zipcode = document.CustomersForm.zipcode.value;
	 if (zipcode == "" )
	 { 
	 alert ("Please enter the Zip Code");
	 document.CustomersForm.zipcode.focus();
	 return false;
	 }	
	  var phoneno = document.CustomersForm.phoneno.value;
	 if (phoneno == "")
	 { 
	 alert ("Please enter the Phone Number");
	 document.CustomersForm.phoneno.focus();
	 return false;
	 }	
	 var emailid = document.CustomersForm.emailid.value;
	 if (emailid == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.CustomersForm.emailid.focus();
	 return false;
	 }	
	 if (!validateEmail(document.CustomersForm.emailid.value,1,1)) 
	 {
	 document.CustomersForm.emailid.focus();
	 return false;
	 }
	  var username = document.CustomersForm.username.value;
	 if (username == "")
	 { 
	 alert ("Please enter the User Name");
	 document.CustomersForm.username.focus();
	 return false;
	 }	
	   var password = document.CustomersForm.password.value;
	 if (password == "")
	 { 
	 alert ("Please enter the Password");
	 document.CustomersForm.password.focus();
	 return false;
	 }	
	   var confirmpass = document.CustomersForm.confirmpass.value;
	 if (confirmpass == "")
	 { 
	 alert ("Please enter the Confirm  Password");
	 document.CustomersForm.confirmpass.focus();
	 return false;
	 }	
	 if(password!=confirmpass)
	 {
		  alert ("Password and Confirm  Password must be same");
		 document.CustomersForm.confirmpass.focus();
		 return false;
	 }

	 return true;
}

function Product_validation_edit()
{	

	 var listingtype = document.Product_frm.listingtype.value;
 	 if (listingtype == "" )
	 { 
 	 alert ("Please Choose the listing type");
 	 document.Product_frm.listingtype.focus();
 	 return false;
 	 }
	  var brokerid = document.Product_frm.brokerid.value;
	 if (brokerid == "" )
	 { 
	 alert ("Please Choose the broker");
	 document.Product_frm.brokerid.focus();
	 return false;
	 }
	
 	 
	  var varMarketRent = document.Product_frm.varMarketRent.value;
	 if (varMarketRent == "" )
	 { 
	 alert ("Please enter the Market Rent");
	 document.Product_frm.varMarketRent.focus();
	 return false;
	 } 
	  var varBeds = document.Product_frm.varBeds.value;
	 if (varBeds == "" )
	 { 
	 alert ("Please enter the Beds");
	 document.Product_frm.varBeds.focus();
	 return false;
	 } 
	  var varBaths = document.Product_frm.varBaths.value;
	 if (varBaths == "" )
	 { 
	 alert ("Please enter the Baths");
	 document.Product_frm.varBaths.focus();
	 return false;
	 } 
	  var varSquareFootage = document.Product_frm.varSquareFootage.value;
	 if (varSquareFootage == "" )
	 { 
	 alert ("Please enter the Square Footage");
	 document.Product_frm.varSquareFootage.focus();
	 return false;
	 } 
	
	 var varCashPrice = document.Product_frm.varCashPrice.value;
	 if (varCashPrice == "" )
	 { 
	 alert ("Please enter Cash Price");
	 document.Product_frm.varCashPrice.focus();
	 return false;
	 } 
 

 var varStatus = document.Product_frm.varStatus.value;
	 if (varStatus == "" )
	 { 
	 alert ("Please select the Status");
	 document.Product_frm.varStatus.focus();
	 return false;
	 } 


}




function member_edit()
{	
	var firstname = document.CustomersForm.firstname.value;
	 if (firstname == "" )
	 { 
	 alert ("Please enter the First Name");
	 document.CustomersForm.firstname.focus();
	 return false;
	 }
	 var lastname = document.CustomersForm.lastname.value; 
	 if (lastname == "")
	 { 
	 alert ("Please enter the Last Name");
	 document.CustomersForm.lastname.focus();
	 return false;
	 }
	 var address = document.CustomersForm.address.value; 
	 if (address == "")
	 { 
	 alert ("Please enter the Address1");
	 document.CustomersForm.address.focus();
	 return false;
	 }
	  var city = document.CustomersForm.city.value; 
	 if (city == "")
	 { 
	 alert ("Please enter the City");
	 document.CustomersForm.city.focus();
	 return false;
	 }
	 var state = document.CustomersForm.state.value; 
	 if (state == "Choose")
	 { 
	 alert ("Please enter the State");
	 document.CustomersForm.state.focus();
	 return false;
	 }
	  var zipcode = document.CustomersForm.zipcode.value;
	 if (zipcode == "" )
	 { 
	 alert ("Please enter the Zip Code");
	 document.CustomersForm.zipcode.focus();
	 return false;
	 }	
	  var phoneno = document.CustomersForm.phoneno.value;
	 if (phoneno == "")
	 { 
	 alert ("Please enter the Phone Number");
	 document.CustomersForm.phoneno.focus();
	 return false;
	 }	
	 var emailid = document.CustomersForm.emailid.value;
	 if (emailid == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.CustomersForm.emailid.focus();
	 return false;
	 }	
	 if (!validateEmail(document.CustomersForm.emailid.value,1,1)) 
	 {
	 document.CustomersForm.emailid.focus();
	 return false;
	 }
	 return true;
}


function passfrm_valid()
{
	  var password = document.CustomersForm.password.value;
	 if (password == "")
	 { 
	 alert ("Please enter the Password");
	 document.CustomersForm.password.focus();
	 return false;
	 }	
	   var passnew = document.CustomersForm.passnew.value;
	 if (passnew == "")
	 { 
	 alert ("Please enter the New  Password");
	 document.CustomersForm.passnew.focus();
	 return false;
	 }	
	  var confirmpass = document.CustomersForm.confirmpass.value;
	 if (confirmpass == "")
	 { 
	 alert ("Please enter the  Confirm New  Password");
	 document.CustomersForm.confirmpass.focus();
	 return false;
	 }	
	 if(passnew!=confirmpass)
	 {
		  alert ("New Password and Confirm  New Password must be same");
		 document.CustomersForm.confirmpass.focus();
		 return false;
	 }
	 return true;
}



function Brokerlogin_valid()
{
	var username=document.LoginForm.username.value;
	if(username=="")
	{
		alert ("Please Enter User Name");
		document.LoginForm.username.focus();
		return false;
	}
	var password=document.LoginForm.password.value;
	if(password=="")
	{
		alert ("Please Enter Password");
		document.LoginForm.password.focus();
		return false;
	}
	return true;
}

*/
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 wholesalelogin()
{
	var user=document.frmwholesalelogin.user.value;
	if(user=="")
	{
		alert ("Please Enter User Name");
		document.frmwholesalelogin.user.focus();
		return false;
	}
	var pass=document.frmwholesalelogin.pass.value;
	if(pass=="")
	{
		alert ("Please Enter Password");
		document.frmwholesalelogin.pass.focus();
		return false;
	}
	return true;
}

function frontleftvalidation() {
	var fgfdg=document.frontleft.txtfrontname.value;
	if(fgfdg =="")
	{
		alert ("Please Enter Name");
		document.frontleft.txtfrontname.focus();
		return false;
	}
	
	 var emailid = document.frontleft.txtemail.value;
	 if (emailid == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.frontleft.txtemail.focus();
	 return false;
	 }	
	 if (!validateEmail(document.frontleft.txtemail.value,1,1)) 
	 {
	 document.frontleft.txtemail.focus();
	 return false;
	 }
}

function frontleftvalidation() {
	var fgfdg=document.frontleft.txtfrontname.value;
	if(fgfdg =="")
	{
		alert ("Please Enter Name");
		document.frontleft.txtfrontname.focus();
		return false;
	}
	
	 var emailid = document.frontleft.txtemail.value;
	 if (emailid == "")
	 { 
	 alert ("Please enter the Email Address");
	 document.frontleft.txtemail.focus();
	 return false;
	 }	
	 if (!validateEmail(document.frontleft.txtemail.value,1,1)) 
	 {
	 document.frontleft.txtemail.focus();
	 return false;
	 }
}
*/
function sub_add()
{
	alert ("hai");
	var frommail=document.sub_add.frommail.value;
	if(frommail!="")
	{
		 alert ("Please enter the Email Address");
		 document.sub_add.frommail.focus();
	 	return false;
	}
	 if (!validateEmail(document.sub_add.frommail.value,1,1)) 
	 {
	 document.sub_add.frommail.focus();
	 return false;
	 }
	 return true;
}

function sub_add1()
{
	var frommail=document.sub_add.frommail.value;
	if(frommail == "")
	{
		 alert ("Please enter the Email Address");
		 document.sub_add.frommail.focus();
	 	return false;
	}
	 if (!validateEmail(document.sub_add.frommail.value,1,1)) 
	 {
	 document.sub_add.frommail.focus();
	 return false;
	 }
	 return true;
}

/*
function insertMoreUpload() 
{ 
	
	var nUploads = parseInt(document.getElementById('NumberOfUploads').value)+1;		 
	var tbody    = document.getElementById("tabUpload").getElementsByTagName("tbody")[1]; 
	var row      = document.createElement("TR"); 
	var cell1    = document.createElement("TD");
	
	cell1.setAttribute("valign","top");
	cell1.setAttribute("align","right");
	cell1.setAttribute("width","22%");
	cell1.setAttribute("class","text");
	cell1.innerHTML = "Image&nbsp;"+nUploads;

	//insert second <td>
	var cell2 = document.createElement("TD");
	//cell2.setAttribute("colspan","2");
	cell2.setAttribute("valign","top");
	cell2.setAttribute("width","78%");
	cell2.setAttribute("align","left");
	//File
	var eInput = document.createElement("INPUT"); 
	eInput.setAttribute("type","file");
	eInput.setAttribute("name","pictureadd" + nUploads);
	eInput.setAttribute("id","pictureadd" + nUploads);
	eInput.setAttribute("style", "FONT: 11px Verdana, Arial, Helvetica, sans-seri; text-decoration:none; color: #006699;");	
	cell2.appendChild(eInput);
	
	// append all <td> to <tr>
	row.appendChild(cell1); 
	row.appendChild(cell2); 
	
	tbody.appendChild(row);
	
	document.Product_frm.NumberOfUploads.value = nUploads;
	return false;
}

function Product_validation()
{	

	 var listingtype = document.Product_frm.listingtype.value;
 	 if (listingtype == "" )
	 { 
 	 alert ("Please Choose the listing type");
 	 document.Product_frm.listingtype.focus();
 	 return false;
 	 }
	
 	 
	  var varMarketRent = document.Product_frm.varMarketRent.value;
	 if (varMarketRent == "" )
	 { 
	 alert ("Please enter the Market Rent");
	 document.Product_frm.varMarketRent.focus();
	 return false;
	 } 
	  var varBeds = document.Product_frm.varBeds.value;
	 if (varBeds == "" )
	 { 
	 alert ("Please enter the Beds");
	 document.Product_frm.varBeds.focus();
	 return false;
	 } 
	  var varBaths = document.Product_frm.varBaths.value;
	 if (varBaths == "" )
	 { 
	 alert ("Please enter the Baths");
	 document.Product_frm.varBaths.focus();
	 return false;
	 } 
	  var varSquareFootage = document.Product_frm.varSquareFootage.value;
	 if (varSquareFootage == "" )
	 { 
	 alert ("Please enter the Square Footage");
	 document.Product_frm.varSquareFootage.focus();
	 return false;
	 } 
	
	 var varCashPrice = document.Product_frm.varCashPrice.value;
	 if (varCashPrice == "" )
	 { 
	 alert ("Please enter Cash Price");
	 document.Product_frm.varCashPrice.focus();
	 return false;
	 } 
 

 var varStatus = document.Product_frm.varStatus.value;
	 if (varStatus == "" )
	 { 
	 alert ("Please select the Status");
	 document.Product_frm.varStatus.focus();
	 return false;
	 } 

 var varThumbimage = document.Product_frm.varThumbimage.value;
 	 if (varThumbimage == "" )
	 { 
	 alert ("Please enter the thumb image");
	 document.Product_frm.varThumbimage.focus();
	 return false;
 	 } 
}

function calldel(m)
{
  if(!confirm(m))
  {
    return false;
  }
  else
  return true;
}

*/

function openwindow(field,value){
	//alert(document.viewcart.chk_list.length);
	//var len;
	len = document.frm_cart.chk_list.length;
	//len=len+1;
	len2=0;
	//alert(len);
	for (i = 0; i < len; i++) 
			{
				var chkname	=	document.frm_cart.chk_list[i].checked;
				//alert(chkname);
					//alert(len2);
					if (chkname == false) 
						{
							len2 = len2 + 1;
						}
						
			}
			if(len == len2)
			{
				//alert(len2);
				alert("Please Select Atleast one");
				return false;
			}
			
document.frm_cart.action="viewcart.php?fun=del";
document.frm_cart.submit();

}


function checkout_validation()
{

if(document.checkout_frm.varEmail.value == "")
	{
		alert("Please enter the Email Address");
		document.checkout_frm.varEmail.focus();
		return false;
	}
	if (!validateEmail(document.checkout_frm.varEmail.value,1,1)) 
	 {
	 document.checkout_frm.varEmail.focus();
	 return false;
	 }
	if(document.checkout_frm.ConfirmEmail.value == "")
	{
		alert("Please enter the Confirm - Email Address");
		document.checkout_frm.ConfirmEmail.focus();
		return false;
	}
	if(document.checkout_frm.varEmail.value!= document.checkout_frm.ConfirmEmail.value)
	{
		alert("Please enter correct Confirm - Email Address");
		document.checkout_frm.ConfirmEmail.focus();
		return false;
	}
//------script for billing address --------------------------//
	if(document.checkout_frm.varFirstName.value == "")
	{
		alert("Please enter the First Name");
		document.checkout_frm.varFirstName.focus();
		return false;
	}
	
	if(document.checkout_frm.varAddress.value == "")
	{
		alert("Please enter the  Address");
		document.checkout_frm.varAddress.focus();
		return false;
	}
	if(document.checkout_frm.varCity.value == "")
	{
		alert("Please enter the City");
		document.checkout_frm.varCity.focus();
		return false;
	}
	if(document.checkout_frm.varCountry.value == "")
	{
		alert("Please enter the Country");
		document.checkout_frm.varCountry.focus();
		return false;
	}
	if(document.checkout_frm.varState.value == "Choose")
	{
		alert("Please select the State");
		document.checkout_frm.varState.focus();
		return false;
	}
	
	if(document.checkout_frm.varPostcode.value =="")
	{
		alert("Please enter the Zip Code");
		document.checkout_frm.varPostcode.focus();
		return false;
	}	
	if(isNaN(document.checkout_frm.varPostcode.value))
	{
		alert("Zip Code Must ber Numeric");
		document.checkout_frm.varPostcode.focus();
		return false;
	}
	if(document.checkout_frm.varPhoneNo.value == "")
	{
		alert("Please enter the Phone Number");
		document.checkout_frm.varPhoneNo.focus();
		return false;
	}

/*// set var radio_choice to false
var radio_choice = false;

// Loop from zero to the one minus the number of radio button selections
for (counter = 0;  counter < document.checkout_frm.payment_check.length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (document.checkout_frm.payment_check[counter].checked)
radio_choice = true; 
var chackbox_val=document.checkout_frm.payment_check[counter].value;

}
if(radio_choice){
		for (counter = 0;  counter < document.checkout_frm.payment_check.length; counter++)
		{
		
			if (document.checkout_frm.payment_check[counter].checked){
				if(document.checkout_frm.payment_check[counter].value=="Paypal"){
				var card_name = document.checkout_frm.card_name.value;
		 if (card_name == "" )
		 { 
			 alert ("Please enter the Card Name");
			 document.checkout_frm.card_name.focus();
			 return false;
		 }
		 var card_no = document.checkout_frm.card_no.value;
		 if (card_no == "" )
		 { 
			 alert ("Please enter the Card No");
			 document.checkout_frm.card_no.focus();
			 return false;
		 }
		 if (isNaN(card_no))
		 { 
			 alert ("Card No Must be Numeric");
			 document.checkout_frm.card_no.focus();
			 return false;
		 }
		  var expiremnth = document.checkout_frm.expiremnth.value;
		 if (expiremnth == "" )
		 { 
			 alert ("Please Select the Expired month");
			 document.checkout_frm.expiremnth.focus();
			 return false;
		 }
		 var cvv_code = document.checkout_frm.cvv_code.value;
		 if (cvv_code == "" )
		 { 
			 alert ("Please Enter the CVV Code");
			 document.checkout_frm.cvv_code.focus();
			 return false;
		 }
		   var billing_address = document.checkout_frm.billing_address.value;
		 if (billing_address == "" )
		 { 
			 alert ("Please Enter the Billing Address");
			 document.checkout_frm.billing_address.focus();
			 return false;
		 }
		 
		  var billing_city = document.checkout_frm.billing_city.value;
		 if (billing_city == "" )
		 { 
			 alert ("Please Enter the Billing City Name");
			 document.checkout_frm.billing_city.focus();
			 return false;
		 }
		  var billing_state = document.checkout_frm.billing_state.value;
		 if (billing_state == "" )
		 { 
			 alert ("Please Enter the Billing State Name");
			 document.checkout_frm.billing_state.focus();
			 return false;
		 }
		  var billing_zip = document.checkout_frm.billing_zip.value;
		 if (billing_zip == "" )
		 { 
			 alert ("Please Enter the Billing Zip Code");
			 document.checkout_frm.billing_zip.focus();
			 return false;
		 }
				
					}

			}
		}
	}*/
//--------------Code for shipping address section-------------------//
	if(document.checkout_frm.varShipFirstName.value == "")
	{
		alert("Please enter the Shipping First Name");
		document.checkout_frm.varShipFirstName.focus();
		return false;
	}
	
	if(document.checkout_frm.varShipAddress.value == "")
	{
		alert("Please enter the Shipping Address");
		document.checkout_frm.varShipAddress.focus();
		return false;
	}
	if(document.checkout_frm.varShipCity.value == "")
	{
		alert("Please enter the Shipping City");
		document.checkout_frm.varShipCity.focus();
		return false;
	}
	if(document.checkout_frm.varShipState.value == "Choose")
	{
		alert("Please enter the Shipping State");
		document.checkout_frm.varShipState.focus();
		return false;
	}
	
	if(document.checkout_frm.varShipZip.value =="")
	{
		alert("Please enter the Shipping Zip Code");
		document.checkout_frm.varShipZip.focus();
		return false;
	}	
	if(isNaN(document.checkout_frm.varShipZip.value))
	{
		alert("Shipping Zip Code Must ber Numeric");
		document.checkout_frm.varShipZip.focus();
		return false;
	}
	if(document.checkout_frm.varShipPhone.value == "")
	{
		alert("Please enter the Shipping Phone Number");
		document.checkout_frm.varShipPhone.focus();
		return false;
	}
}

function login_validate(){
	
	 if (document.login.username_1.value== "" )
		 { 
			 alert ("Please enter the User name");
			 document.login.username_1.focus();
			 return false;
		 }
		 if (document.login.password_1.value== "" )
		 { 
			 alert ("Please enter the Password");
			 document.login.password_1.focus();
			 return false;
		 }
	
}
function member_validation()
{
var firstname=document.member_frm.txtFirstname.value;
if(firstname=="")
{
alert("Please enter the First Name");
document.member_frm.txtFirstname.focus();
return false;
}
var lastname=document.member_frm.txtLastname.value;
if(lastname=="")
{
alert("Please enter the Last Name");
document.member_frm.txtLastname.focus();
return false;
}
var email=document.member_frm.txtEmail.value;
if(email=="")
{
alert("Please enter the Email ID");
document.member_frm.txtEmail.focus();
return false;
}

 if (!validateEmail(document.member_frm.txtEmail.value,1,1)) 
	 {
	 document.member_frm.txtEmail.focus();
	 return false;
	 }
var address1=document.member_frm.txtAddress1.value;
if(address1=="")
{
alert("Please enter the Address1");
document.member_frm.txtAddress1.focus();
return false;
}
var city=document.member_frm.txtCity.value;
if(city=="")
{
alert("Please enter the City");
document.member_frm.txtCity.focus();
return false;
}
var state=document.member_frm.txtState.value;
if(state=="")
{
alert("Please enter the State");
document.member_frm.txtState.focus();
return false;
}
var postcode=document.member_frm.intPostcode.value;
if(postcode=="")
{
alert("Please enter the Postcode");
document.member_frm.intPostcode.focus();
return false;
}
 if (isNaN(document.member_frm.intPostcode.value))
    { 
	   alert ("No of Postcode must be Numeric");
	   document.member_frm.intPostcode.focus();
	   return false;
	}
var telephone=document.member_frm.intTelephone.value;
if(telephone=="")
{
alert("Please enter the Telephone");
document.member_frm.intTelephone.focus();
return false;
}
 if (isNaN(document.member_frm.intTelephone.value))
    { 
	   alert ("No of Telephone must be Numeric");
	   document.member_frm.intTelephone.focus();
	   return false;
	}
var username=document.member_frm.txtUsername.value;
if(username=="")
{
alert("Please enter the Username");
document.member_frm.txtUsername.focus();
return false;
}
var password=document.member_frm.txtPassword.value;
if(password=="")
{
alert("Please enter the Password");
document.member_frm.txtPassword.focus();
return false;
}
}
function opencart(rows)
{

	var len=document.frm_cart.ONE.length;
	   if(rows == 1)
	   {
			quantity = document.frm_cart.ONE.value;
			stockvalue = document.frm_cart.STOCK.value;
			original = document.frm_cart.STOCK1.value;
				if( (quantity == ""))
				{
					alert("Type the valid quantity");
						document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
						return false;
				}
				else if((quantity == 0))
				{
					alert("Type the valid quantity");
						document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
						return false;
				}
				
				else if(isNaN(quantity))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
							return false;
				}
				else if((quantity.indexOf("-") >= 0))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
							return false;
				}
				else if((quantity.indexOf(".") >= 0))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
							return false;
				}
				else if((quantity > 65535))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
							return false;
				}
				if(parseInt(quantity) > parseInt(stockvalue)){
						alert("Quantity is out of stock");
						document.frm_cart.ONE.focus();
						document.frm_cart.ONE.value=document.frm_cart.STOCK1.value;
						return false;
				}		 
	   }
		   else
		   {
			   var flag=0;
		  	for(var index=0;index<rows;index++)
			{
			quantity = document.frm_cart.ONE[index].value;
			stockvalue = document.frm_cart.STOCK[index].value;
			original = document.frm_cart.STOCK1[index].value;
				if( (quantity == ""))
				{
					alert("Type the valid quantity");
						document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
						return false;
				}
				else if((quantity == 0))
				{
					alert("Type the valid quantity");
						document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
						return false;
				}
				
				else if(isNaN(quantity))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
							return false;
				}
				else if((quantity.indexOf("-") >= 0))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
							return false;
				}
				else if((quantity.indexOf(".") >= 0))
				{
					alert("Type the valid quantity");
							document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
							return false;
				}
				else if((quantity > 65535))
				{
						alert("Type the valid quantity");
						document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
						return false;
				}
				if(parseInt(quantity) > parseInt(stockvalue)){
						alert("Quantity is out of stock");
						document.frm_cart.ONE[index].focus();
						document.frm_cart.ONE[index].value=document.frm_cart.STOCK1[index].value;
						return false;
				}
						
			}
		   }
}

function newsletter_validation(){
	var name=document.subscribe.txt_name.value;
if(name=="")
{
alert("Please enter the Your Name");
document.subscribe.txt_name.focus();
return false;
}
	 var email=document.subscribe.txt_email.value;
if(email=="")
{
alert("Please enter the Email ID");
document.subscribe.txt_email.focus();
return false;
}

 if (!validateEmail(document.subscribe.txt_email.value,1,1)) 
	 {
	 document.subscribe.txt_email.focus();
	 return false;
	 }
	 
 }

function display(val){
if(val=="Paypal")
{
document.getElementById('credit1').style.display="";
document.getElementById('credit1').style.visibility="visible";
document.getElementById('credit2').style.display="";
document.getElementById('credit2').style.visibility="visible";
document.getElementById('credit3').style.display="";
document.getElementById('credit3').style.visibility="visible";
document.getElementById('credit4').style.display="";
document.getElementById('credit4').style.visibility="visible";
document.getElementById('credit5').style.display="";
document.getElementById('credit5').style.visibility="visible";
document.getElementById('credit6').style.display="";
document.getElementById('credit6').style.visibility="visible";
document.getElementById('credit7').style.display="";
document.getElementById('credit7').style.visibility="visible";
document.getElementById('credit8').style.display="";
document.getElementById('credit8').style.visibility="visible";
document.getElementById('credit9').style.display="";
document.getElementById('credit9').style.visibility="visible";
document.getElementById('credit10').style.display="";
document.getElementById('credit10').style.visibility="visible";

}
else 
{
document.getElementById('credit1').style.display="none";
document.getElementById('credit2').style.display="none";
document.getElementById('credit3').style.display="none";
document.getElementById('credit4').style.display="none";
document.getElementById('credit5').style.display="none";
document.getElementById('credit6').style.display="none";
document.getElementById('credit7').style.display="none";
document.getElementById('credit8').style.display="none";
document.getElementById('credit9').style.display="none";
document.getElementById('credit10').style.display="none";
}

}