function detect() {
	if (document.referrer.indexOf("index.htm") == -1) {
		alert('You may not access this page directly. Please use our navigation menu.');
		window.location.href="index.htm";
		}
	}

function sendMail(n2,d2,e2,s2,b2){
	if(s2 == '') s2 = ' ';
	var r2 = 'mailto:' + n2 + '@' + d2 + '.' + e2 + '?subject=' + s2 + '&body=' + b2;
	document.location.href = r2;
	}

function newWindow(linkURL,n,w,h){
	LeftPosition = 0;
	TopPosition = 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,directories=yes,toolbar=yes,menubar=yes,status=yes,location=yes';
	if (n != "FullScreen") {
		LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		TopPosition = (screen.height) ? ((screen.height-h)/2) - 40 : 0;
		if (n == "MinMax") {
			settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,status=no,location=no';
			n = "";
			}
		else if (n == "NoScroll") {
			settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=no,directories=no,toolbar=no,menubar=no,status=no,location=no';
			n = "";
			}
		else {
			settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=no,directories=no,toolbar=no,menubar=no,status=no,location=no';
			n = "";
			}
		}
	else {
		var h = (screen.availHeight - 152).toString();
		var w = (screen.availWidth - 10).toString();
		settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,directories=no,toolbar=yes,menubar=yes,status=yes,location=no';
	}
	var win = null;
	linkURL = linkURL + '.htm';
	win = window.open(linkURL,n,settings)
	if(win.window.focus){win.window.focus();}
		}

function openURL(subName,domainName,tldName){
	LeftPosition = 0;
	TopPosition = 0;
	var h = (screen.availHeight - 152).toString();
	var w = (screen.availWidth - 10).toString();
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,directories=no,toolbar=yes,menubar=yes,status=yes,location=no';
	var win = null;
	win = window.open('http://' + subName + '.' + domainName + '.' + tldName,"Title",settings)
	if(win.window.focus){win.window.focus();}
	}

function makeArray(n){
    this.length = n;
    for (i=1;i<=n;i++){
        this[i]=0;
    }
    return this;
}

function displayDate(){
    var this_month = new makeArray(12);
    this_month[0]  = "January";
    this_month[1]  = "February";
    this_month[2]  = "March";
    this_month[3]  = "April";
    this_month[4]  = "May";
    this_month[5]  = "June";
    this_month[6]  = "July";
    this_month[7]  = "August";
    this_month[8]  = "September"; 
    this_month[9]  = "October";
    this_month[10] = "November";
    this_month[11] = "December";
    var today = new Date();
    var day   = today.getDate();
    var month = today.getMonth();
    var year  = today.getYear();
	var hours = today.getHours();
	var minutes = today.getMinutes();
	var seconds = today.getSeconds();
    if (year < 1900){
        year += 1900;
    }
	if (day < 10){
	    return(this_month[month]+" "+"0"+day+", "+year);
	}
	else {
	    return(this_month[month]+" "+day+", "+year);
	}
}

function clock() {
	if (!document.layers && !document.all) return;
		var digital = new Date();
		var hours = digital.getHours();
		var minutes = digital.getMinutes();
		var seconds = digital.getSeconds();
		var amOrPm = "AM";
	if (hours > 11) amOrPm = "PM";
	if (hours == 0) hours = 12;
	if (hours <= 9) hours = " " + hours;
	if (minutes <= 9) minutes = "0" + minutes;
	if (seconds <= 9) seconds = "0" + seconds;
		dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
	if (document.layers) {
		document.layers.pendule.document.write(dispTime);
		document.layers.pendule.document.close();
		}
	else
		if (document.all)
		pendule.innerHTML = dispTime;
		setTimeout("clock()", 1000);
	}

function swapImage() {
	var i,theObj,j=0,swapArray=new Array,oldArray=document.swapImgData;
	for (i=0; i < (swapImage.arguments.length-2); i+=3) {
		theObj = eval(swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1])
		if (theObj != null) {
			swapArray[j++] = theObj;
			swapArray[j++] = (oldArray==null || oldArray[j-1]!=theObj)?theObj.src:oldArray[j];
			theObj.src = swapImage.arguments[i+2];
		}
	}
	document.swapImgData = swapArray;
}

function swapImgRestore() {
	if (document.swapImgData != null)
	for (var i=0; i<(document.swapImgData.length-1); i+=2)
		document.swapImgData[i].src = document.swapImgData[i+1];
}

function goReport(form){
  rname = form.selOption.options[form.selOption.selectedIndex].value
    if(rname.indexOf("#")==0) {
		alert ('This report is not available.');
		var rname = 'mbrrpts.htm';
		document.location.href = rname;
		return false;
		}
	else {
		var win = null;
		win = window.open(rname)
		if(win.window.focus){win.window.focus();};
		return false;
	}
}
