/*  	
	Brown Paper Bab - Web Studio - Web Design - Web Creation - Web Hosting - Internet - Intranet
	Version 1.1
	Created: 19th Feb 2006
	By: info@brownpaperbag.com.au
	Modified: 
		23rd Feb 2006 RB Added HighlightNav function
*/

/* For findPos() */


/* //  DEPRECATED: use OpenModal(url, width, height, refresh)
function oModal(url,x,y){
	var oVals;
	var strWinOpts = "dialogHeight: " + y + "px; dialogWidth: " + x + "px; center:yes; help:no; resizable:no; scroll:no; status:no;"
	s = document.getElementById('greyout');
	s.style.visibility = 'visible';
	oVals = window.showModalDialog(url,'', strWinOpts)
	if (oVals){
		if (oVals.Update) {
			window.location.reload(true);
		}else{
			s.style.visibility = 'hidden';
		}
	}else{s.style.visibility = 'hidden';}
}
	
function OpenModalNoRefresh(url, x, y){
	var oVals;
	var strWinOpts = "dialogHeight: " + y + "px; dialogWidth: " + x + "px; center:yes; help:no; resizable:no; scroll:no; status:no;"
	s = document.getElementById('greyout');
	s.style.visibility = 'visible';
	oVals = window.showModalDialog(url,'', strWinOpts)
	if (oVals){
			s.style.visibility = 'hidden';
			//window.location.reload(false);

	}else{s.style.visibility = 'hidden';}
}
*/


var current = null;

// Page load events
function WinLoad(func) {
	
	var oldonload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() { 
			oldonload();
			func();
		}
	}
};


/* Image Swapper */
WinLoad(SetUpHoverBtns);

function SetUpHoverBtns(){
    //var myArray = $$('.BtnHover');
    $$('.BtnHover').each(function(item){
        item.onmouseover = function(){ImgSwp(item);};
        item.onmouseout = function(){ImgSwp(item);};
    });
}

function ImgSwp(oButton) {  // Image swapper
	var ext = oButton.src.substring(oButton.src.lastIndexOf("."), oButton.src.length)
	var path = oButton.src.substring(0, oButton.src.lastIndexOf("/")+1)
	var file = oButton.src.substring(oButton.src.lastIndexOf("/")+1,oButton.src.lastIndexOf("."))
	if (oButton != current){
		oButton.src = (((i = file.indexOf("_ovr")) >= 0) || ((i = file.indexOf("_on")) >= 0)) ? path + file.substring(0, file.lastIndexOf("_")) + ext : path + file + "_ovr" + ext;
	}
};
/*  Hides the help window */

