function validateEmail(email)
{
	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 display_products(catid,totnum)
{
	var i, divid;
	for(i=1;i<=totnum;i++)
	{
		divid = "p_under_cat"+i;
		document.getElementById(divid).style.display="none";
	}
	
	divid = "";
	
	divid = "p_under_cat"+catid;
	document.getElementById(divid).style.display="block";
	
	
}


function display_categories(col_id, totnum)
{
	var i, divid;
	for(i=1;i<=totnum;i++)
	{
		divid = "cat_under_col"+i;
		document.getElementById(divid).style.display="none";
	}
	
	divid = "";
	
	divid = "cat_under_col"+col_id
	document.getElementById(divid).style.display="block";
}

function display_products_under_collection(collid, catid, totnum)
{
		var i, divid;
		for(i=1;i<=totnum;i++)
		{
			divid = "p_under_col"+ collid + "_cat" + i ;
			document.getElementById(divid).style.display="none";
		}
		divid = "";
		divid = "p_under_col"+collid + "_cat" + catid;
		document.getElementById(divid).style.display="block";
}



function check_quantity()
{
	with(document.f_p_detail)
	{
		if (quantity.value=="") { alert("Please enter a quantity."); quantity.focus(); return false; }
		if (isNaN(quantity.value)) { alert("Please enter a Numeric Value."); quantity.focus(); return false; }
	}
}







function check_bill_ship()
{
	with (document.form1)
	{
		if (fname.value=="") { alert("Please Enter the First Name"); fname.focus(); return false;}
		if (lname.value==""){alert ("Please Enter the Last Name"); lname.focus();return false;}
		if (address.value==""){alert ("Please Enter Address 1"); address.focus();return false;}
		if (city.value==""){alert ("Please Enter City"); city.focus();return false;}
		if (state.value==false){alert ("Please Select State"); state.focus();return false;}
		if (zip.value==""){alert ("Please Enter Zip"); zip.focus();return false;}
		if (email.value==""){alert ("Please Enter Email Address"); email.focus();return false;}
		if (!validateEmail(email.value)) {alert ("Please enter the correct Email Address") ; email.focus(); return false ; }
		if (telephone.value==""){alert ("Please Enter Telephone Number");telephone.focus();return false;}
		
		
		
		if (sh_fname.value=="") { alert("Please Enter the First Name"); sh_fname.focus(); return false;}
		if (sh_lname.value==""){alert ("Please Enter the Last Name"); sh_lname.focus();return false;}
		if (sh_address.value==""){alert ("Please Enter Address 1"); sh_address.focus();return false;}
		if (sh_city.value==""){alert ("Please Enter City"); sh_city.focus();return false;}
		if (sh_state.value==false){alert ("Please Select State"); sh_state.focus();return false;}
		if (sh_zip.value==""){alert ("Please Enter Zip"); sh_zip.focus();return false;}
		if (sh_email.value==""){alert ("Please Enter Email Address");sh_email.focus();return false;}
		if (!validateEmail(sh_email.value)) {alert ("Please enter the correct Email Address") ; sh_email.focus(); return false ; }
		if (sh_telephone.value==""){alert ("Please Enter Telephone Number");sh_telephone.focus();return false;}
		
		
		
		
		
	}
	
	
}


function billship()
{
	
window.document.form1.sh_fname.value=window.document.form1.fname.value;
window.document.form1.sh_lname.value=window.document.form1.lname.value;
window.document.form1.sh_address.value=window.document.form1.address.value;
window.document.form1.sh_city.value=window.document.form1.city.value;
window.document.form1.sh_country.value=window.document.form1.country.value;
window.document.form1.sh_zip.value=window.document.form1.zip.value;
window.document.form1.sh_state.value=window.document.form1.state.value;
window.document.form1.sh_email.value=window.document.form1.email.value;
window.document.form1.sh_telephone.value=window.document.form1.telephone.value;

}



function chk_credit()
{
	with(document.form2)
	{
		
		if (cardtype.value=="") { alert("Select Card Type."); cardtype.focus(); return false; }
		if (cardnumber.value=="") { alert("Enter Card Number."); cardnumber.focus(); return false; }
		if (chfname.value=="") { alert("Enter First Name on card."); chfname.focus(); return false; }
		if (chlname.value=="") { alert("Enter Last Name on card."); chlname.focus(); return false; }
		if (cvno.value=="") { alert("Enter Card Verification Number."); cvno.focus(); return false; }
		
		
	}
}
