
/*------------------------------------------------------------------------------
	init stuff
------------------------------------------------------------------------------*/	
	
	window.onload = function(){ 
		initRollovers();
		externalLinks();
	}
	

/*------------------------------------------------------------------------------
	Popup Windows
------------------------------------------------------------------------------*/	

	//popup windows
	var myWin = null;
	function gen_popup(theUrl,theWidth, theHeight) {
	
		theTitle = '';
		
		if ((!myWin) || (myWin.closed)) {
			
			theDim = 'width=' + theWidth + ',height=' + theHeight + ',left=10,top=10,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,';
	
			myWin = window.open(theUrl, theTitle, theDim);
			myWin.opener = window;
		} else {
			myWin.location = theUrl;
			myWin.focus();
			myWin.opener = window;
		}
	}
	
	
	function p_link(mylink, closeme){
		if ( (window.focus && window.opener)){
			window.opener.focus();
			window.opener.location.href=mylink;
		}
		if (closeme){
			window.close();
		}
	}

/*------------------------------------------------------------------------------
	IE flickering background fix
------------------------------------------------------------------------------*/	
	try {
	  document.execCommand("BackgroundImageCache", false, true);
	} catch(err) {}


/*------------------------------------------------------------------------------
	XHTML valid external links
------------------------------------------------------------------------------*/	

	function externalLinks() { 
		if (!document.getElementsByTagName) return; 
		var anchors = document.getElementsByTagName("a"); 
		for (var i=0; i<anchors.length; i++) { 
			var anchor = anchors[i]; 
			if (anchor.getAttribute("href") && 
					anchor.getAttribute("rel") == "external") 
				anchor.target = "_blank"; 
		} 
	} 

	
/*------------------------------------------------------------------------------
	img rollover
------------------------------------------------------------------------------*/

	
	function initRollovers() {
		if (!document.getElementById) return
		
		var aPreLoad = new Array();
		var sTempSrc;
		var aImages = document.getElementsByTagName('img');
		
		for (var i = 0; i < aImages.length; i++) {		
			if (aImages[i].className == 'imgover') {
				var src = aImages[i].getAttribute('src');
				var ftype = src.substring(src.lastIndexOf('.'), src.length);
				var hsrc = src.replace(ftype, '_o'+ftype);
	
				aImages[i].setAttribute('hsrc', hsrc);
				
				aPreLoad[i] = new Image();
				aPreLoad[i].src = hsrc;
				
				aImages[i].onmouseover = function() {
					sTempSrc = this.getAttribute('src');
					this.setAttribute('src', this.getAttribute('hsrc'));
				}	
				
				aImages[i].onmouseout = function() {
					if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
					this.setAttribute('src', sTempSrc);
				}
			}
		}
	}
