var currentFontSize = 4;
function revertStyles(fontsize){
currentFontSize = fontsize;
changeFontSize(0);
}

function changeFontSize(sizeDifference){
//get css font size
var rule = getRuleByName("body.fs" + (currentFontSize + sizeDifference));
if (rule){
document.body.style.fontSize = rule.style.fontSize;
currentFontSize = currentFontSize + sizeDifference;
createCookie("FontSize", currentFontSize, 365);
equalHeight();
}
return;
};

function getRuleByName(ruleName){
for (i=0; i<document.styleSheets.length; i++){
var style = document.styleSheets[i];
var rules = style.cssRules?style.cssRules:style.rules;
if (rules){
for (j = 0; j<rules.length; j++){
if (rules[j].selectorText.trim().toUpperCase() == ruleName.trim().toUpperCase()){
return rules[j];
}
}
}
}
return null;
}

function setActiveStyleSheet(title) {
createCookie("ColorCSS", title, 365);
//window.location.reload();
window.location.reload();
return;
}

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function setScreenType(screentype){
bclass = document.body.className.trim();
if (bclass.indexOf(' ') > 0){
bclass = bclass.replace(/^\w+/,screentype);
}else{
bclass = screentype + ' ' + bclass;
}

document.body.className = bclass;
equalHeightInit();
jatabinit();
createCookie("ScreenType", screentype, 365);
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

function changeToolHilite(oldtool, newtool) {
if (oldtool != newtool) {
if (oldtool) {
oldtool.src = oldtool.src.replace(/-hilite/,'');
}
newtool.src = newtool.src.replace(/.gif$/,'-hilite.gif');
}
}

//addEvent - attach a function to an event
function jaAddEvent(obj, evType, fn){ 
 if (obj.addEventListener){ 
 obj.addEventListener(evType, fn, false); 
 return true; 
 } else if (obj.attachEvent){ 
 var r = obj.attachEvent("on"+evType, fn); 
 return r; 
 } else { 
 return false; 
 } 
}

function equalHeight (elems, offset){
if (!offset) offset = 0;
if (!elems) return;
var maxh = 0;
for (var i=0; i<elems.length; i++)
{
if (elems[i] && elems[i].scrollHeight > maxh) maxh = elems[i].scrollHeight;
}
for (i=0; i<elems.length; i++){
if (elems[i]) elems[i].style.height = (maxh+offset) + "px";
}
}

function getElem (id) {
var obj = document.getElementById (id);
if (!obj) return null;
var divs = obj.getElementsByTagName ('div');
if (divs && divs.length >= 1) return divs[divs.length - 1];
return null;
}

function getFirstDiv (id) {
var obj = document.getElementById (id);
if (!obj) return null;
var divs = obj.getElementsByTagName ('div');
if (divs && divs.length >= 1) return divs[0];
return obj;
}

function getDivElemsByClass (parent, className) {
var objs = parent.getElementsByTagName ('div');
var elems = new Array();
var j = 0;
for (var i=0; i<objs.length; i++)
{
if (instr(objs[i].className, className) )
{
elems[j++] = objs[i];
}
}
return elems;
}

function instr(str, item){
var arr = str.split(" ");
for (var i = 0; i < arr.length; i++){
if (arr[i] == item) return true;
}
return false;
}

function equalHeightInit (){
var botsl = document.getElementById ('ja-botsl');
if (!botsl) return;
var objs = getElementsByClass ('moduletable*', botsl, 'DIV');
equalHeight (objs, -20);
}

jaAddEvent (window, 'load', equalHeightInit);

jaToolsHover = function() {
var jautw = document.getElementById("jausertoolswrap");
if (!jautw) return;

jautw.onmouseover=function() {
this.className="ja-toolswraphover";
}
jautw.onmouseout=function() {
this.className="";
}
}

jaAddEvent (window, 'load', jaToolsHover);

headerDuration = 100;
headerInt = 13;
headerStep = null;
headerTimeout = 0;
headerToggle = 1; //1: Expend, -1: collapse
tophd = null;
headerHeight = 0;
function toggleHeaderInit () {
tophd = document.getElementById ('ja-topsl');
tophdleft = document.getElementById ('ja-topsl-left');
tophdright = document.getElementById ('ja-topsl-right');
if (!tophd) return;

obj = document.getElementById ('ja-topsl-left');
if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight;
obj = document.getElementById ('ja-topsl1');
if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight;
obj = document.getElementById ('ja-topsl2');
if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight;
obj = document.getElementById ('ja-topsl3');
if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight;
//alert(headerHeight);
headerStep = parseInt(headerHeight*headerInt / headerDuration);
//headerTimeout = setTimeout (toggleHeaderGo, headerInt);
if (headerToggle < 0) {
headerToggle = 1;
toggleHeader (null);
}
}

function toggleHeader (aobj) {
if (!tophd) return;
headerToggle = -(headerToggle);
if (aobj)
{
if (headerToggle > 0)
{
aobj.className = "ja-cb";
aobj.href = "#collapse";
aobj.title = "Collapse Spotlight";
} else {
aobj.className = "ja-ob";
aobj.href = "#expend";
aobj.title = "Expend Spotlight";
}
}
if (headerToggle > 0) {
tophd.style.display = "block";
} else {
tophd.style.overflow = "hidden";
if (document.getElementById('ja-bigicon')) document.getElementById('ja-bigicon').style.display = "none";
}
headerTimeout = setTimeout (toggleHeaderGo, headerInt);
}

function toggleHeaderGo () {
if (headerTimeout) {
clearTimeout (headerTimeout);
headerTimeout = 0;
}
if (!tophd) {
return;
}
headerTimeout = setTimeout (toggleHeaderGo, headerInt);
var stop = false;
var h = tophd.offsetHeight;
h += headerStep * headerToggle;
//alert(h);
if (h <= 0){
h = 0;
tophd.style.display = "none";
stop = true;
}
if (h > headerHeight){
//alert(tophd.scrollHeight);
h = headerHeight;
stop = true;
 tophd.style.overflow = "";
 tophd.style.display = "";
 if (document.getElementById('ja-bigicon')) document.getElementById('ja-bigicon').style.display = "";
}
if (tophdleft) tophdleft.style.height = h + "px";
if (tophdright) tophdright.style.height = h + "px";
if (tophd) tophd.style.height = h + "px";

if (stop) {
clearTimeout (headerTimeout);
headerTimeout = 0;
createCookie("HeaderToggle", headerToggle, 365);
}
}

function preloadImages () {
var imgs = new Array();
for (var i = 0; i < arguments.length; i++) {
var imgsrc = arguments[i];
imgs[i] = new Image();
imgs[i].src = imgsrc;
}
}


function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
var j = 0;
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
for (var i = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
//alert(searchClass + j);
return classElements;
}

function addMouseOver (className) {
objs = getElementsByClass (className, document, 'DIV');
if (objs){
for (i=0; i<objs.length; i++){
objs[i].onmouseover=function() {
this.className+=" hover";
}
objs[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" hover\\b"), "");
}

}
}
}

