
function openBrWindow2(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function OpenBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function LoadSite(location) {
    var temp
    var url
    temp = "/ME2/Sites/load.asp?SiteID="
    if (location != "") {
    	url = temp+location;
    	parent.location=url;
	}
}

function LoadAudience(location) {
    var temp
    var url
    temp = "/ME2/Audiences/load.asp?AudID="
    if (location != "") {
    	url = temp+location;
    	parent.location=url;
	}
}

function LoadLocationResults(location) {
    var temp
    var url
    temp = "/ME2/dirmod.asp?type=loc&nm=Search&mod=Results&loc="
    if (location != "") {
    	url = temp+location;
    	parent.location=url;
	}
}

function ShowEvent(date){
	var sURL
	sURL = "/ME2/Common/Global/calendar_popup.asp?Key=" + date
	newWindow=window.open(sURL ,"","toolbar=0,location=0,status=0,menubar=0,scrollba1uto,resizable=0,width=450,height=350")
}

function AdvOpenWindow(theURL,winName,features,popWidth,popHeight,center,ignorelink,alwaysOnTop,autoCloseTime,borderless) {
  var autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (center && center != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {
      w = screen.availWidth; h = screen.availHeight;}
    var leftPos = (w-popWidth)/2, topPos = (h-popHeight)/2;
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  popupWindow = window.open(theURL,winName,features);
  if (popupWindow.opener == null) popupWindow.opener = self;    
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow.resizeTo(popWidth,popHeight); popupWindow.moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow.setInterval("window.opener.popupWindow.focus();", 50);
    	popupWindow.document.body.onload = function() {popupWindow.setInterval("window.opener.popupWindow.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow.document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow.close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {popupWindow.close();}; }   
  document.returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
