function makeWindow(sLocationName, iWidth, iHeight, sShowMenu){
	var intWidth = 400;
	var intHeight = 270;
	var strMenu = "no";
	if (makeWindow.arguments[1]) {
		intWidth = makeWindow.arguments[1];
	}
	if (makeWindow.arguments[2]) {
		intHeight = makeWindow.arguments[2];
	}
	if (makeWindow.arguments[3]) {
		strMenu = makeWindow.arguments[3];
	}
	var sWindowProps = ',scrollbars=yes,location=no,resizable=yes,menubar=' + strMenu;
	var sOptions = 'height=' + intHeight + ',width=' + intWidth;
	var newWin = window.open(sLocationName,'infoWindow','height=' + intHeight + ',width=' + intWidth + sWindowProps);
	newWin.focus();
}


function centeredPopup(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus(); 
	}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600');");
}

rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
}

function rand(number) {
        return Math.ceil(rnd()*number);
}

function PopUp(url,h,w,sb,rs,st,tb,mb,ti) 
{
   lft = (screen.availWidth -w)/2;
   t = (screen.availHeight -h)/2;
   p = "scrollbars=" + sb + ",resizable=" + rs + ",status=" + st + ",toolbar=" + tb + ",menubar=" + mb + ",titlebar=" + ti + ",top=" + t + ",left=" +lft + ",width=" + w + ",height=" + h;
window.open(url, rand(101)-1, p);
}


function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

var whitespace = " \t\n\r";
function isWhitespace (s)

{   var i;
    if (isEmpty(s)) return true;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    return true;
}

function isEmail (s)
{   
		if (s.indexOf(" ")!=-1) return false;

		if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    // is s whitespace?
    if (isWhitespace(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}


function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) 
	{ 
		test=args[i+2]; val=MM_findObj(args[i]);strFriendlyName = args[i+1];
		if (val) 
		{ 
			nm=val.name; if ((val=val.value)!="") 
		{
		
		if (test.indexOf('isDate')!=-1) 
		{
      if (!isDate(val)) errors+='- '+strFriendlyName+' must contain a valid date that is in the past.\n';
		}
		else if (test.indexOf('isEmail')!=-1)
		{
      if (isEmail(val)==false) errors+='- '+strFriendlyName+' must contain an e-mail address.\n';
			
    }
		else if (test!='R') 
		{
      if (isNaN(val)) errors+='- '+strFriendlyName+' must contain a number.\n';
      if (test.indexOf('inRange') != -1) 
			{ 
				p=test.indexOf(':');
      	min=test.substring(8,p); max=test.substring(p+1);
      	if (val-0<min || max<val-0) errors+='- '+strFriendlyName+' must contain a number between '+min+' and '+max+'.\n';
    	}
		}
		}
		else if (test.charAt(0) == 'R') 
		{
			errors += '- '+strFriendlyName+' is required.\n'; 
		}
		}
  } 
	if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


function setLink(strArg) {
	self.location.href = strArg;
}


