function open_window(link,w,h) //opens new window
{
	var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(link,'newWin',win);
	newWin.focus();
}

function confirmDelete() //unsubscription confirmation
{
	temp = window.confirm('{/literal}{$smarty.const.QUESTION_UNSUBSCRIBE}{literal}');
	if (temp) //delete
	{
		window.location="index.php?killuser=yes";
	}
}

function hidediv(div){
	document.getElementById(div).style.display = 'none';
}

function showdiv(div){
	document.getElementById(div).style.display = 'block';
}

function validate_custinfo() //validate customer information
{
	if (document.custinfo_form.first_name.value=="" || document.custinfo_form.last_name.value=="")
	{
		alert("Shipping Name Required");
		return false;
	}
	if (document.custinfo_form.email.value=="")
	{
		alert("Shipping Email Required");
		return false;
	}
	if (document.custinfo_form.address1.value=="")
	{
		alert("Shipping Address Required");
		return false;
	}

	if (document.custinfo_form.country.value=="")
	{
		alert("Shipping Country Required");
		return false;
	}
	if (document.custinfo_form.state.value=="")
	{
		alert("Shipping State Required");
		return false;
	}
	if (document.custinfo_form.zip.value=="")
	{
		alert("Shipping Zip Required");
		return false;
	}
	if (document.custinfo_form.city.value=="")
	{
		alert("Shipping City Required");
		return false;
	}
	
	// BILLING INFO
	
	if (document.custinfo_form.bill_first_name.value=="" || document.custinfo_form.bill_last_name.value=="")
	{
		alert("Billing Name Required");
		return false;
	}
	if (document.custinfo_form.bill_email.value=="")
	{
		alert("Billing Email Required");
		return false;
	}
	if (document.custinfo_form.bill_address1.value=="")
	{
		alert("Billing Address Required");
		return false;
	}

	if (document.custinfo_form.bill_country.value=="")
	{
		alert("Billing Country Required");
		return false;
	}
	if (document.custinfo_form.bill_state.value=="")
	{
		alert("Billing State Required");
		return false;
	}
	if (document.custinfo_form.bill_zip.value=="")
	{
		alert("Billing Zip Required");
		return false;
	}
	if (document.custinfo_form.bill_city.value=="")
	{
		alert("Billing City Required");
		return false;
	}		


	return true;
}

function sameinfo(){
	theform = document.getElementById('custinfo_form');

	theform.bill_first_name.value = theform.first_name.value;
	theform.bill_last_name.value = theform.last_name.value;
	theform.bill_email.value = theform.email.value;
	theform.bill_phone.value = theform.phone.value;
	theform.bill_address1.value = theform.address1.value;
	theform.bill_address2.value = theform.address2.value;
	theform.bill_city.value = theform.city.value;
	theform.bill_state.selectedIndex = theform.state.selectedIndex;
	theform.bill_zip.value = theform.zip.value;
	theform.bill_country.value = theform.country.value;

}

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