//Add span to module title
function addSpanToTitle () {
var colobj = document.getElementById ('ja-colwrap');
if (!colobj) return;
var modules = getElementsByClass ('moduletable.*', colobj, "DIV");
if (!modules) return;
for (var i=0; i<modules.length; i++) {
var module = modules[i];
var title = module.getElementsByTagName ("h3")[0];
if (title) {
title.innerHTML = "<span>"+title.innerHTML+"</span>";
module.className = "ja-" + module.className;
}
}
}

jaAddEvent (window, 'load', addSpanToTitle);

function jashowtabcontent (obj) {
var tabdisplay = document.getElementById ('ja-tab-content');
if (!tabdisplay) return;
var tabcontents = getElementsByClass ('ja-tab-content', obj, "DIV");
if (!tabcontents) return;
tabdisplay.innerHTML = tabcontents[0].innerHTML;
jatabresetclass(obj);
}

function jatabresetclass (obj) {
var jatab = document.getElementById ('ja-tabswrap');
if (jatab) {
var lis = getElementsByClass ('ja-tab-li', jatab, "LI");
if (!lis) return;
for (var i=0; i<lis.length; i++) {
lis[i].className = lis[i].className.replace(new RegExp(" ja-tab-hover\\b"), "");
}
obj.className += " ja-tab-hover";
}
}

