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

/**t0flip*/
var fd;
function initFlip(name) {
fd = new Array(7);
var el = document.getElementById(name);
addListener(el,"click",switchFlip);
fd[0] = el.getElementsByTagName("div");
fd[2] = fd[0][fd[0].length-1];
fd[2].style.opacity = .99;
fd[2].style.filter = "alpha(opacity=100)";
fd[2].style.visibility = "visible";
fd[3] = fd[0].length-1;
fd[5] = 10;
fd[6] = setInterval(flip, 4500);
}
function flip() {
fd[3]--;
if(fd[3] < 0)
fd[3]=fd[0].length-1;
fd[1] = fd[2];
fd[2] = fd[0][fd[3]];
fd[2].style.visibility = "visible";
fd[4] = setInterval(fade, 60);
}
function fade() {
if(w3c) {
fd[1].style.opacity = new Number(fd[1].style.opacity) - .099;
fd[2].style.opacity = new Number(fd[2].style.opacity) + .099;
} else {
var cur = fd[1].style.filter;
cur = cur.substring(cur.indexOf('=')+1, cur.lastIndexOf(')'));
fd[1].style.filter = "alpha(opacity=" + (new Number(cur) - 10) + ")";
cur = fd[2].style.filter;
cur = cur.substring(cur.indexOf('=')+1, cur.lastIndexOf(')'));
fd[2].style.filter = "alpha(opacity=" + (new Number(cur) + 10) + ")";
}
fd[5]--;
if(fd[5] == 0) {
fd[1].style.visibility = "hidden";
clearInterval(fd[4]);
fd[5] = 10;
}
}
function switchFlip() {
if(fd[6] == null) {
flip();
fd[6] = setInterval(flip, 4500);
} else {
clearInterval(fd[6]);
fd[6] = null;
}
}

