// attachEvent works for IE only, but since we only need to fix IE with this function that's ok!
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", fixSearchResultsHeightIE);
}
function fixSearchResultsHeightIE(){
	if(document.getElementById('searchResults')){
		document.getElementById('searchResults').style.height = document.getElementById('searchResults').scrollHeight+16;
	}
}

//add onload="bustFrames();" to the body tag to break out of any frames you might be placed in.
function bustFrames() {
	if (window != top) top.location.href = location.href;
}

//mark definitions set in anchor tags
definitionIsSet = false;
function markDef(l){
	var url = l.href
	var i = url.indexOf("#")+1;
	var id = url.substring(i);
	if(definitionIsSet){
		unmarkDefReturn(definitionIsSet);
	}
	document.getElementById(id).href = "javascript:unmarkDefReturn('"+id+"');";
	document.getElementById(id).title = "Click to return above";
	document.getElementById(id).style.textDecoration = "none";
	document.getElementById(id).innerHTML='&nbsp;<span class="definitionMarker" id="blink">&laquo;</span> <span class="definitionReturn">return</span>';
	definitionBlinky = setInterval("definitionBlinker()",500);
	definitionIsSet = id;
}
function unmarkDefReturn(id){
	definitionIsSet = false;
	clearInterval(definitionBlinky);
	document.getElementById(id).innerHTML='';
	window.history.back();
}
function definitionBlinker(){
		document.getElementById("blink").style.visibility = document.getElementById("blink").style.visibility == "" ? "hidden" : "" 
}

//box window stuff
function $(v) { return(document.getElementById(v)); }
function $S(v) { return($(v).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); }
function XYwin(v) { var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); return(isset(v)?z[v]:z); }
function windowBoxTOG() { document.onclick=function(){ $S('windowBoxBG').display='none'; $S('windowBox').display='none'; document.onclick=function(){}; }; }
function windowBox(b,t) { if(t!=false){setTimeout("windowBoxTOG()",100);} $S('windowBoxBG').height=XYwin(0)+'px'; $S('windowBoxBG').display='block'; $S('windowBox').left=Math.round((XYwin(1)-b)/2)+'px'; $S('windowBox').width=b+'px'; $S('windowBox').display='block'; }




//clickable alternating rows
//
//add clickable_rows(); on the page after the table between script tags.
//also relies on http://webcontent.chgcompanies.com/js/prototype-1.6.0.js so load that before this file
function clickable_rows(){
	reader_download_box(7);
	odds = $$('table#clickable tr.odd');
	odds.each(function(item){item.onmouseover=over;});
	odds.each(function(item){item.onmouseup=fire;});
	evens = $$('table#clickable tr.even');
	evens.each(function(item){item.onmouseover=over;});
	evens.each(function(item){item.onmouseup=fire;});
};
function over(){
	revert2 = this.className
	this.className = "over"
	this.onmouseout=function(){this.className = revert2;}
}
function fire(){
	atag = this.getElementsByTagName('a');
	ahref = atag[0];
	document.location = ahref;
	return false
}
//clickable boxes
//
//add clickable_boxes(); on the page after the table between script tags.
//also relies on http://webcontent.chgcompanies.com/js/prototype-1.6.0.js so load that before this file
function clickable_boxes(){
	boxes = $$('td.box_button');
	boxes.each(function(item){item.onmousedown=box_down;});
};
function box_down(){
	if(this.className.include('inactive')){
		return false;
	} else {
		revert2 = this.className;
		new_class = revert2 + " down";
		this.className = new_class;
		this.onmouseup=up;
	}
}
function up(){
		this.className = revert2;
		atag = this.getElementsByTagName('a');
		ahref = atag[0];
		document.location = ahref;
		return false;
}
function reader_download_box(t){
var debug = false;  // set debug to true to see more detailed system configuration information

// the BrowserDetect object scans the userAgent string to determine the operating system name/version and browser name/version
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "Other";
		this.browserVersion = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || 0;
		this.os = this.searchString(this.dataOS) || "Other";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			this.osVersion = data[i].version || 0;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length));
	},
	dataBrowser: [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version/"
		},
		{
			string: navigator.userAgent,
			subString: "Navigator",
			identity: "Netscape",
			versionSearch: "Navigator/"
		},
		{
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape",
			versionSearch: "Netscape/"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox",
			versionSearch: "Firefox/"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "MSIE",
			versionSearch: "MSIE"
		}
	],
	dataOS : [
		{
			string: navigator.userAgent,
			subString: "Windows NT 6.0",	// Windows Vista
			identity: "Windows",
			version: 6.0
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.2",	// Windows Server 2003
			identity: "Windows",
			version: 5.2
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.1",	// Windows XP
			identity: "Windows",
			version: 5.1
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.0",	// Windows 2000
			identity: "Windows",
			version: 5.0
		},
		{
			string: navigator.userAgent,
			subString: "Win 9x 4.90",		// Windows Me
			identity: "Windows",
			version: 4.9
		},
		{
			string: navigator.userAgent,
			subString: "Windows 98",		// Windows 98
			identity: "Windows",
			version: 4.1
		},
		{
			string: navigator.userAgent,	// Windows NT 4
			subString: "Windows NT 4.0",
			identity: "Windows",
			version: 4.0
		},
		{
			string: navigator.userAgent,
			subString: "Windows 95",		// Windows 95
			identity: "Windows",
			version: 4.0
		},
		{
			string: navigator.userAgent,
			subString: "Windows 3.1",
			identity: "Windows",
			version: 3.1
		},
		{
			string: navigator.userAgent,
			subString: "Mac OS X",
			identity: "Mac",
			version: 10
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux",
			version: 0
		},
		{
			string: navigator.platform,
			subString: "X11",
			identity: "Unix",
			version: 0
		}
	]

};


