function menudropdown(section) {
	if (document.getElementById) {
		var toggle = document.getElementById(section).style;
		if (toggle.display == "block") {
			toggle.display = "none"; }
		else { toggle.display = "block"; }
			return false; }
			else { return true; }
}

 function countCheckBox() {
    var collection = document.getElementsByName('productcodes');
	var j=0;

	for(i=0;i<collection.length;i++)
	{
		if(document.getElementsByName('productcodes')[i].checked==true)
		{
		j++;
		}
	}
	if(j>3)
	{
		alert('Only three (3) boxes may be checked at once');
		return false;
		//event.returnValue=false;
	}
  }
  
  function toggle(showHideDiv, switchTextDiv) {
	var ele = document.getElementById(showHideDiv);
	var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "inline") {
    		ele.style.display = "none";
		text.innerHTML = '';
  	}
	else {
		ele.style.display = "inline";
		text.innerHTML = '';
	}
} 
		
		
		
function dispcountry(obj,id1) {
txt = obj.options[obj.selectedIndex].value;
if ( document.billing.Country.value == '' ) {
	alert('Please select your billing country');
	return false;
}
if ( txt.match(id1) ) {
	document.getElementById(id1).style.display = 'block';
	document.getElementById('intl').style.display = 'none';
	}
	else
	{
	document.getElementById(id1).style.display = 'none';
	document.getElementById('intl').style.display = 'block';
	}
document.getElementById('countrychk').style.display = 'none';
document.getElementById('countryok').style.display = 'block';
document.getElementById('shipoption').style.display = 'block';
document.getElementById('countryshipoption').style.display = 'block';
}

function dispshipaddr(obj) {
if (obj==1) {
	document.getElementById('shipaddr').style.display = 'block';
	}
else
	{
	document.getElementById('shipaddr').style.display = 'none';
	}
}
function chkpuertorico(){
	if (document.billing.State.value == 'PR') {
		document.getElementById('001').style.display = 'none';
		document.getElementById('intl').style.display = 'block';
		goToOption(document.billing.Country,'248');
	}
}
function goToOption(sel, val) {
	var opt, o = 0;
	while (opt = sel[o++]) if (opt.value == val) sel.selectedIndex = o - 1;
}



function checkWholeForm() {
    var why = "";
   	// all required fields
	if (document.billing.Country.value == '') {
		why += "Billing Country is required!\n"
		}
	if (document.billing.FirstName.value == '') {
		why += "Billing First Name is required!\n"
		}
	if (document.billing.LastName.value == '') {
		why += "Billing Last Name is required!\n"
		}
	if (document.billing.Address1.value == '') {
		why += "Billing Address is required!\n"
		}
	if (document.billing.Address1.value == parseFloat(document.billing.Address1.value)) {
		why += "Billing Address number and street name must be on the same address line!\n"
		}
	if (document.billing.City.value == '') {
		why += "Billing City is required!\n"
		}
	// condition usa only required fields
	if (document.billing.Country.value == '001' ) {
			if (document.billing.State.value == '') {
			why += "Billing State is required!\n"
			}
			
		}
	//if different shipping addr - shipinfo_b checked
	if (document.billing.shipinfo_b.checked) {
		if (document.billing.s_country.value == '') {
		why += "Shipping Country is required!\n"
			}
		if (document.billing.s_FirstName.value == '') {
			why += "Shipping First Name is required!\n"
			}
		if (document.billing.s_LastName.value == '') {
			why += "Shipping Last Name is required!\n"
			}
		if (document.billing.s_Address1.value == '') {
			why += "Shipping Address is required!\n"
			}
		if (document.billing.s_Address1.value == parseFloat(document.billing.s_Address1.value)) {
			why += "Shipping Address number and street name must be on the same address line!\n"
			}
		if (document.billing.s_City.value == '') {
			why += "Shipping City is required!\n"
			}
		// condition usa shipping only required fields
		if (billing.s_country.value == '001' ) {
			if (billing.s_State.value == '') {
			why += "Shipping State is required!\n"
			}
		
		}
	}
	if (why != "") {
       alert(why);
       return false;
    }
return true;
}

	
function selectProduct(code,url) {
	if (code != "yes" && code != "no") {
		window.location = url + code;
	}
}



// If the page is inside a frame it replaces the top frame with itself
if ((top != self) && (window.location.href.toLowerCase().indexOf('frames=yes') == -1) && (window.location.href.toLowerCase().indexOf('/frames/yes') == -1))
{
  top.location.replace(self.location.href);
}