function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=450,left = 100,top = 150');");
}

function dropdown(obj,stat) {
	idx=fDOM(obj);
	idx.style.visibility=(stat) ? "visible" : "hidden";
}
function fDOM(obj) {
	if (document.getElementById) return (document.getElementById(obj));
	else return (0);
}

function fnUpdatePayPalForm(oForm){
	oSelect = oForm.elements.os0;
	if (oSelect.selectedIndex < 0) return false;
	
	oOption = oSelect.options[oSelect.selectedIndex];
	
	strAmount = oOption.getAttribute('amount');
	strShipping = oOption.getAttribute('shipping');
	strItemNumber = oOption.getAttribute('item_number');
	
	oForm.elements.amount.value = strAmount;
	oForm.elements.shipping.value = strShipping;
	oForm.elements.item_number.value = strItemNumber;
	
	return true;
}

function fnDisplayPrice(oSelect,strSpanId){
	oDisplaySpan = document.getElementById(strSpanId);
	
	if (oSelect.selectedIndex < 0 || !oDisplaySpan) return false;
	oOption = oSelect.options[oSelect.selectedIndex];
	
	strAmount = oOption.getAttribute('amount');
	
	oDisplaySpan.innerText = '$'+strAmount;
	return true;
}

function fnDisplayShipping(oSelect,strSpanId){
	oDisplaySpan = document.getElementById(strSpanId);
	
	if (oSelect.selectedIndex < 0 || !oDisplaySpan) return false;
	oOption = oSelect.options[oSelect.selectedIndex];
	
	strAmount = oOption.getAttribute('shipping');
	
	oDisplaySpan.innerText = '$'+strAmount;
	return true;
}	

function fnValidate(f) {
	if (f.email.value.length == 0){
		alert('Please enter your Email to continue.');
		f.email.focus();
		return false;
	}
	if (!IsValidEmail(f.email.value)){
		alert('Please enter a valid Email to continue.');
		f.email.focus();
		return false;
	}
	return true;
}

function IsValidEmail(val) {
	var iLen = val.length;
	if 	((iLen < 6) || (val.indexOf('@') < 1) || ((val.charAt(iLen - 3) != '.') && (val.charAt(iLen - 4) != '.') && (val.charAt(iLen - 5) != '.')) ) return false;
	return true;
}

function IsNumeric(val) {
	var ValidChars = "0123456789.-()";
	for (i=0; i<val.length; i++) {
		if (ValidChars.indexOf(val.charAt(i)) == -1) return false;
	}
	return true;
}	