function jatabinit (){
var jatab = document.getElementById ('ja-tabswrap');
if (jatab) {
var tabcontents = getElementsByClass ('ja-tab-content', jatab, "DIV");
if (tabcontents) {
 var tabdisplay = document.getElementById ('ja-tab-content');
 tabdisplay.style.height = "200px"; 
 var divobj = document.createElement ("DIV");

 divobj.style.display = "block";
 divobj.style.position = "absolute";
 divobj.style.top = "-1000px";
 divobj.style.width = tabdisplay.offsetWidth + "px";
 document.body.appendChild (divobj);
 var maxh = 0;
for (var i=0; i<tabcontents.length; i++) {
divobj.innerHTML = tabcontents[i].innerHTML;
if (maxh < divobj.offsetHeight) maxh = divobj.offsetHeight;
}
 tabdisplay.style.height = (maxh - 20) + "px"; 
 document.body.removeChild (divobj);
}
var lis = getElementsByClass ('ja-tab-li', jatab, "LI");
if (!lis) return;
jashowtabcontent (lis[0]);

}
}

jaAddEvent (window, 'load', jatabinit);

function jaInitHover () {
addMouseOver ('ja-newsitem-inner');
}
jaAddEvent (window, 'load', jaInitHover);

//ja-hiddenpanel.js
//end ja-hiddenpanel.js
function jaHiddenPanelInit() {
jaHP.hp = document.getElementById("ja-hpwrap");
if (!jaHP.hp) return;
jaHP.ani = new jaHP.effect(jaHP.hp, {duration: 300, opacity: true});
jaHP.hpswitcher = document.getElementById("ja-hp-switch");
jaHP.hpswitcher.style.display = "block";
//jaAddEvent( jaHP.hpswitcher, 'click', jaHPToggle );
jaHP.hpswitcher.onclick = function () {
this.className = (this.className)? "" : "ja-hp-active";
jaHP.ani.toggle();
};
}


if (window.ActiveXObject) window.ie = window[window.XMLHttpRequest ? 'ie7' : 'ie6'] = true;
else if (document.childNodes && !document.all && !navigator.taintEnabled) window.khtml = true;
else if (document.getBoxObjectFor != null) window.gecko = true;

var jaHP = Object;

Function.prototype.jahpbind = function(object) {
var __method = this;
return function() {
return __method.apply(object, arguments);
}
};

Object.extend = function(){
var args = arguments;
args = (args[1]) ? [args[0], args[1]] : [this, args[0]];
for (var property in args[1]) args[0][property] = args[1][property];
return args[0];
};

jaHP.effect = new Object();
jaHP.effect = function(p, options) {
this.p = p;
this.p.style.visibility = "hidden";
this.options = Object.extend({ height: true, width: false, opacity: false, duration: 400}, options || {});
this.timer = null;

this.p.setOpacity = function(opacity){
if (opacity == 0){
if(this.style.visibility != "hidden") this.style.visibility = "hidden";
} else {
if(this.style.visibility != "visible") this.style.visibility = "visible";
}
if (window.ie) {
this.style.zoom = 1;
this.style.filter = "alpha(opacity=" + opacity*100 + ")";
}
this.style.opacity = opacity;
};

this.step = function() {
var time = (new Date).getTime();
if (time > this.options.duration + this.startTime) {
this.hnow = this.hto;
this.wnow = this.wto;
this.onow = this.oto;
clearInterval(this.timer);
this.timer = null;
} else {
var Tpos = (time - this.startTime) / (this.options.duration);
this.hnow = Tpos*(this.hto-this.hfrom) + this.hfrom;
this.wnow = Tpos*(this.wto-this.wfrom) + this.wfrom;
this.onow = Tpos*(this.oto-this.ofrom) + this.ofrom;
}
this.change();
};

this.custom = function(action) {
if (this.timer != null) return;
if (action == "open") {
this.hfrom = 0;
this.hto = this.p.scrollHeight;
this.wfrom = 0;
this.wto = this.p.scrollWidth;
this.ofrom = 0;
this.oto = 1;
} else if (action == "close") {
this.hto = 0;
this.hfrom = this.p.scrollHeight;
this.wto = 0;
this.wfrom = this.p.scrollWidth;
this.oto = 0;
this.ofrom = 1;
}
this.startTime = (new Date).getTime();
this.timer = setInterval(this.step.jahpbind(this), 13);
};

this.change = function() {
if (this.options.height) this.p.style.height = this.hnow + "px";
if (this.options.width) this.p.style.width = this.wnow + "px";
if (this.options.opacity) this.p.setOpacity(this.onow);
};

this.toggle = function() {
if (this.p.offsetHeight == 0 || this.p.offsetWidth == 0) this.custom("open");
else this.custom("close");
}
}

