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


//=============================================
// openPopup
//=============================================
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

//Company
function openCompany(p){
	var path = (p) ? p : "../popup/index.html" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}

function openCompanyTop(p){
	var path = (p) ? p : "popup/index.html" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}

//Contact
function openContact(p){
	var path = (p) ? p : "../popup/index.html#contact" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}

function openContactTop(p){
	var path = (p) ? p : "popup/index.html#contact" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}

//Privacy Policy
function openPrivacy(p){
	var path = (p) ? p : "../popup/index.html#privacy" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}

function openPrivacyTop(p){
	var path = (p) ? p : "popup/index.html#privacy" ;
	PopWin = window.open(path,"popupWin","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,width=777,height=600");
	PopWin.focus();
}
