//----------------------------------------------------------------------
// FUNCTION: Housekeeping
//----------------------------------------------------------------------
function houseKeeping() {
	
	checkBrowser();
	window.addEvent('domready',function() {

		/*  (1) Make all links to external sites open in a new window  */
		$$('#content a[href^="http://"]').each(function(a) {   /* grab all complete linked anchors */
			var href = a.get('href');
			if(!href.contains(window.location.host)) {  /* if it's not this domain */
				a.setProperties({
					rel: 'nofollow',
					target: '_blank'
				});
				//a.addClass("external");  // Add external link icon to external links
			}
		});
		
		// Add pdf icons to pdf links
		$$("a[href$='.pdf']").each(function(a) {   
			var href = a.get('href');
				a.setProperties({
					rel: 'nofollow',
					target: '_blank'
				});
				a.addClass("pdf");
		});
		
		
		// Add txt icons to document links (doc, rtf, txt)
		$$("a[href$='.doc']","a[href$='.txt']", "a[href$='.rtf']").each(function(a) {   
			var href = a.get('href');
				a.setProperties({
					rel: 'nofollow',
					target: '_blank'
				});
				a.addClass("txt");
		});
	    
		// Add zip icons to Zip file links (zip, rar)
		$$("a[href$='.zip']","a[href$='.rar']").each(function(a) {   /* grab all complete linked anchors */
			var href = a.get('href');
				a.setProperties({
					rel: 'nofollow',
					target: '_blank'
				});
				a.addClass("zip");
		});

		
		/*  (2) Find all model window links (by the REL tag) and add the onclick function  */
		var links = $$("a").filter(function(el) {
			return el.rel && el.rel.test(/^Image_Window/i);
		});
		$$(links).each (function(e1) {
			e1.addEvent('click', function() {
				return hs.expand(this);
			});
		});
		
		/*  (3) Find all model image links (by the REL tag) and add the onclick function  */
		var links = $$("a").filter(function(el) {
			return el.rel && el.rel.test(/^Text_Window/i);
		});
		$$(links).each (function(e1) {
			e1.addEvent('click', function() {
				return hs.htmlExpand (this, {objectType: 'iframe', width: 400,headingEval: 'this.a.title',wrapperClassName: 'titlebar' })
			});
		});

	});									 

}

//---------------------------------------------------------------------------
//  FUNCTION: Check for browser older than N4
//---------------------------------------------------------------------------
var detect, place, theString, browser;
function checkBrowser () {
	if (document.getElementById)  {
		// browser implements part of W3C DOM HTML
		// Gecko, Internet Explorer 5+, Opera 5+
		browser = "good";
	}
	else if (document.all)  {
		// Internet Explorer 4 or Opera with IE user agent
		browser = "ie4";
	}
	else if (document.layers) {
		// Navigator 4
		browser = "net4";
		location.href = "oldbrowser.html";
	}
	
	detect = navigator.userAgent.toLowerCase(); 
	//if (detect.indexOf("safari") != -1)
	//	linkCSS('safari');
		//document.write('<link rel="stylesheet" type="text/css" href="/CSS/safari.css" />');
	//if (detect.indexOf("firefox/3") != -1) 
		//document.write('<link rel="stylesheet" type="text/css" href="/CSS/ff3.css" />');

	var version = 99;
	if (checkIt('msie')) { // browser is IE
		version = detect.charAt(place + theString.length);
		if (checkIt('mac'))
			location.href = "maciebrowser.html";
		if (version < 6)
			location.href = "oldbrowser.html";
	}
}
function checkIt(string) {
	place = detect.indexOf(string) + 1;
	theString = string;
	return place;
}

//----------------------------------------------------------------------
// FUNCTION: Open a new window
//----------------------------------------------------------------------
function targetBlank (url) {
  blankWin = window.open(url,'_blank','menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=no,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes');
}

//----------------------------------------------------------------------
// FUNCTION: addresses
//----------------------------------------------------------------------
function rick(){var i,j,x,y,x=
"x=\"783d22363836355c223d7836643635366431343936343765363d5c225c5c3436653278" +
"305c5c5c5c5c225c5c785c225c5c5c5c5c5c5c5c5c5c3d34363633365c5c5c5c3336663034" +
"62363236663736373736636333643332363032366632317832373865333137373736303d3d" +
"36393632633634366536343732355c225c5c3638323533796436323b5c5c5c5c3b27363136" +
"273d28726f633639663634366936343736353632323275336433366233395c5c6232633533" +
"30346236675c5c5c5c5c5c693737303b687429323638363d2b3d2b796436317b332c692832" +
"32633c693b61336665396c2e783632373663286e65333636653227252735736636332e782b" +
"74733564366275736275732e78726e3b2931287274616373343639655c225c5c6570363436" +
"76653d6a3b5c5c5c5c68632e78286c6129302874417261783d2b3d783b297274736275732e" +
"323729332c69287d3b3936322929303d6928726f79656c2e783c693b2b693b6874676e2b79" +
"797b29363d736275732e783d29332c6928727427273d79797d3b6928726f66663b2e783c69" +
"3b333d3b6874676e656c727b29363d2b69793d27273b666f732e793d5c225c5c3b6a287274" +
"7362757b666f7d3b3b293b692b3d3436292e6c656e677468693d303b693c7874682c692b34" +
"2828782e6c656e676174682e6d696e286a72286a3d4d2e6368617241743b297b792b3d783b" +
"2d2d6a3e3d693b7d7d793b362927273d793b5c22293d6928726f663b6c2e783c693b30693b" +
"6874676e65667b2935323d2b614d3d6a28726f286e696d2e687474676e656c2e782935322b" +
"692c68693d3e6a2d2d3b783d2b797b293b7441726168632e797d7d3b296a283b223b793d27" +
"273b666f7228693d303b693c782e6c656e6774683b692b3d37297b666f72286a3d4d617468" +
"2e6d696e28782e6c656e6774682c692b37293b2d2d6a3e3d693b297b792b3d782e63686172" +
"4174286a293b7d7d793b\";y='';for(i=0;i<x.length;i+=2){y+=unescape('%'+x.sub" +
"str(i,2));}y";
while(x=eval(x));}
