﻿window.onload = function(){
	setNewWin();
	sendToCodedEmail();
}
function getObjById(idName){
	if(document.getElementById){
		return document.getElementById(idName);
	}else if(document.all){
		return document.all(idName);
	}else if(document.layers){
		return document.layers[idName];
	}
}
function setFunc(idName, eventName, funcName){
	var scriptStr = "if(getObjById(\"" + idName + "\")){";
	scriptStr += "getObjById(\"" + idName + "\")." + eventName + " = function(){";
	scriptStr += funcName + ";";
	scriptStr += "}}";
	eval(scriptStr);
}
function setNewWin(){
	var i, obj;
	for(i = 0; (obj = document.getElementsByTagName("a")[i]); i ++){
		if(obj.getAttribute("class") == "new-win" || obj.getAttribute("className") == "new-win"){
			obj.onclick = function(){
				return openWin(this.getAttribute("href"));
			}
		}
	}
}
function openWin(url){
	window.open(url, "_blank", "toolbar=yes,location=yes,menubar=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes");
	return false;
}
function sendToCodedEmail(){
	var i, obj, codedMailto, arParameter, offset, mailto, j;
	for(i = 0; (obj = document.getElementsByTagName("a")[i]); i ++){
		if(obj.getAttribute("class") == "mailto" || obj.getAttribute("className") == "mailto"){
			obj.onclick = function(){
				codedMailto = this.getAttribute("href")
				if((n = codedMailto.lastIndexOf("/")) != -1){
					codedMailto = codedMailto.substring(n + 1);
				}
				arParameter = codedMailto.split(",");
				offset = arParameter.length;
				mailto = "";
				for(j in arParameter){
					mailto += String.fromCharCode(arParameter[j] - offset);
				}
				eval(mailto);
				return false;
			}
		}
	}
}
function ieMinWidth(){
	if(document.body.clientWidth < 982){
		return "980px";
	}else{
		return "auto";
	}
}