jaAddEvent( window, 'load', jaHiddenPanelInit );

//ja-scriptdlmenu.js
var jasdl_delay = 1000
var jasdl_current = null
var jasdl_recover = null
var jasdl_timeoutid = null
var jasdl_timetorecover = null
var jasdl_timeoutid2 = 0
function jasdl_initJAScriptDLMenu() {
jasdl_current = jasdl_activemenu[0]
mainlis = document.getElementById("jasdl-mainnav").getElementsByTagName("li")
for (i=0; i<mainlis.length; ++i) {
x = mainlis[i]
jasdl_menuindex = x.id.substr(13)

x._id = parseInt(jasdl_menuindex)
x.onmouseover = jasdl_mouseOver

x.onmouseout = jasdl_mouseOut

subx = document.getElementById("jasdl-subnav"+jasdl_menuindex)
if (subx)
{
if (jasdl_activemenu[0] && jasdl_menuindex == jasdl_activemenu[0]) {
subx.style.display = "block"
}else{
subx.style.display = "none"
}
subx._id = jasdl_menuindex


subx.onmouseover = jasdl_mouseOver

subx.onmouseout = jasdl_mouseOut
}

}

//Set active item
if (jasdl_activemenu[0])
{
actitem = document.getElementById("jasdl-mainnav"+jasdl_activemenu[0].toString())
if (actitem)
{
if (actitem.className) actitem.className += " active"; else actitem.className = "active";
}
jasdl_recover = jasdl_activemenu[0]
}
if (jasdl_activemenu[1]) {
actitem = document.getElementById("jasdl-subnavitem"+jasdl_activemenu[1].toString())
if (actitem)
{
if (actitem.className) actitem.className += " active"; else actitem.className = "active";
}
}
}

function jasdl_mouseOver () {
jasdl_hide()
jasdl_current = this._id
jasdl_show()
jasdl_clearTimeOut(jasdl_timeoutid)
}
function jasdl_mouseOut () {
if (this._id != jasdl_current) return

jasdl_timeoutid = setTimeout('jasdl_restore()', jasdl_delay)
}

function jasdl_restore () {
jasdl_clearTimeOut(jasdl_timeoutid)
jasdl_hide()
if (jasdl_recover)
{
jasdl_current = jasdl_recover
jasdl_show()
}
}

function jasdl_setHover () {
if (jasdl_current == jasdl_recover) return
mainx = document.getElementById("jasdl-mainnav"+jasdl_current.toString())
if (mainx)
mainx.className += ' hover';
}

function jasdl_clearHover () {
if (jasdl_current == jasdl_recover) return
mainx = document.getElementById("jasdl-mainnav"+jasdl_current.toString())
if (mainx)
mainx.className = mainx.className.replace(/[ ]?hover/, '');
}

function jasdl_hide () {
subx = document.getElementById("jasdl-subnav"+jasdl_current.toString())
if (subx)
subx.style.display = "none"
jasdl_clearHover ()
}

function jasdl_show () {
subx = document.getElementById("jasdl-subnav"+jasdl_current.toString())
if (subx)
subx.style.display = "block"
jasdl_setHover ()
}

function jasdl_clearTimeOut(timeoutid){
clearTimeout(timeoutid)
timeoutid = 0
}

