//----------------------------------------------------------------------
// FUNCTION: Housekeeping
//----------------------------------------------------------------------
function houseKeeping() {
	
	checkBrowser();
	
	setLinkIcons();
	
}

//----------------------------------------------------------------------
// FUNCTION: Set link icons
//----------------------------------------------------------------------
function setLinkIcons() {

	$(document).ready(function() {
	 
	 
		// Add pdf icons to pdf links
		$("a[href$='.pdf']").addClass("pdf");
		$("a[href$='.pdf']").attr({ rel: 'nofollow', target: '_blank' });
	 
		// Add txt icons to document links (doc, rtf, txt)
		$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").addClass("txt");
		$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").attr({ rel: 'nofollow', target: '_blank' });
	 
		// Add zip icons to Zip file links (zip, rar)
		$("a[href$='.zip'], a[href$='.rar']").addClass("zip");
		$("a[href$='.zip'], a[href$='.rar']").attr({ rel: 'nofollow', target: '_blank' });
	 
		//Add external link icon to external links - 
		$('a').filter(function() {
			//Compare the anchor tag's host name with location's host name
		    return this.hostname && this.hostname !== location.hostname;
		  }).attr("target", "_blank");

	});
	
}

//---------------------------------------------------------------------------
//  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
//----------------------------------------------------------------------