// call the init() function of the BrowserDetect object to perform the operating system and browser detection
BrowserDetect.init();


if (debug) {
	var agent = navigator.userAgent.toLowerCase();
	if (agent) {
		document.write('<FONT SIZE=2><BR><BR><B><U>OS/Browser Information</U></B><BR>');
		document.write('<B>navigator.userAgent:</B> ' + navigator.userAgent + '<BR>');
		document.write('<B>navigator.vendor:</B> ' + navigator.vendor + '<BR>');
		document.write('<B>navigator.appName:</B> ' + navigator.appName + '<BR>');
		document.write('<B>navigator.appVersion:</B> ' + navigator.appVersion + '<BR>');
		document.write('<B>navigator.appCodeName:</B> ' + navigator.appCodeName + '<BR>');
		document.write('<B>navigator.platform:</B> ' + navigator.platform + '<BR>');
		document.write('<B>navigator.oscpu:</B> ' + navigator.oscpu + '<BR>');
		document.write('<BR><BR>');
		document.write('<B>BrowserDetect.browser:</B> ' + BrowserDetect.browser + '<BR>');
		document.write('<B>BrowserDetect.browserVersion:</B> ' + BrowserDetect.browserVersion + '<BR>');
		document.write('<B>BrowserDetect.os:</B> ' + BrowserDetect.os + '<BR>');
		document.write('<B>BrowserDetect.osVersion:</B> ' + BrowserDetect.osVersion + '<BR>');
		document.write('</FONT>');
	}
}



var platform=new Object();
platform.supportedOS = false;
platform.supportedBrowswer = false;

// Supported Windows OS/Browser combinations
if ((BrowserDetect.os == "Windows") && (BrowserDetect.osVersion >= 5)) {					// Windows 2000 or higher
	if (((BrowserDetect.browser == "MSIE") && (BrowserDetect.browserVersion >= 6)) ||		// IE 6.0 or higher
		((BrowserDetect.browser == "Firefox") && (BrowserDetect.browserVersion >= 2)) ||	// Firefox 2.0 or higher
		((BrowserDetect.browser == "Netscape") && (BrowserDetect.browserVersion >= 9)) ||	// Netscape 9.0 or higher
		((BrowserDetect.browser == "Safari") && (BrowserDetect.browserVersion >= 3))) {		// Safari 3.0 or higher
			platform.supportedOS = true;
			platform.supportedBrowser = true;
	}
}

// Supported Mac OS/Browser combinations
if ((BrowserDetect.os == "Mac") && (BrowserDetect.osVersion >= 10)) {						// Mac OS X 10.0 or higher
	if (((BrowserDetect.browser == "Safari") && (BrowserDetect.browserVersion >= 3))) {		// Safari 3.0 or higher
			platform.supportedOS = true;
			platform.supportedBrowser = true;
	}
}

