function disablePrinterCSS() {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("id")) {
       if(a.getAttribute("id") == "print") {
       		a.disabled = true;
    		linkstatus1 = document.getElementById("PRINTALLON");
    		linkstatus1.style.display = 'none';	
    		linkstatus2 = document.getElementById("PRINTALLOFF");
    		linkstatus2.style.display = '';		
       }
     }
   }
}

function enablePrinterCSS() {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("id")) {
       if(a.getAttribute("id") == "print") {
       		a.disabled = false;
    		linkstatus1 = document.getElementById("PRINTALLON");
    		linkstatus1.style.display = '';	
    		linkstatus2 = document.getElementById("PRINTALLOFF");
    		linkstatus2.style.display = 'none';		
       }
     }
   }
}

var dom = '.us';
var delimiter = '@';
var co = 'state.mn';

function nes(name, domain) {
   locationstring = 'mai' + 'lto:' + name + delimiter + domain;
   window.location.replace(locationstring);
}

function dnes(name) {
	locationstring = 'mai' + 'lto:' + name + delimiter + co + dom;
	window.location.replace(locationstring);
}

function dnesa(name, agency) {
	locationstring = 'mai' + 'lto:' + name + delimiter + agency + co + dom;
	window.location.replace(locationstring);
}

function openContent(url) {
    var winl = (screen.width) / 2;
    var wint = (screen.height) / 2;
    winprops = 'height='+325+',width='+670+',top='+0+',left='+0+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,location=yes';
    win = window.open(url, 'name', winprops);
}

function openImage(myimage) {
	html = "<HTML><HEAD><TITLE>Photo</TITLE>" +
		"</HEAD><BODY LEFTMARGIN=0 " +
		"MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>" +
		"<IMG SRC='" + myimage + "' BORDER=0 NAME=image " +
		"onload='window.resizeTo(document.image.width,document.image.height + 100)'>" +
		"<br><br><center><a href='javascript:self.close()' target='_self'><b>Close Window</b></a></center>" +
		"</BODY></HTML>";
	popup=window.open
		('','image','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
	popup.document.open();
	popup.document.write(html);
	popup.document.focus();
	popup.document.close();
}

/* Functions for OET site - jha 9/19/2006 */
function randomImage(imageName, extension, width, height, imageQuantity) {	
	var currentNumber = Math.ceil(Math.random() * imageQuantity);
	document.write('<img src="/mn/images/oet/' + imageName + currentNumber + extension + '" width="' + width + '" height="' + height + '" alt="randomly rotating image" />');
}

function swapColor(idValue, display) {
	switch(display) {
		case "menu3Over":
			document.getElementById(idValue).style.backgroundColor = "#FFF";
		break;
		case "menu3Out":
			document.getElementById(idValue).style.backgroundColor = "#d0dfbb";
		break;
		case "menu3SelectedOver":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
		case "menu3SelectedOut":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
		case "menu4Over":
			document.getElementById(idValue).style.backgroundColor = "#FFF";
		break;
		case "menu4Out":
			document.getElementById(idValue).style.backgroundColor = "#edfcd7";
		break;
		case "menu4SelectedOver":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
		case "menu4SelectedOut":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
		case "menu5Over":
			document.getElementById(idValue).style.backgroundColor = "#FFF";
		break;
		case "menu5Out":
			document.getElementById(idValue).style.backgroundColor = "#e3febc";
		break;
		case "menu5SelectedOver":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
		case "menu5SelectedOut":
			document.getElementById(idValue).style.backgroundColor = "#fff09a";
		break;
	}
}

function securityFilter(form) {
	var selectString = "[sS][eE][lL][eE][cC][tT]";
	re = new RegExp(selectString + ".+[fF][rR][oO][mM]");
	var selectReplace = new RegExp (selectString, 'g');
  	for (var loop=0; loop < form.elements.length; loop++)
  	{
    	if (form.elements[loop].type == "text" || form.elements[loop].type == "textarea") {
    		form.elements[loop].value = (form.elements[loop].value).replace(/[^ -~]/g, ' ');
    	}
		if (re.test(form.elements[loop].value) == true) {
			form.elements[loop].value = (form.elements[loop].value).replace(selectReplace, 'sel_ect');
		}
 	}
}

