//added on 19 jan
//added on 19 jan
function datepicker(id)
{

		NewCal(id,'mmddyyyy',true,24);
	
}	 
function default_login()
{
if(document.inc_login.loginid.value == "E-mail address")
document.inc_login.loginid.value="";
}
function reset_val()
{
	document.frmvacation.suspend.value="";
	document.frmvacation.resume.value="";	
	document.frmvacation.suspend.focus();	
}
function chk_frmvacation(obj)
{
	//alert(obj.name+obj.elements.length);
	if(obj.elements[0].value=="")
	{
	alert("Please select suspend date.");
	return false;
	}
	if(obj.elements[1].value=="")
	{
	alert("Please select resume date.");
	return false;
	}
	
	return true;
}
function default_login1(nm)
{
if(document.getElementById(nm).value=="E-mail address")
document.getElementById(nm).value="";

}
function checkblank(nm)
{
if(document.getElementById(nm).value=="")
	{
		alert("Please enter quantity.");
		document.getElementById(nm).focus();
		return false;
	}else 
	{
		if(isNaN((document.getElementById(nm).value)))
		{
			alert("Please enter the numeric quantity.");
			document.getElementById(nm).focus();
		return false;
		}
	}
	return true;
}

/* when call this function pass the --- this.id
function default_login(nm)
{
if(document.getElementById(nm).value=="E-mail address")
	alert(document.getElementById(nm).value+"HJI"+nm);
document.getElementById(nm).value="";
}
*/

function default_fpwd()
{
if(document.frmchangepass.fpwdloginid.value == "E-mail address")
document.frmchangepass.fpwdloginid.value="";
}




function login_check()
{
	if(document.inc_login.loginid.value=="")
		{
			alert("Please enter your id.");
			document.inc_login.loginid.focus();
			return false;
		}
	if(document.inc_login.pwd.value=="")
		{
			alert("Please enter your password.");
			document.inc_login.pwd.focus();
			return false;
	}
 return true;
}
function login_check(obj)
{
	//alert(obj.name);
	if(obj.loginid.value=="")
		{
			alert("Please enter your user name.");
			obj.loginid.focus();
			return false;
		}
	if(obj.pwd.value=="")
		{
			alert("Please enter your password.");
			obj.pwd.focus();
			return false;
	}
 return true;
}
  function chkform()
   {
	    var i=0;
		var alrt="";
      if(document.frmchangepass.oldpwd.value =="")
	   {
	     alrt+= (++i)+': Please enter old password.\n';
		
	   }
	  
      	 
	   if(document.frmchangepass.newpwd.value =='')
	   {
	     alrt+= (++i)+': Please enter new password.\n';
		 
	   }
	   a = document.frmchangepass.newpwd.value;
	   b = document.frmchangepass.cnfnewpwd.value;
	
	   
	    if((a.length <5 || a.length >8) && a.length >0)
	   {
	     alrt+= (++i)+': Please enter 5-8 digit  new password.\n';
		 
	   }
	   
	   if(document.frmchangepass.cnfnewpwd.value =='')
	   {
	     alrt+= (++i)+': Please confirm new password.\n';
		 
	   }
	   
	   
	   
	   if(a !="" && b!="" &&  a!= b )
	   {
	      if(a.length >4 && a.length <9)
		 alrt+= (++i)+': New password and confirm password are not same.\n';
		 
	   }
	   if(alrt != "")
	   {
		   if(i==1)
		   alrt=alrt.replace(/1:/, "");
		   alert(alrt);
		    if(document.frmchangepass.oldpwd.value =="")
	  		 {
		       document.frmchangepass.oldpwd.focus();
			 }
			  else if(document.frmchangepass.newpwd.value =="")
	  		 {
		       document.frmchangepass.newpwd.focus();
			 }
			  else if(document.frmchangepass.cnfnewpwd.value =="")
	  		 {
		       document.frmchangepass.cnfnewpwd.focus();
			 }else  document.frmchangepass.newpwd.focus();
		   return false;
	   }
	   return true;
	   
   }


 function pwdrecovery()
   {
	 if(document.frmchangepass.fpwdloginid.value =="")
	   {
	     alert('Please enter login id.');
		 document.frmchangepass.fpwdloginid.focus();
		 return false;
	   }
     

   }


