function openWin(url,w,h,s){
	var l=(screen.width-w)/2;
	var t=(screen.height-h)/2;

	if(window.thiswin != undefined){
		thiswin.close();
	}
	thiswin = window.open(url,"popupwin",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+s+',resizable=0,width='+w+',height='+h+',left='+l+',top='+t);
}

function validateEmailv2(email){
    if(email.length <= 0){
	  return true;
	}
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null ){
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null){
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null){
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
	return false;
}

function suggestClear(field){
	var thisform = document.forms.suggestForm;
	if(thisform[field].className == "suggest_light"){
		thisform[field].value="";
		thisform[field].className = "";
	}
}

function suggestVal(){
	var thisform = document.forms.suggestForm;
	if(thisform.yourname.value=="" || thisform.yourname.value=="Your Name"){
		window.alert("Please enter your name.");
		thisform.yourname.focus();
	}else if(thisform.youremail.value=="" || thisform.youremail.value=="Your Email"){
        window.alert("Please enter your email.");
		thisform.youremail.focus();
    }else if(validateEmailv2(thisform.youremail.value) == false){
        window.alert("Your email does not appear to be valid.");
		thisform.youremail.focus();
	}else if(thisform.yoursuggest.value=="" || thisform.yoursuggest.value=="Your suggestion..."){
        window.alert("Please enter your suggestion.");
		thisform.yoursuggest.focus();
	}else{
		thisform.submit();
	}
}

function login(){
	var thisform = document.forms.loginForm;
	if(thisform.ufield.value != "" && thisform.pfield.value != ""){
		document.getElementById("login_button").innerHTML = "Please wait...";
		thisform.submit();
	}
}

function checkEnter(e){
    var characterCode
	if(e && e.which){
		e = e
		characterCode = e.which
	}else{
		e = event
		characterCode = e.keyCode
	}
	if(characterCode == 13){
		login();
	}
}

function checkDelete(url,desc,extra){
	if(extra != undefined){ var extra_text = extra; }else{ var extra_text = ""; }
	temp = window.confirm("Are you sure you want to delete "+desc+"?\n"+extra_text);
	if (temp == true){
		window.location=url;
	}
}

function checkButton(url,quest,desc){
	if(desc != ""){
    	temp = window.confirm(quest+"\r\n"+desc);
	}else{
		temp = window.confirm(quest);
	}
	if (temp == true){
		window.location=url;
	}
}