//this checks to ensure that the mouse over / outs works perfectl and don't cause problems with accidental layer roll errors
function isMouseLeaveOrEnter(e, handler) { 

	if (e.type != 'mouseout' && e.type != 'mouseover') return false; 
	var reltg = e.relatedTarget ? e.relatedTarget : 
	e.type == 'mouseout' ? e.toElement : e.fromElement; 
	while (reltg && reltg != handler) reltg = reltg.parentNode; 
	return (reltg != handler); 
}


function openMenuDropDown(whichtarget) {
	document.getElementById(whichtarget).style.display = 'block';
	if (whichtarget == 'themenudropdown') {
		//document.getElementById('mainmenuh2title').style.border = '1px solid #FFFFFF';
	}

}
function closeMenuDropDown(whichtarget) {
	document.getElementById(whichtarget).style.display = 'none';
		if (whichtarget == 'themenudropdown') {
			//document.getElementById('mainmenuh2title').style.border = '1px solid #366580';
		}
}
function highlightMainMenuRollOver(whichtarget1, whichtarget2) {
	document.getElementById(whichtarget1).style.backgroundColor = 'none';
	document.getElementById(whichtarget2).style.color = 'none';
}
function unHighlightMainMenuRollOver(whichtarget1, whichtarget2) {
	document.getElementById(whichtarget1).style.backgroundColor = 'none';
	document.getElementById(whichtarget2).style.color = 'none';
}



function sameAsBilling () {
if (document.getElementById('checkbox_sameas').checked) {
	document.getElementById('shipping_address_contact_name').value = document.getElementById('billing_address_contact_name').value;
	document.getElementById('shipping_address_company_name').value = document.getElementById('billing_address_company_name').value;
	document.getElementById('shipping_address_address').value = document.getElementById('billing_address_address').value;
	document.getElementById('shipping_address_address2').value = document.getElementById('billing_address_address2').value;
	document.getElementById('shipping_address_phone').value = document.getElementById('billing_address_phone').value;
	document.getElementById('shipping_address_postal_code').value = document.getElementById('billing_address_postal_code').value;
	document.getElementById('shipping_address_city').value = document.getElementById('billing_address_city').value;
 if (document.getElementById('isit_international').value == "true") {
	 document.getElementById('shipping_address_state').value = document.getElementById('billing_address_state').value;
 } else {
	 document.getElementById('shipping_address_state').selectedIndex = document.getElementById('billing_address_state').selectedIndex;
 }
	 document.getElementById('shipping_address_country').selectedIndex = document.getElementById('billing_address_country').selectedIndex;
 }
 }
 function switchOffSameAsCheck () {
	 document.getElementById('checkbox_sameas').checked = false;
 }




function verifyEmail(){
 var emailRegEx = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
 reEmailAddress = new RegExp(emailRegEx);
 var theemailaddress = document.getElementById('email').value;
 if (!reEmailAddress.test(theemailaddress)) {
 return "notvalid";
 } else if (document.getElementById('email').value != document.getElementById('email_reentry').value) {
 return "nomatch";
 } else {
 return "valid";
 }


}
function verifyPhoneNumber() {
 var thephonenumber = document.getElementById('phone').value;
 var phonePattern = /(\+)?([-\._\(\) ]?[\d]{3,20}[-\._\(\) ]?){2,10}/;
 rePhoneNumber = new RegExp(phonePattern);
 if (!rePhoneNumber.test(thephonenumber)) {
 return false;
 } else {
 return true;
 }
}

function hideSendButton () {
	document.getElementById('sendquote_area').innerHTML = "<p style=\"margin:0px;\">Sending quote... Please wait</p>";
}
function showSendButton () {

}

