var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=no'
win = window.open(mypage,myname,settings)
}

function hideshow(obj) { 
	if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1) {
		if (obj.style.display=="none") 
			obj.style.display="";
		else
			obj.style.display="none";
	}
} 	

function validdel(url, txt, page, emp) {
	resultat = confirm("Are you sure you want the following element?\n"+txt);
	if (resultat==true) {
		showcontent(url, page, emp);
	}
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("page_content").getElementsByTagName("span");
		if(el.style.display != "block"){
			for (var i=0; i<ar.length; i++){
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}

function validreg() {
	if(document.frm_reg.firstname.value==""){document.frm_reg.firstname.focus();alert("Please, enter your first name");return false;}
	if(document.frm_reg.lastname.value==""){document.frm_reg.lastname.focus();alert("Please, enter your last name");return false;}
	if(document.frm_reg.job_title.value==""){document.frm_reg.job_title.focus();alert("Please, enter your job title");return false;}
	if(document.frm_reg.organization.value==""){document.frm_reg.organization.focus();alert("Please, enter your organization");return false;}
	if(document.frm_reg.address.value==""){document.frm_reg.address.focus();alert("Please, enter your address");return false;}
	if(document.frm_reg.city.value==""){document.frm_reg.city.focus();alert("Please, enter your city");return false;}
	if(document.frm_reg.country.value==""){document.frm_reg.country.focus();alert("Please, select your country");return false;}
	if(document.frm_reg.stateprov.value==""){document.frm_reg.stateprov.focus();alert("Please, select your province/state");return false;}
	if(document.frm_reg.zip.value==""){document.frm_reg.zip.focus();alert("Please, enter your zip/postal code");return false;}
	if(document.frm_reg.phone.value==""){document.frm_reg.phone.focus();alert("Please, enter your phone number");return false;}
	if(document.frm_reg.email.value==""){document.frm_reg.email.focus();alert("Please, enter your email");return false;}
	if(document.frm_reg.cemailerror.value=="true"){document.frm_reg.email.focus();alert("Please, enter a valid email");return false;}
	if(document.frm_reg.price.value==""){document.frm_reg.price.focus();alert("Please, select a registration");return false;}
	if(document.frm_reg.method_payment.value==""){document.frm_reg.method_payment.focus();alert("Please select a method of payment");return false;}
	if((document.frm_reg.method_payment.value=="promo") && (document.frm_reg.val_promo.value=="False")){document.frm_reg.price.focus();alert("Please, enter a valid promo code or select an other method of payment");return false;}
	if((document.frm_reg.method_payment.value=="promo") && (document.frm_reg.val_promo.value=="True")){document.frm_reg.xval.value=0;}
	if(document.frm_reg.val_amimdm.value!="True"){document.frm_reg.val_amimdm.focus();alert("Please, enter a valid AMI/MDM promo code");return false;}
	return true;
}

function valid_billing() {
	if(document.payflow.NAME.value==""){document.payflow.NAME.focus();alert("Please, enter your card name");return false;}
	if(document.payflow.ADDRESS.value==""){document.payflow.ADDRESS.focus();alert("Please, enter your billing address");return false;}
	if(document.payflow.CITY.value==""){document.payflow.CITY.focus();alert("Please, enter your billing city");return false;}
	if(document.payflow.country.value==""){document.payflow.country.focus();alert("Please, select your billing country");return false;}
	if(document.payflow.stateprov.value==""){document.payflow.stateprov.focus();alert("Please, select your province/state");return false;}
	if(document.payflow.ZIP.value==""){document.payflow.ZIP.focus();alert("Please, enter your billing zip/postal code");return false;}
	return true;
}

function getpromo(val) {
	document.getElementById("amex").style.display="none";
	document.getElementById("showpromo").style.display="none";
	if (val == "promo") {
		document.getElementById("showpromo").style.display="";
//		document.getElementById("billing").style.display="none";
		document.frm_reg.promo_code.value="";
	}
	else if (val == "amex") {
//		document.getElementById("showpromo").style.display="none";
		document.getElementById("amex").style.display="";
	}
} 	

function checkEmail(show) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm_subscribe.email.value)) {
		showcontent('li=1&email='+document.frm_subscribe.email.value, '/'+show+'/subscribe.asp', 'subscribe'); return false;
	}
	alert("Please enter a vaild e-mail address.")
	return (false)
}

function clearmail() {
	if (document.frm_subscribe.email.value=='Enter e-mail') {
		document.frm_subscribe.email.value='';
	}
}