//for copy info of  registration page


 function copyInfo()
  {
    var frm = document.order;
    var ctry = frm.order_bill_country.options[frm.order_bill_country.selectedIndex].value;

    //alert(frm.sameasbilling.checked)
    if (frm.sameasbilling.checked)
    {
      frm.order_ship_name.value = frm.order_bill_name.value;
      frm.order_ship_lname.value = frm.order_bill_lname.value;
	  frm.order_ship_address.value = frm.order_bill_address.value;
	  frm.order_ship_address2.value = frm.order_bill_address2.value;
	  frm.order_ship_city.value = frm.order_bill_city.value;
      frm.order_ship_phone.value = frm.order_bill_phone.value;
      frm.order_ship_zip.value = frm.order_bill_zip.value;
	  frm.order_ship_state.value = frm.order_bill_state.value;
      frm.order_ship_country.value = frm.order_bill_country.value;
      return;
    }
    else
    {
      frm.order_ship_name.value = "";
      frm.order_ship_lname.value = "";
	  frm.order_ship_address.value = "";
	  frm.order_ship_address2.value = "";
	  frm.order_ship_city.value = "";
	  frm.order_ship_zip.value = "";
      frm.order_ship_phone.value = "";
      //frm.order_ship_mobile.value = "";
	  frm.order_ship_state.value = "";
      frm.order_ship_country.value = "";
      return;
    }
  }

//-->

//for  checking the validation of  credit card

<!--
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: David Leppek :: https://www.azcode.com/Mod10

