function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//*******************************************************************************************
function validateEmail(email){
	
	// This function is used to validate a given e-mail 
	// address for the proper syntax
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}


function validate_user()
{
frm = document.CC_form;
frm = document.CC_form;
if(frm.bfirst_name.value ==""){alert("Please enter the billing first name");frm.bfirst_name.focus();return false;}
if(frm.blast_name.value ==""){alert("Please enter the billing Last name");frm.blast_name.focus();return false;}
if(frm.blast_name.value.length>50){alert("Billing Last name too long");frm.blast_name.focus();return false;}

if(frm.b_addr.value ==""){alert("Please enter the Billing Address");frm.b_addr.focus();return false;}
if(frm.bcity.value ==""){alert("Please enter the billing City");frm.bcity.focus();return false;}
if(frm.bcity.value.length>100){alert("Billing City is too long");frm.bcity.focus();return false;}

if(frm.bstate.value ==""){alert("Please enter the billing state");frm.bstate.focus();return false;}
if(frm.bcounty.value ==""){alert("Please enter the billing county");frm.bcounty.focus();return false;}
if(frm.bzip.value ==""){alert("Please enter the billing Zip");frm.bzip.focus();return false;}
if(frm.bzip.value.length>5){alert("Billing Zip is too long");frm.bzip.focus();return false;}
if(isNaN(frm.bzip.value)){alert("Please enter numeric value");frm.bzip.focus();return false;}
if(frm.bphone.value.length>50){alert("Billing Phone is too long");frm.bphone.focus();return false;}

if (!validateEmail(frm.bemail.value)){alert("Please enter the correct billing email address");frm.bemail.focus();return false;}
if(frm.bemail.value.length>100){alert("Billing Email is too long");frm.bemail.focus();return false;}


if(frm.sfirst_name.value ==""){alert("Please enter the shipping first name");frm.sfirst_name.focus();return false;}
if(frm.slast_name.value ==""){alert("Please enter the shipping Last name");frm.slast_name.focus();return false;}
if(frm.slast_name.value.length>50){alert("Shipping Last name too long");frm.slast_name.focus();return false;}

if(frm.s_addr.value ==""){alert("Please enter the shipping Address");frm.s_addr.focus();return false;}
if(frm.scity.value ==""){alert("Please enter the shipping City");frm.scity.focus();return false;}
if(frm.scity.value.length>100){alert("Shipping City is too long");frm.scity.focus();return false;}

if(frm.sstate.value ==""){alert("Please enter the shipping state");frm.sstate.focus();return false;}
if(frm.scounty.value ==""){alert("Please enter the shipping county");frm.scounty.focus();return false;}
if(frm.szip.value ==""){alert("Please enter the shipping Zip");frm.szip.focus();return false;}
if(frm.szip.value.length>5){alert("Shipping Zip is too long");frm.szip.focus();return false;}
if(isNaN(frm.szip.value)){alert("Please enter numeric value");frm.szip.focus();return false;}
if(frm.sphone.value.length>50){alert("Shipping Phone is too long");frm.sphone.focus();return false;}


return true;
//submit++;
}

function copybillingvalues()
{
	frm = document.CC_form;
	
	if(frm.copyval.checked)
	{
		frm.sfirst_name.value =frm.bfirst_name.value
		frm.slast_name.value =frm.blast_name.value
		frm.s_addr.value =frm.b_addr.value
		frm.scity.value =frm.bcity.value
		frm.sstate.value =frm.bstate.value
		frm.scounty.value=frm.bcounty.value
		frm.szip.value =frm.bzip.value
		frm.sphone.value=frm.bphone.value
	}
	else
	{
		frm.sfirst_name.value =""
		frm.slast_name.value =""
		frm.s_addr.value =""
		frm.scity.value =""
		frm.sstate.value =""
		frm.szip.value =""
		frm.sphone.value=""
	}
}

function validate_cc_info()
{
frm = document.billing_form;
if (frm.ccnumber.value=='') {alert("Please enter the credit card number");frm.ccnumber.focus();return false;}
if (isNaN(frm.ccnumber.value)) {alert("Invalid credit card number. Make sure it doesn't contain any alphabets, spaces Or characters like -,# etc"); frm.ccnumber.focus();return false; }
if(frm.ccnumber.value.length>100){alert("Credit Card Number is too long");frm.ccnumber.focus();return false;}

if (frm.month.value=='') {alert("Month of expiry can not be blank");frm.month.focus();return false;}
if (frm.year.value=='') {alert("Year of expiry can not be blank");frm.year.focus();return false;}

if(frm.cardcode.value=="" && !(frm.not_on_card.checked || frm.cantread.checked))
{	
	
		alert("Please enter the card verification number");
		frm.cardcode.select();
		return false;
		
}
if (frm.submit > 0 ) return false;
alert('Your payment is currently being processed. This process could take up to 60 seconds to complete.\n\n'+'Please wait till you receive the payment confirmation on your screen. Your screen may remain blank or unchanged for some time before you get your confirmation.\n\n'+'Please click "OK" below to close this box');

}

function validate_mailform()
{
	frm=document.send_mail
	if(frm.realname.value=="")
	{
		alert("Please enter your name");
		frm.realname.focus();
		return false;
	}
	if(!validateEmail(frm.email.value))
	{
		alert("Please enter the correct email address");
		frm.email.focus();
		frm.email.select();
		return false;
	}
	return true;
}//validate_mailform()

function validate_frmgetshipping()
{	
	if(frmgetshipping.zipcode.value=="" || frmgetshipping.zipcode.value=="0")
	{
		alert("Please enter the zip code");
		frmgetshipping.zipcode.select();
		return false;
	}
}
function viewWin(filename)
	{
	var mybars='width=450,height=350,directories=no,location=no,menubar=no,status=no,screenX=0,screenY=0';
	mybars+=',titlebar=no,toolbar=no';
	myoptions='scrollbars=yes,resizeable=yes';
	myfeatures=mybars+ ','+myoptions
	var newin=open(filename,'mydoc',myfeatures);
	}