/** 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;
}

/**t0calendar*/
var curDay;
var dayBox;
function showDay(day, e) {
if(dayBox == null)
dayBox = document.getElementById("dayBox");
if(curDay != null)
hideDay();
curDay = document.getElementById("d" + day);
curDay.style.display = "block";
posByEvent(dayBox, e, 154, 54);
dayBox.style.display = "block";
}
function hideDay() {
curDay.style.display = "none";
dayBox.style.display = "none";
curDay = null;
}


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


/**l231*/
function zmMagnify(k, t, url, w, h, m, e) {
var el = document.getElementById("l231pb" + k);
el.setAttribute("src",t.getAttribute("src"));
el.setAttribute("src",url);
el.style.width = w + "px";
el.style.height = h + "px";
if(m == 0) {
posByEvent(el,e,w/2,h/2);
} else {
el.style.left = (m - w/2) + "px";
}
el.style.visibility = "visible";
}
function zmHide(k) {
document.getElementById("l231pb" + k).style.visibility = "hidden";
}


/**lVGBase*/
function show(vi,key) {
if(vi == curVi)
return;
if(curVi != -1) {
var curVid = "v" + curVi;
var el = document.getElementById(curVid);
var type = el.getAttribute("vtype");
if(type == "w") {
if(!w3c) { 
el.Stop();
el.style.display = "none";
}
} else if(type == "q") {
el.Stop();
}
}
var box = document.getElementById(key + "VGBox");
while(box.childNodes.length > 0) {
box.removeChild(box.childNodes.item(0));
}
if(!w3c) {
box.innerHTML = vData[vi][1] != null ? vData[vi][1] : vData[vi][0];
} else {
box.innerHTML = vData[vi][0];
}
curVi = vi;
el = document.getElementById(key + "VGlabel");
if(el != null)
el.childNodes.item(0).data = vData[vi][2];
el = document.getElementById(key + "VGblurb");
if(el != null)
el.innerHTML = vData[vi][3];
}