Basically, the alorithum takes each digit, from right to left and muliplies each second
digit by two. If the multiple is two-digits long (i.e.: 6 * 2 = 12) the two digits of
the multiple are then added together for a new number (1 + 2 = 3). You then add up the 
string of numbers, both unaltered and new values and get a total sum. This sum is then
divided by 10 and the remainder should be zero if it is a valid credit card. Hense the
name Mod 10 or Modulus 10. */
function cc_check(ccNumb) {  // v2.0
var valid = "0123456789"  // Valid digits in a credit card number
var len = ccNumb.length;  // The length of the submitted cc number
var iCCN = parseInt(ccNumb);  // integer of ccNumb
var sCCN = ccNumb.toString();  // string of ccNumb
sCCN = sCCN.replace (/^\s+|\s+$/g,'');  // strip spaces
var iTotal = 0;  // integer total set at zero
var bNum = true;  // by default assume it is a number
var bResult = false;  // by default assume it is NOT a valid cc
var temp;  // temp variable for parsing string
var calc;  // used for calculation of each digit
var alrt="";
var j1=0;
if ((document.order.noc.value).length == 0)
    {
       alrt+= (++j1)+":"+"Please enter a value for the \"Name on the card\" in Billing Details.\n";
    } 
if(len==0)
{
 alrt+= (++j1)+":"+"Please enter a value for the \"Credit Card Number\" in Billing Details.\n";
//return bResult;
}else {


// Determine if the ccNumb is in fact all numbers
for (var j=0; j<len; j++) {
  temp = "" + sCCN.substring(j, j+1);
  if (valid.indexOf(temp) == "-1"){bNum = false;}
}

// if it is NOT a number, you can either alert to the fact, or just pass a failure
if(!bNum){
  /*alert("Not a Number");*/bResult = false;
}

// Determine if it is the proper length 
if((len == 0)&&(bResult)){  // nothing, field is blank AND passed above # check
  bResult = false;
} else{  // ccNumb is a number and the proper length - let's see if it is a valid card number
  if(len >= 15){  // 15 or 16 for Amex or V/MC
    for(var i=len;i>0;i--){  // LOOP throught the digits of the card
      calc = parseInt(iCCN) % 10;  // right most digit
      calc = parseInt(calc);  // assure it is an integer
      iTotal += calc;  // running total of the card number as we loop - Do Nothing to first digit
      i--;  // decrement the count - move to the next digit in the card
      iCCN = iCCN / 10;                               // subtracts right most digit from ccNumb
      calc = parseInt(iCCN) % 10 ;    // NEXT right most digit
      calc = calc *2;                                 // multiply the digit by two
      // Instead of some screwy method of converting 16 to a string and then parsing 1 and 6 and then adding them to make 7,
      // I use a simple switch statement to change the value of calc2 to 7 if 16 is the multiple.
      switch(calc){
        case 10: calc = 1; break;       //5*2=10 & 1+0 = 1
        case 12: calc = 3; break;       //6*2=12 & 1+2 = 3
        case 14: calc = 5; break;       //7*2=14 & 1+4 = 5
        case 16: calc = 7; break;       //8*2=16 & 1+6 = 7
        case 18: calc = 9; break;       //9*2=18 & 1+8 = 9
        default: calc = calc;           //4*2= 8 &   8 = 8  -same for all lower numbers
      }                                               
    iCCN = iCCN / 10;  // subtracts right most digit from ccNum
    iTotal += calc;  // running total of the card number as we loop
  }  // END OF LOOP
  if ((iTotal%10)==0){  // check to see if the sum Mod 10 is zero
    bResult = true;  // This IS (or could be) a valid credit card number.
  } else {
    bResult = false;  // This could NOT be a valid credit card number
    }
  }
}
if(!bResult){
  alrt+= (++j1)+":"+"This is NOT a valid Credit Card Number!";
}
}//for else 
// change alert to on-page display or other indication as needed.
/*
if(bResult) {
  alert("This IS a valid Credit Card Number!");
}
*/

   if(alrt !="")
	{
		 if(j1==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
   }
  return bResult; // Return the results
}
// -->




//for checking the validation of registration

function validator_login()
{
var i=0;
var alrt="";
var ln=reg.login.value;
if(reg.login.value == "")
  {

     alrt+= (++i)+": "+"Please enter the \"E-mail address\" to login.\n";

  }//else err1['0']=" ";
  
   if( ln != "")
    {
      if ((ln.indexOf("@")==-1) || (ln.indexOf(".")==-1))
      {
        alrt+= (++i)+": "+"Please enter correct \"E-mail address\" to login.\n";
      }//else err1['3'] =" ";
    }
    
  if(reg.password.value == "")
  {
 
      alrt+= (++i)+": "+"Please enter the \"Password\" to login.\n";
    
  }//else err1['1']=" ";
	if(alrt !="")
	{
	//alert(alrt.length);
	 if(i==1)
		alrt=alrt.replace(/1:/, "");
	alert(alrt);
	return false;
	}
  

}//function

function validator_Order(order)
{
var i=0;
var alrt="";
    if (order.order_bill_name.value == "")
    {
      alrt+= (++i)+":"+"Please enter a value for the \"First Name \" in Billing Address.\n";
    }
	if (order.order_bill_lname.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"Last Name\" in Billing Address.\n";
    }  
    if (order.order_bill_address.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"Address\" in Billing Address.\n";
    }  
	
	if (order.order_bill_city.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"City \" in Billing Address.\n";
    }  

	if (order.order_bill_country.value == 0)
    {
      	alrt+= (++i)+":"+"Please select a value for the \"Country\" in Billing Address.\n";
    }
 	
	if (order.order_bill_country.value == "US")
    {
       if (order.order_bill_state.value ==0)
    		{		
				alrt+= (++i)+":"+"Please select a value for the \"State\" in Billing Address.\n";
			}
    } 	

    if (order.order_bill_zip.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Zip\" in Billing Address.\n";
    } 

	
	 if (isNaN(order.order_bill_zip.value))
    {
		  order.order_bill_zip.value = "";
          alrt+= (++i)+":"+"Please enter 5 digit numeric value for the \"Zip\" in Billing Details.\n";
      
    } 


	if (order.order_bill_zip.value.length >0)
    {
        if (order.order_bill_zip.value.length <5)
            {
            alrt+= (++i)+":"+"Please enter a 5 digit numeric value for the \"Zip\" in Billing Address.\n";
            } 
    } 
	
	if (order.order_bill_phone.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Phone\" in Billing Address.\n";
    } 
	
	
    if (order.order_bill_email.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"E-Mail Address\" in Billing Address.\n";
    }

    if( order.order_bill_email.value != "")
    {
      
       if ((order.order_bill_email.value.indexOf("@")==-1) || (order.order_bill_email.value.indexOf(".")==-1))
         {
			alrt+= (++i)+":"+"Please enter correct E-mail address in Billing Address.\n";
		 }
    }

      if(order.pwd.value =="")
	   {
	     alrt+= (++i)+":"+ 'Please enter  \"Password\" in Billing Details.\n';
		 //order.oldpwd.focus();
		 //return false;
	   }
	  
      	 
	  
	   a = order.pwd.value;
	   b = order.cnfpwd.value;
	   //alert(a.length);
	   
	    if((a.length <5 || a.length >8) && a.length >0)
	   {
	     alrt+= (++i)+': Please enter \"5-8 digit   password\" in Billing Details.\n';
		 //order.cnfnewpwd.focus();
		 //return false;
	   }
	    if(order.cnfpwd.value =='')
	   {
	     alrt+= (++i)+":"+ 'Please enter \"Confirm password\" in Billing Details.\n';
		 //order.newpwd.focus();
		 //return false;
	   }
	     
	   if(a !="" && b!="" &&  a!= b )
	   {
	      if(a.length >4 && a.length <9)
		 alrt+= (++i)+': \"Password and confirm password are not same\" in Billing Details.\n';
		 //order.cnfnewpwd.focus();
		 //return false;
	   }


  //if (order.sameasbilling.checked == false)
 // {
   if (order.order_ship_name.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"First Name\" in Shipping Address.\n";
   }
    if (order.order_ship_lname.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"Last name\" in Shipping Address.\n";
   }
   if (order.order_ship_address.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"Address\" in Shipping Address.\n";
   }
   if (order.order_ship_city.value == "")
   {
      alrt+= (++i)+":"+"Please enter a value for the \"City\" in Shipping Address.\n";
   } 

	if (order.order_ship_country.value == 0)
    {
      	alrt+= (++i)+":"+"Please select a value for the \"Country\" in Shipping Address.\n";
    }
 	
	if (order.order_ship_country.value == "US")
    {
       if (order.order_ship_state.value ==0)
    		{		
				alrt+= (++i)+":"+"Please select a value for the \"State\" in Shipping Address.\n";
			}
    } 		

   if (order.order_ship_zip.value == "")
    {
      alrt+= (++i)+":"+"Please enter a value for the \"Zip\" in Shipping Address.\n";
    } 
	
	
	 if (isNaN(order.order_ship_zip.value))
    {
		  order.order_ship_zip.value = "";
         alrt+= (++i)+":"+"Please enter 5 digit numeric value for the \"Zip\" in Shipping Details.\n";
     
    } 

	if (order.order_ship_zip.value.length >0)
    { 
        if (order.order_ship_zip.value.length <5)
            {
			  alrt+= (++i)+":"+"Please enter a 5 digit numeric value for the \"Zip\" in Shipping Address\n.";
            } 
    } 
	
	if (order.order_ship_phone.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Phone\" in Shipping Address.\n";
    } 

   if(alrt !="")
	{
		 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
	 if(i>9 )
	  		 {
		       order.order_bill_name.focus();
			 }
			  else if(i <=9 && i > 5)
	  		 {
		       order.order_bill_email.focus();
			 }
			  else if(i <= 5 )
	  		 {
		       order.order_ship_name.focus();
			 }
	return false;
	}

var res="true";
//var rad=document.order1.billingtype.value;
//alert(rad+'hi');
var radio1 = order.elements['billingtype'];

			var radioLength=radio1.length;
			for(var i = 0; i < radioLength; i++) 
			{
				if(radio1[i].checked) 
				{
					radioValue= radio1[i].value;
					if(radioValue=="2")
					{
					 res=cc_check(order.ccn.value);
					}
				}
			}
  return (res);
}//function validate order



function validator_Order_ed(order)
{
var i=0;
var alrt="";
    if (order.order_bill_name.value == "")
    {
      alrt+= (++i)+":"+"Please enter a value for the \"First Name \" in Billing Address.\n";
    }
	if (order.order_bill_lname.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"Last Name\" in Billing Address.\n";
    }  
    if (order.order_bill_address.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"Address\" in Billing Address.\n";
    }  
	
	if (order.order_bill_city.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"City \" in Billing Address.\n";
    }  

	if (order.order_bill_country.value == 0)
    {
      	alrt+= (++i)+":"+"Please select a value for the \"Country\" in Billing Address.\n";
    }
 	
	if (order.order_bill_country.value == "US")
    {
       if (order.order_bill_state.value ==0)
    		{		
				alrt+= (++i)+":"+"Please select a value for the \"State\" in Billing Address.\n";
			}
    } 	

    if (order.order_bill_zip.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Zip\" in Billing Address.\n";
    } 

	
	 if (isNaN(order.order_bill_zip.value))
    {
		  order.order_bill_zip.value = "";
          alrt+= (++i)+":"+"Please enter 5 digit numeric value for the \"Zip\" in Billing Details.\n";
      
    } 


	if (order.order_bill_zip.value.length >0)
    {
        if (order.order_bill_zip.value.length <5)
            {
            alrt+= (++i)+":"+"Please enter a 5 digit numeric value for the \"Zip\" in Billing Address.\n";
            } 
    } 
	
	if (order.order_bill_phone.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Phone\" in Billing Address.\n";
    } 
	
	
    if (order.order_bill_email.value == "")
    {
    alrt+= (++i)+":"+"Please enter a value for the \"E-Mail Address\" in Billing Address.\n";
    }

    if( order.order_bill_email.value != "")
    {
      
       if ((order.order_bill_email.value.indexOf("@")==-1) || (order.order_bill_email.value.indexOf(".")==-1))
         {
			alrt+= (++i)+":"+"Please enter correct E-mail address in Billing Address.\n";
		 }
    }
/*
      if(order.pwd.value =="")
	   {
	     alrt+= (++i)+":"+ 'Please enter  \"Password\" in Billing Details.\n';
		 //order.oldpwd.focus();
		 //return false;
	   }
	  
      	 
	  
	   a = order.pwd.value;
	   b = order.cnfpwd.value;
	   //alert(a.length);
	   
	    if((a.length <5 || a.length >8) && a.length >0)
	   {
	     alrt+= (++i)+': Please enter \"5-8 digit   password\" in Billing Details.\n';
		 //order.cnfnewpwd.focus();
		 //return false;
	   }
	    if(order.cnfpwd.value =='')
	   {
	     alrt+= (++i)+":"+ 'Please enter \"Confirm password\" in Billing Details.\n';
		 //order.newpwd.focus();
		 //return false;
	   }
	     
	   if(a !="" && b!="" &&  a!= b )
	   {
	      if(a.length >4 && a.length <9)
		 alrt+= (++i)+': \"Password and confirm password are not same\" in Billing Details.\n';
		 //order.cnfnewpwd.focus();
		 //return false;
	   }
*/

  //if (order.sameasbilling.checked == false)
 // {
   if (order.order_ship_name.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"First Name\" in Shipping Address.\n";
   }
    if (order.order_ship_lname.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"Last name\" in Shipping Address.\n";
   }
   if (order.order_ship_address.value == "")
   {
     alrt+= (++i)+":"+"Please enter a value for the \"Address\" in Shipping Address.\n";
   }
   if (order.order_ship_city.value == "")
   {
      alrt+= (++i)+":"+"Please enter a value for the \"City\" in Shipping Address.\n";
   } 

	if (order.order_ship_country.value == 0)
    {
      	alrt+= (++i)+":"+"Please select a value for the \"Country\" in Shipping Address.\n";
    }
 	
	if (order.order_ship_country.value == "US")
    {
       if (order.order_ship_state.value ==0)
    		{		
				alrt+= (++i)+":"+"Please select a value for the \"State\" in Shipping Address.\n";
			}
    } 		

   if (order.order_ship_zip.value == "")
    {
      alrt+= (++i)+":"+"Please enter a value for the \"Zip\" in Shipping Address.\n";
    } 
	
	
	 if (isNaN(order.order_ship_zip.value))
    {
		  order.order_ship_zip.value = "";
         alrt+= (++i)+":"+"Please enter 5 digit numeric value for the \"Zip\" in Shipping Details.\n";
     
    } 

	if (order.order_ship_zip.value.length >0)
    { 
        if (order.order_ship_zip.value.length <5)
            {
			  alrt+= (++i)+":"+"Please enter a 5 digit numeric value for the \"Zip\" in Shipping Address\n.";
            } 
    } 
	
	if (order.order_ship_phone.value == "")
    {
       alrt+= (++i)+":"+"Please enter a value for the \"Phone\" in Shipping Address.\n";
    } 

   if(alrt !="")
	{
		 if(i==1)
		   alrt=alrt.replace(/1:/, "");
			alert(alrt);
	 if(i>9 )
	  		 {
		       order.order_bill_name.focus();
			 }
			  else if(i <=9 && i > 5)
	  		 {
		       order.order_bill_email.focus();
			 }
			  else if(i <= 5 )
	  		 {
		       order.order_ship_name.focus();
			 }
	return false;
	}

var res="true";
//var rad=document.order1.billingtype.value;
//alert(rad+'hi');
var radio1 = order.elements['billingtype'];

			var radioLength=radio1.length;
			for(var i = 0; i < radioLength; i++) 
			{
				if(radio1[i].checked) 
				{
					radioValue= radio1[i].value;
					if(radioValue=="2")
					{
					 res=cc_check(order.ccn.value);
					}
				}
			}
  return (res);
}//function validate order



function validator_Order_edit(order)
{
//alert("hi"+order.ccn.value);
var arr1=new Array(2);
var err1=new Array();
var i=0;
err1['0']="";
err1['1']="";
err1['2']="";
err1['3']="";
err1['4']="";
err1['5']="";
err1['6']="";
err1['7']="";
err1['8']="";
err1['9']="";
err1['10']="";
err1['11']="";
err1['12']="";
err1['13']="";
err1['14']="";
err1['15']="";

alrt="";


    if (order.order_bill_name.value == "")
    {
      err1['0']="Please enter a value for the \"Name \" in Billing Address.";
    }
    if (order.order_bill_address.value == "")
    {
    err1['1']="Please enter a value for the \"Address1\" in Billing Address.";
    }  
	
	if (order.order_bill_city.value == "")
    {
    err1['2']="Please enter a value for the \"City \" in Billing Address.";
    }  
	
    if (order.order_bill_zip.value == "")
    {
       err1['3']="Please enter a value for the \"Zip\" in Billing Address.";
    } 

	
	 if (isNaN(order.order_bill_zip.value))
    {
		  order.order_bill_zip.value = "";
          err1['4']="Please enter 5 digit numeric value for the \"Zip\" in Billing Details.";
      
    } 

	if (order.order_bill_zip.value.length >0)
    {
        if (order.order_bill_zip.value.length <5)
            {
            err1['5']="Please enter a 5 digit numeric value for the \"Zip\" in Billing Address.";
            } 
    } 
	
	if (order.order_bill_phone.value == "")
    {
       err1['6']="Please enter a value for the \"Phone\" in Billing Address.";
    } 
	
    if (order.order_bill_email.value == "")
    {
     err1['7']="Please enter a value for the \"E-Mail Address\" in Billing Address.";
    }

    if( order.order_bill_email.value != "")
    {
      
       if ((order.order_bill_email.value.indexOf("@")==-1) || (order.order_bill_email.value.indexOf(".")==-1))
         {
			err1['8']="Please enter correct E-mail address in Billing Address.		";
		 }
    }

  //if (order.sameasbilling.checked == false)
 // {
   if (order.order_ship_name.value == "")
   {
     err1['9']="Please enter a value for the \"Name\" in Shipping Address.";
   }
   if (order.order_ship_address.value == "")
   {
     err1['10']="Please enter a value for the \"Address1\" in Shipping Address.";
   }
   if (order.order_ship_city.value == "")
   {
      err1['11']="Please enter a value for the \"City\" in Shipping Address.";
   } 
   if (order.order_ship_zip.value == "")
    {
      err1['12']="Please enter a value for the \"Zip\" in Shipping Address.";
    } 
	
	
	 if (isNaN(order.order_ship_zip.value))
    {
		  order.order_ship_zip.value = "";
         err1['13']="Please enter 5 digit numeric value for the \"Zip\" in Shipping Details.";
     
    } 

	if (order.order_ship_zip.value.length >0)
    { 
        if (order.order_ship_zip.value.length <5)
            {
			  err1['14']="Please enter a 5 digit numeric value for the \"Zip\" in Shipping Address.";
            } 
    } 
	
	if (order.order_ship_phone.value == "")
    {
       err1['15']="Please enter a value for the \"Phone\" in Shipping Address.";
    } 
  //}//if same as billing
 
 if(err1['0'] != "" || err1['1'] !="" || err1['2'] !="" || err1['3'] != "" || err1['4'] !="" || err1['5'] !="" || err1['6'] != "" || err1['7'] !="" || err1['8'] !="" || err1['9'] !="" || err1['10'] !="" || err1['11'] !="" || err1['12'] !="" || err1['13'] !="" || err1['14'] !="" || err1['15'] !="")
 {

    if(err1['0'] !="")
    {
	alrt +=(++i)+" : "+err1['0']+"\n";
	}
	

	if(err1['1'] !="")
    {
	alrt +=(++i)+" : "+err1['1']+"\n";
	}
	
	if(err1['2'] !="")
	{
	alrt +=(++i)+" : "+err1['2']+"\n";
	}
    if(err1['3'] !="")
    {
	alrt +=(++i)+" : "+err1['3']+"\n";
	}
	

	if(err1['4'] !="")
    {
	alrt +=(++i)+" : "+err1['4']+"\n";
	}
	
	if(err1['5'] !="")
	{
	alrt +=(++i)+" : "+err1['5']+"\n";
	}
    if(err1['6'] !="")
    {
	alrt +=(++i)+" : "+err1['6']+"\n";
	}
	

	if(err1['7'] !="")
        {
	alrt +=(++i)+" : "+err1['7']+"\n";
	}
	if(err1['8'] !="")
        {
	alrt +=(++i)+" : "+err1['8']+"\n";
	}
	if(err1['9'] !="")
    {
	alrt +=(++i)+" : "+err1['9']+"\n";
	}
	
	if(err1['10'] !="")
    {
	alrt +=(++i)+" : "+err1['10']+"\n";
	}
	if(err1['11'] !="")
    {
	alrt +=(++i)+" : "+err1['11']+"\n";
	}
	if(err1['12'] !="")
    {
	alrt +=(++i)+" : "+err1['12']+"\n";
	}
	if(err1['13'] !="")
    {
	alrt +=(++i)+" : "+err1['13']+"\n";
	}
	if(err1['14'] !="")
    {
	alrt +=(++i)+" : "+err1['14']+"\n";
	}
	if(err1['15'] !="")
    {
	alrt +=(++i)+" : "+err1['15']+"\n";
	}

   if(alrt !="")
	{
	 if(i==1)
	  alrt=alrt.replace(/1:/, "");		
	alert(alrt);
	return false;
	}
}
var res="true";
	
 res=cc_check(order.ccn.value);
				
  return (res);
}//function validate order

// for credit card redio button

function ccn1()
{
var radio1 = document.forms['order'].elements['billingtype'];
			var radioLength=radio1.length;
			for(var i = 0; i < radioLength; i++) 
			{
				if(radio1[i].checked) 
				{
					radioValue= radio1[i].value;
					if(radioValue==1 || radioValue==3)
					{
					//document.getElementById("ccn2").style.visibility="visible";
					document.getElementById("ccn2").style.display="none";
					}
					else document.getElementById("ccn2").style.display="block";
				}
			}
}			
   

 function checkbox(obj)
   {
    //alert(obj);
     var count=0;
	 //alert(document.frmBooking.elements.length);
	 
     for(i=0;i<obj.elements.length;i++)
	  {
	      if(obj.elements[i].type == 'checkbox')
		    {
			  if(obj.elements[i].checked  == false)
			  {
				
			  }
			  else
			   {
				 count = count + 1;
				 
			   }
			    
			}

		}
		
		 if(count == 0)
			{
			  alert('Please select at least one item.');
			  return false;
			}
				
	  return true;
   }  
function hide(val)
{
//alert (val);
document.getElementById(val).style.visibility="hidden";
return false;
}
//this function is used in newspaperdelevery.php
function sub_option(obj)
{
//alert(obj.name);
//alert("hi");
var val=obj.select.value;
if(val==0)
{
alert("Please select Subscription Option.");
return false;
}
return true;
}

 function textbox(obj,id)
   {
//alert(id);
var count=0;
	
     for(i=0;i<obj.elements.length;i++)
	  {//alert(obj.elements[i].name); 
	      if(obj.elements[i].type == 'text')
		    {

			  if(obj.elements[i].value  == 0 || obj.elements[i].value  == "")
			  {
				
			  }
			  else
			   {
				 count = count + 1;
				 
			   }
			    
			}

		}
		
		 if(count == 0)
			{
			  alert('Please enter quantity for at least one item.');
			  return false;
			}



   // alert(id); 
if(id==12)
{ 



	var sum=0;
		 
     for(i=0;i<obj.elements.length;i++)
	  {
//alert(obj.elements.length);

	      if(obj.elements[i].type == 'text')
		    {
			sum =(sum-0)+(obj.elements[i].value-0);

			}

		}
		
var mod=sum%4;
		 if(mod != 0)
			{
			  alert('Bagels must be in a multiple of 4.');
			  return false;
			}
}
	  return true;
   }  
 

function check(obj)
   {
//alert(obj);
var count=0;
	
     for(i=0;i<obj.elements.length;i++)
	  {//alert(obj.elements[i].value); 
	     
			  if((obj.elements[i].value  == 0 || obj.elements[i].value  == "") || obj.elements[i].value  != "Submit")
			  {
				 count = count + 1;
			  }
			  else
			   {
				
				 
			   }
			    
			

		}
		
		 if(count != 0)
			{
			  alert('All fields are mandatary.');
			  return false;
			}
return true;
}


//improved function
 function check(obj)
   {
//alert(obj);
var alrt="";
var j=0;
	
     for(i=0;i<obj.elements.length;i++)
	  {//alert(obj.elements[i].value); 
	     
			  if(obj.elements[i].value  == 0 || obj.elements[i].value  == "") 
			  {
				 alrt+= (++j)+":"+" Please select a value for the "+obj.elements[i].name+".\n";
			  }
			  			

	}
		
 if(alrt !="")
	{
	 if(j==1)
	  alrt=alrt.replace(/1:/, "");		
	alert(alrt);
	return false;
	}
return true;
}