function setPaymentInfo(isChecked)
{
	
	with (window.document.frmCheckout) {
		if (isChecked) 
		{
			od_shipping_first_name.value  = od_customer_first_name.value;
			od_shipping_last_name.value   = od_customer_last_name.value;
			od_shipping_address1.value   = od_customer_address1.value;
			od_shipping_address2.value   = od_customer_address2.value;
			od_shipping_phone.value      = od_customer_phone.value;
			od_shipping_city.value      = od_customer_city.value;			
			od_shipping_state.value       = od_customer_state.value;
			od_shipping_postal_code.value = od_customer_postal_code.value ;
			
				
			//makeDisable();
			
			//od_shipping_state.readOnly       = true;
					
		} else {
			
			od_shipping_first_name.readOnly  = false;
			od_shipping_last_name.readOnly   = false;
			od_shipping_address1.readOnly   = false;
			od_shipping_address2.readOnly   = false;
			od_shipping_phone.readOnly      = false;
			od_shipping_city.readOnly      = false;	
			//makeEnable();
			//od_shipping_state.readOnly       = false;
			
			od_shipping_postal_code.readOnly = false;	
			
			od_shipping_first_name.value = "";
			od_shipping_last_name.value   = "";
			od_shipping_address1.value   = "";
			od_shipping_address2.value   = "";
			od_shipping_phone.value      ="";
			od_shipping_city.value      = "";			
			//od_shipping_state.value       = "";
			od_shipping_postal_code.value = "";
			
			
		}
	}
}


function checkShippingAndPaymentInfo()
{ 
	with (window.document.frmCheckout) {
		
		
		if (isEmpty(od_customer_first_name, 'Please Enter First Name')) {
			return false;
		} 
		else if (isEmpty(od_customer_last_name, 'Please Enter Last Name')) {
			return false;
		} else if (isEmpty(od_customer_address1, 'Please Enter Customer Address1')) {
			return false;
		} 
		else if (isEmpty(od_customer_phone, 'Please Enter Telephone Number')) {
			return false;
		}else if (isEmpty(od_customer_state, 'Please Enter Customer Address State')) {
			return false;
		}  
			else if (isEmpty(od_customer_city, 'Please Enter Customer Address City')) {
			return false;
		} else if (isEmpty(od_customer_state, 'Please Enter Customer Address State')) {
			return false;
		}
			else if (isEmpty(od_customer_postal_code, 'Please Enter  Customer Address Postal/Zip Code')) {
			return false;
		}
	else 
	   
	if (isEmpty(od_shipping_first_name, 'Please Enter First Name')) {
			return false;
		} 
		else 
		if (isEmpty(od_shipping_last_name, 'Please Enter Last Name')) 
		{
			return false;
		} 
		else
		if (isEmpty(od_shipping_address1, 'Please Enter  Shipping Address1')) 
		{
			return false;
		} 
		else
		if (isEmpty(od_shipping_phone, ' Please Enter  Shipping Phone Number')) 
		{
			return false;
		} 
	
		
		else if (isEmpty(od_shipping_city, 'Please Enter Shipping Address City')) {
			return false;
		}
		else if (isEmpty(od_shipping_state, 'Please Enter Shipping address State')) {
			return false;
		}
			else if (isEmpty(od_shipping_postal_code, 'Please Enter  Shipping Address Postal/Zip Code')) {
			return false;
		} 
		
	}
	window.document.frmCheckout.submit();
	
}

function validatecardinfo()
{ 
	with (window.document.frmCreditinfo) {
		
		
	/*if (isEmpty(cc_hname, ' Please Enter Card Holder Name')) {
			
			return false;
		} else if (isEmpty(cc_number, 'Please Enter Credit Card Number')) {
			
			return false;
		}
		else if (isEmpty(cc_cvn, 'Please Enter Card Verification Number')) {
			return false;
			
		} else if (isEmpty(cc_exdate, 'Please Enter Expiry Date')) {
			return false;
		}*/
		window.document.frmCreditinfo.submit();
	}
	
}
function IsNumber(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.- []()";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) {
	   
	   return false;
   }
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 
         blnResult = false;
         }
      }
   return blnResult;
   }
function IsPhoneNumber(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.- []()";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) {
	   
	   return false;
   }
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
		 
         blnResult = false;
         }
      }
   return blnResult;
   }

function customerRegstnInfo(thisform)
{
	
	with (thisform) {
		var reg = /^([a-z0-9_\-\.])+\@([a-z0-9_\-\.])+\.([a-z]{2,4})$/;
		if (isEmpty(cust_fname, 'Please Enter First Name')) {
			return false;
		} else if (isEmpty(cust_lname, 'Please Enter Last Name')) {
			return false;
		}else if (isEmpty(cust_email, 'Please Enter Email Address')) {
			return false;
		} else if (reg.test(thisform.cust_email.value) == false) {
			alert('Invalid Email Address');
	  cust_email.focus();
	  cust_email.select();
      return false;
		}else if (isEmpty(cust_address, 'Please Enter Address')) {
			return false;
		}else if (isEmpty(cust_zip, 'Please Enter Post code')) {
			return false;
		}
		//var ph = thisform.cust_zip.value;
//		var phno= IsPhoneNumber(ph);
//		if(phno==false )
//		{
//			alert("Please Enter zip code");
//			 cust_zip.focus();
//	  		cust_zip.select();
//			
//	  		return false;	
//		}
		else if (isEmpty(cust_city, 'Please Enter City')) {
			return false;
		}  else if (isEmpty(cust_state, 'Please Enter State')) {
			return false;
		}
		 var ph = thisform.cust_phone.value;
		 
		var phno= IsPhoneNumber(ph);
		if(phno==false )
		{
			alert("Please Enter Phone number");
			 cust_phone.focus();
	  		cust_phone.select();
			
	  		return false;	
		}
		else if (isEmpty(cust_pwd, 'Please Enter Password')) {
			return false;
		}else if(thisform.cust_pwd.value!=thisform.repassword.value)
	{
		alert('Please Confirm Password');
		thisform.repassword.focus();
		thisform.repassword.select();
		return false;
	
		} 
	}
	thisform.submit();
}
function validateqty()
{
	with(thisform) {
		if(isEmpty(p_qty, ' Please Enter City')) {
			return false;	
		}
		return true;
	}
}
function validate(thisform)
{
	
	thisform.submit();
}
function validate_cart(thisform)
{
	thisform.submit();
}

function isEmpty(formElement, message) {
	//formElement.value = trim(formElement.value);
	_isEmpty = false;
	if (formElement.value == '') {
		
		_isEmpty = true;
		alert(message);
		formElement.focus();
	}
	
	return _isEmpty;
}



function emptyvalidation(entered, alertbox)
{
	with (entered)
	{
		while (value.charAt(0) == ' ')
			value = value.substring(1);
		while (value.charAt(value.length - 1) == ' ')
			value = value.substring(0, value.length - 1);
		if (value==null || value=="")
		{
			if (alertbox!="") alert(alertbox);
			return false;
		}
		else return true;
	}
}
