//=============================================
// SmartRollOver()
//=============================================
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);
			}
		}
	}
}


//=============================================
// BlWin2()
//=============================================
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";
		if(anchor.parentNode.className == "photo"){
			anchor.target = "photowin";
		}
	}

}

//=============================================
// init()
//=============================================

function init() {
	BLinks();
	initRollovers();
}


window.onload=init;

//=============================================
// closewin
//=============================================
function closewin() {
	window.close();
}

//=============================================
// popWin()
//=============================================
function popWin(wk) {

	// 
	//window.open(wk,"info");

	var PopWidth  = ",width=620px";
	var PopHeight = ",height=600px";
	var PopDetail = "scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1" + PopWidth + PopHeight;
	var PopWin = window.open(wk,"info",PopDetail);
		PopWin.focus();

}

function popExceptionWin(wk) {

	var PopWidth  = ",width=620px";
	var PopHeight = ",height=450px";
	var PopDetail = "scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1" + PopWidth + PopHeight;
	var PopWin = window.open(wk,"exception",PopDetail);
		PopWin.focus();

}

