String.prototype.trim = function () { return this.replace(/^\s+/,'').replace(/\s+$/,''); };
var emailFilter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

function uncheckOthers(formId, id, prefix) {
	var formControl = document.getElementById(formId);
	var elements = formControl.elements;
	for ( var i = 0; i < elements.length; i++) {
		if (elements[i].type == 'radio') {
			if (elements[i].id.indexOf(prefix) != -1 && elements[i].id != id) {
				elements[i].checked = false;
			}
		}
	}
}
function checkInput(theBox, defaultValue, defaultMessage, email) { 
	if (theBox.value == null || theBox.value.trim().length == 0){ 
		alert(defaultMessage); 
		return false; 
	}  
	if (defaultValue != null && defaultValue.trim().length > 0 && theBox.value.trim() == defaultValue){ 
		alert(defaultMessage);
		return false;
	} 
	if (email != null && email){
		if (emailFilter.test(theBox.value.trim()) == false) {
			alert('Your email address ['+theBox.value+'] is invalid, please re-enter');
			return false;
		}
	}
	return true; 
}
function updateSameAsBilling(theBox, target){ 
	if (theBox != null){ 
		if (theBox == '2'){  			
			if (target != null){ 
				target.checked = false;
			}	 
		}  
	}  
}
function Priority_info(x) {
	if (x == "show") {
		document.getElementById("Priority_info_box").style.display = "block";
	}
	else if (x == "hide"){
		document.getElementById("Priority_info_box").style.display = "none";
	}
} 
function open_win3(zoom) {
	var new_Window3 = window.open(zoom, "new_Window3", "HEIGHT=800,WIDTH=700,scrollbars=no,menubar=no");
}

function open_win360(zoom360) {
	var new_Win360 = window.open(zoom360, "new_Win360", "HEIGHT=800,WIDTH=700,scrollbars=no,menubar=no");
}

//QuickView	 
function showQVButton(buttonNumber) {
	document.getElementById("quickDetailButton" + buttonNumber).style.display = "";
}
function hideQVButton(buttonNumber) {
	document.getElementById("quickDetailButton" + buttonNumber).style.display = "none";
}
function swapImageIn(i,imgPath) {		
	document.getElementById("qImg_"+i).src=imgPath+"/images/quick_detail_button_over.gif";	
}
function swapImageOut(i,imgPath) {		
	document.getElementById("qImg_"+i).src=imgPath+"/images/quick_detail_button.gif";	
}
//end of quickView	 


// BEGIN EMAIL VALIDATION SCRIPTS
var form; 


function showHide (id) {
	var style = document.getElementById(id).style;
	if (style.visibility == "hidden"){
		style.visibility = "visible";
	}else{
		style.visibility = "hidden";
	}
	
}


function closeSoftPop() {

killSoftPop = 1;
softPopWindow = window.open("","softPopWindow","status=1,width=350,height=150");

softPopWindow.close();

}

//Limit the # of characters by truncating to the specified length
function messageLimit(messageArea, length) {
	if (messageArea.value.length > length) {
		messageArea.value = messageArea.value.substring(0, length);
	} 
}
 

