/** Copyright 2009 Ipoxi LLC */
var w3c = !document.all;
var ie8 = document.documentMode;
var isSafari = navigator.userAgent.indexOf("Safari") != -1;
function sendTo(link, newWin, w, h, s, t) {
if(newWin) {
var f = "";
if(w && w!=0) {
f+= "width="+w+",height="+h;
} else {
if(document.all)
f += "width="+document.body.clientWidth+",height="+document.body.clientHeight;
else
f += "width="+window.innerWidth+",height="+window.innerHeight;
}
f += ",scrollbars=" + (s?"yes":"no") + ",toolbar=" + (t?"yes,location=yes":"no") + ",resizable=yes";
window.open(link,null,f);
} else {
window.location.href=link;
}
}
function openLink(link) {
window.open(link, null, "toolbar=yes,location=yes,scrollable=yes,resizable=yes");
}
function submitForm(formName, action) {
var form = document.forms[formName];
if(action != null)
form.action = action;
form.submit();
}
function posByEvent(el,e,offL,offT) {
var docEl = document.documentElement;
var tmp = el.style.width;
var w = new Number(tmp.substring(0,tmp.length-2));
tmp = el.style.height;
var h = new Number(tmp.substring(0,tmp.length-2));
var l = getClientX(e) - offL;
var t = getClientY(e) - offT;
if(l < 0) {
l = 20;
} else if(l + w > getPageRight()) {
l -= ((l + w + 10) - getPageRight());
}
if(t < 0) {
t = 20;
} else if(t + h > getPageBottom()) {
t -= ((t + h + 10) - getPageBottom());
}
el.style.left = l + "px";
el.style.top = t + "px";
}
function getParam(key) {
var qs = location.search;
var i = qs.indexOf(key + "=");
if(i == -1) {
return null;
}
i += key.length + 1;
var i2 = qs.indexOf("&", i);
var val;
if(i2 == -1) {
val = qs.substring(i, qs.length);
} else {
val = qs.substring(i, i2);
}
return val;
}
/* Broken browser code. */
function setClass(el, name) {
if(w3c || ie8)
el.setAttribute("class", name);
else
el.setAttribute("className", name);
}
function addListener(el, action, handler) {
if(w3c)
el.addEventListener(action, handler, false);
else
el.attachEvent("on" + action, handler);
}
function getCurTarget(e) {
return w3c ? e.currentTarget : e.srcElement;
}
function cancelDefault(e) {
if(w3c)
e.preventDefault();
else
e.returnValue = false;
}
function getClientY(e) {
return e.clientY + (isSafari ? document.body.scrollTop : document.documentElement.scrollTop);
}
function getClientX(e) {
return e.clientX + (isSafari ? document.body.scrollLeft : document.documentElement.scrollLeft);
}
function getPageRight() {
return (isSafari ? document.body.scrollLeft : document.documentElement.scrollLeft) + document.documentElement.clientWidth;
}
function getPageBottom() {
return (isSafari ? document.body.scrollTop : document.documentElement.scrollTop) + document.documentElement.clientHeight;
}

/**t0imgZoom*/
var gzClass;
var gzImg;
function gZoomImg(t, url, w, h, e, iClass) {
if(gzImg == null) {
gzImg = document.createElement("img");
addListener(gzImg,"click",gZoomHide);
gzImg.setAttribute("title","Click to hide");
gzImg.style.zIndex = 90;
document.getElementsByTagName('body').item(0).appendChild(gzImg);
}
if(iClass != gzClass) {
gzClass = iClass;
setClass(gzImg, gzClass);
}
gzImg.setAttribute("src",t.getAttribute("src"));
gzImg.setAttribute("src",url);
gzImg.style.width = w + "px";
gzImg.style.height = h + "px";
posByEvent(gzImg,e,w/2,h/2);
gzImg.style.visibility = "visible";
}
function gZoomHide() {
gzImg.style.visibility = "hidden";
}


