//--------------------------------------------------
//        swap button
//--------------------------------------------------

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 == 'ov') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+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('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}


//=============================================
// _blank
//=============================================
function BLinks() {
	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") == "bl")
		anchor.target = "_blank";
	}
}


//=============================================
// Init
//=============================================
function init() {
	BLinks();
	initRollovers();
}


addEvent(window,"load",init);

//=============================================
// window.onload
//=============================================
function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}


//=============================================
// window.open window.close
//=============================================
function openBrWindow(theURL,winName,features) {
	sealWin=window.open(theURL,winName,features);
	sealWin.focus();
}
function open_access_map(theURL) {
	sealWin=window.open(theURL,'access_map','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=yes,resizable=yes,width=635,height=700');
	sealWin.focus();
}
function CloseWin(){
    window.close();
    return false;
}


//=============================================
// window.print
//=============================================
function PrintWin(){
    window.print();
    return false;
}