if (!platform.supportedOS || !platform.supportedBrowser || t == "test") {
		OSBrowserFail();
} else {

	// check to see if they are running a supported version of the Adobe Acrobat/Reader Plugin
	var acrobat=new Object();
	acrobat.installed=false;
	acrobat.supportedVersion=false;

	var agent = navigator.userAgent.toLowerCase();
	if (agent) {
		if (debug) document.write('<FONT SIZE=2><BR><BR><B><U>Adobe Acrobat/Reader Information</U></B><BR>');
		if ((BrowserDetect.os == "Windows") && (BrowserDetect.browser == "MSIE")) {		// Windows/MSIE
			try
			{
				oAcro7=new ActiveXObject('AcroPDF.PDF.1');
				if (oAcro7) {
					if (debug) document.write('<B>ActiveXObject:</B> AcroPDF.PDF.1</B><BR>');
					acrobat.installed=true;
					acrobat.supportedVersion=true;
				}
			}
			catch(e) {}
		}
		else {																			// Navigator/Mozilla-compatible browser
			if ((navigator.plugins != null) && (navigator.plugins.length > 0)) {
				for (i=0; i < navigator.plugins.length; i++ ) {
					var plugin = navigator.plugins[i];
					if ((plugin.description == "Adobe Acrobat Plug-In Version 7.00 for Netscape") || 							// Acrobat/Reader 7.x on Windows
						(plugin.description == "Adobe PDF Plug-In For Firefox and Netscape") || 								// Acrobat/Reader 8.x on Windows
						(plugin.description.substring(0,60) == "Adobe Acrobat and Reader Plug-in for Web Browsers, Version 8"))	// Acrobat/Reader 8.x only for Safari on Mac OS X
						{
							if (debug) document.write('<B>plugin.description:</B> ' + plugin.description + '<BR>');
							acrobat.installed=true;
							acrobat.supportedVersion=true;
					}
				}
			}
	   }
	if (debug) document.write('</FONT>');
	}
	if (!acrobat.installed || !acrobat.supportedVersion) {
		ReaderFail();
	}

}
}
function OSBrowserFail(){
		mainbox = $$('table td.box_button.main');
		mainbox[0].onmousedown = null;
		mainbox[0].innerHTML = '<a class="button"><img src="https://webcontent.chgcompanies.com/images/icons/twotone/beige/caution.gif" border="0" /> <strong>Create</strong> Application Package<br/></a><p><strong>Your operating system or browser does not meet the minimum requirements to run the online application.</strong><br/>Your options are:</p><ul style="margin-left:15px;padding-left:0px;"><li><strong style="font-size:larger">Download</strong> the applicable <a href="http://www.rnnetwork.com/travel_nursing/forms"><strong>application forms</strong></a> and mail or fax the completed forms to us, or...</li><br/><li><strong style="font-size:larger">Call us</strong> and we will help you complete the application over the phone. <strong style="font-size:larger">1-877-222-4776</strong></li></ul>';
		mainbutton = $$('table td.box_button.main a.button');
		mainbutton[0].style.backgroundColor = "#fff";
		mainbutton[0].style.color = "#bbb";
		mainbutton[0].style.cursor = "auto";
		mainbox[0].style.backgroundColor = "#fff";
		mainbox[0].style.backgroundImage = "none";
		mainbox[0].style.border = "4px solid red";
		mainbox[0].style.cursor = "auto";	
}
function ReaderFail(){
		mainbox = $$('table td.box_button.main');
		mainbox[0].onmousedown = null;
		mainbox[0].innerHTML = '<a class="button"><img src="https://webcontent.chgcompanies.com/images/icons/twotone/beige/caution.gif" border="0" /> <strong>Create</strong> Application Package<br/></a><p><strong>You do not have a current version of Adobe Reader, required to complete the online application.</strong><br/>Your options are:</p><ul style="margin-left:15px;padding-left:0px;"><li><strong style="font-size:larger">Download</strong> the current version of <strong style="font-size:larger"><a href="http://www.adobe.com/products/acrobat/readstep2.html?appLink">Adobe Reader</a></strong>, or...</li><br/><li><strong style="font-size:larger">Download</strong> the applicable <a href="http://www.rnnetwork.com/travel_nursing/forms"><strong>application forms</strong></a> and mail or fax the completed forms to us, or...</li><br/><li><strong style="font-size:larger">Call us</strong> and we will help you complete the application over the phone. <strong style="font-size:larger">1-877-222-4776</strong></li></ul>';
		mainbutton = $$('table td.box_button.main a.button');
		mainbutton[0].style.backgroundColor = "#fff";
		mainbutton[0].style.color = "#bbb";
		mainbutton[0].style.cursor = "auto";
		mainbox[0].style.backgroundColor = "#fff";
		mainbox[0].style.backgroundImage = "none";
		mainbox[0].style.border = "4px solid red";
		mainbox[0].style.cursor = "auto";	
}
