

var lastRegion = null;
var lastCustomer = null;


function showInfo(customer){
  var c = document.getElementById(customer);
  if (lastCustomer)
    lastCustomer.style.display = "none";
  	c.style.display = "block";
  	lastCustomer = c;
}
function hideInfo(lastCustomer){
    if (lastCustomer)
	lastCustomer.style.display = "none";
}






function hideThis(custe){
  var c = document.getElementById(custe);
if (custe)
	c.style.display = "none";
}

function showThis(custer){
  var d = document.getElementById(custer);
if (custer)
	d.style.display = "block";
}




function PopUp(fileName,howhigh,howwide) {
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (howwide + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/2) - (howhigh + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open("","Window2","status,height=" + howhigh + ",width=" + howwide + ",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes,toolbar=yes");
	  	win2.location.href = fileName;
		win2.focus();
}

function PopUpEx(fileName,howhigh,howwide, sizeable, scrollable, toolbars) {
	var iMyWidth;
	var iMyHeight;
	//gets top and left positions based on user's resolution so hint window is centered.
	iMyWidth = (window.screen.width/2) - (howwide + 10); //half the screen width minus half the new window width (plus 5 pixel borders).
	iMyHeight = (window.screen.height/2) - (howhigh + 50); //half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open("","_BLANK","height=" + howhigh + ",width=" + howwide + 
		",resizable=" + (sizeable ? "yes" : "no") + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + 
		",scrollbars=" + (scrollable ? "yes" : "no") + 
		",toolbar=" + (toolbars ? "yes" : "no"));
	  	win2.location.href = fileName;
		win2.focus();
}


 function goto_URL(object) {
     top.location.href = object.options[object.selectedIndex].value;
 }


function ValidateEmail (emailStr) {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	if (user.match(userPat)==null) {
	    alert("The username doesn't seem to be valid.");
	    return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
			alert("Destination IP address is invalid!");
			return false;
		    }
	    }
	    return true;
	}
	var domainArray=domain.match(domainPat);
	if (domainArray==null) {
		alert("The domain name doesn't seem to be valid.");
	    return false;
	}
	var atomPat=new RegExp(atom,"g");
	var domArr=domain.match(atomPat);
	var len=domArr.length;
	if ((domArr[domArr.length-1] != "info") &&
		(domArr[domArr.length-1] != "name") &&
		(domArr[domArr.length-1] != "arpa") &&
		(domArr[domArr.length-1] != "coop") &&
		(domArr[domArr.length-1] != "aero")) {
			if (domArr[domArr.length-1].length<2 ||
			domArr[domArr.length-1].length>3) {
					alert("The address must end in a three-letter domain, or two letter country.");
					return false;
			}
	}
	if (len<2) {
	   var errStr="This address is missing a hostname!";
	   alert(errStr);
	   return false;
	}
	return true;
	}