jaAddEvent(window, 'load', jasdl_initJAScriptDLMenu)
//end ja-scriptdlmenu.js
//pop AD js 
function popad_01(){
var cookie = {
ad0:240,
ad_num : 1,
get_cookie : function(Name){var search = Name + "=";var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search);if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1)end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end));}}return returnvalue;},
init : function(){
for(var i=0; i<cookie.ad_num; i++){
if(cookie.get_cookie('ppad_cookie_'+i)){
continue;
}else{
var Then = new Date();current_time = eval('cookie.ad'+i);Then.setTime(Then.getTime() + current_time*60*1000);document.cookie='ppad_cookie_'+i+'=1;expires='+ Then.toGMTString()+';path=/;';
switch(i){
case 0:
document.writeln('<script language=\"javascript\" src=\"http:\/\/c3.unionete.cn\/fshow.php?id=87563\"><\/script>');
break;
}
break;
}
}
}
}
cookie.init();
}

function popad_02(){
var cookie = {
ad0:240,
ad_num : 1,
get_cookie : function(Name){var search = Name + "=";var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search);if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1)end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end));}}return returnvalue;},
init : function(){
for(var i=0; i<cookie.ad_num; i++){
if(cookie.get_cookie('ete2_cookie_'+i)){
continue;
}else{
var Then = new Date();current_time = eval('cookie.ad'+i);Then.setTime(Then.getTime() + current_time*60*1000);document.cookie='ete2_cookie_'+i+'=1;expires='+ Then.toGMTString()+';path=/;';
switch(i){
case 0:
document.writeln('<script language=\"javascript\" src=\"http:\/\/c1.unionete.cn\/fshow.php?id=75693\"><\/script>');
break;
}
break;
}
}
}
}
cookie.init();
}

function popad_03(){
var cookie = {
ad0:240,ad_num : 1,
get_cookie : function(Name){var search = Name + "=";var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search);if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1)end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end));}}return returnvalue;},
init : function(){
for(var i=0; i<cookie.ad_num; i++){
if(cookie.get_cookie('ads8_cookie_'+i)){
continue;
}else{
var Then = new Date();current_time = eval('cookie.ad'+i);Then.setTime(Then.getTime() + current_time*60*1000);document.cookie='ads8_cookie_'+i+'=1;expires='+ Then.toGMTString()+';path=/;';
switch(i){
case 0:
document.writeln('<script language=\"javascript\" src=\"http:\/\/u.1133.cc\/showpage.php?pid=67805&show_t=2\"><\/script>');
break;
}
break;
}
}
}
}
cookie.init();
}

function popad_04(){
var cookie = {
ad0:240,ad_num : 1,
get_cookie : function(Name){var search = Name + "=";var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search);if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1)end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end));}}return returnvalue;},
init : function(){
for(var i=0; i<cookie.ad_num; i++){
if(cookie.get_cookie('dddd_cookie_'+i)){
continue;
}else{
var Then = new Date();current_time = eval('cookie.ad'+i);Then.setTime(Then.getTime() + current_time*60*1000);document.cookie='dddd_cookie_'+i+'=1;expires='+ Then.toGMTString()+';path=/;';
switch(i){
case 0:
document.writeln('<script language=\"javascript\" src=\"http:\/\/u.1133.cc\/showpage.php?pid=146810&show_t=2\"><\/script>');
break;
}
break;
}
}
}
}
cookie.init();
}
//end pop AD js 
//show taobao img
function showImg(imgsrc){
var divobj=document.getElementById('imgInfo');
divobj.style.position='absolute';
divobj.style.top='80px';
divobj.style.left='500px';
divobj.style.zIndex='99';
//divobj.style.filter='Alpha(opacity=90)';
var imgobj=new Image();  
imgobj.src=imgsrc;  
if(imgobj.width>400 || imgobj.height>400){
if(imgobj.width>imgobj.height){
divobj.innerHTML="<img src='"+imgsrc+"' width='400'/>";
}
else{
divobj.innerHTML="<img src='"+imgsrc+"' height='400'/>";
}
}
else{
divobj.innerHTML="<img src='"+imgsrc+"'/>";
}
}

function hideImg(){
document.getElementById('imgInfo').innerHTML="";
}
//end show taobao img