var host1 = document.location.host;
var page1 = document.location.href.substring(document.location.href.indexOf(host1)+host1.length);

function hardSetSelectedItem(menuid,pageurl) {
 menuid = getMenuId(menuid);
 pageurl = pageurl.toLowerCase();
 if (pageurl == page1) return;
 var ie = 0;
 var detect = navigator.userAgent.toLowerCase();
 if (detect.indexOf('msie') > 0) ie = 1;
 var menus = document.getElementById(menuid);
 if (menus == null) return;
 var temp=menus.getElementsByTagName("table");
 if (temp.length > 0) menus=temp[0];
 var tds = menus.getElementsByTagName("td");
 setSelected(tds, pageurl, ie);
}

function getMenuId(menuid) {
 return "cat_" + menuid + "_divs";
}

function getMenu(menuid) {
 menuid = getMenuId(menuid);
 var menus = document.getElementById(menuid);
 if (menus == null) return false;
 var tds = menus.getElementsByTagName("td");
 for (var i = 0; i < tds.length; i++) {
  if (tds[i].getAttribute("onclick") != null)	{
   itemurl = tds[i].getAttribute("onclick").toString();
   pos = itemurl.indexOf("=");
   if (pos != -1) {
    pos2 = itemurl.indexOf(';');
    itemurl = itemurl.substring(pos+2,pos2-1);
    if (itemurl.toLowerCase() == page1.toLowerCase()) return true;
   }
  }
 }
 return false;
}

// correctly handle PNG transparency in Win IE 5.5 and 6.
function correctPNG() {
 var arVersion = navigator.appVersion.split("MSIE")
 var version = parseFloat(arVersion[1])
 if ((version >= 5.5 && version<7) && (document.body.filters)) {
  for(var j=0; j<document.images.length; j++) {
   var img = document.images[j];
   var imgName = img.src.toLowerCase();
   if (imgName.substring(imgName.length-3, imgName.length) == "png") {
    var imgID = (img.id) ? "id='" + img.id + "' " : "";
    var imgClass = (img.className) ? "class='" + img.className + "' " : "";
    var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
    var imgStyle = "display:inline-block;" + img.style.cssText;
    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
    var strNewHTML = "<span " + imgID + imgClass + imgTitle
    + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
    + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
    img.outerHTML = strNewHTML;
    j = j-1;
   }
  }
 }
}

//moving function
var isIe=(window.ActiveXObject)?true:false;
isIe=false;
var intTimeStep=30;
var intAlphaStep=(isIe)?3.34:0.0334;
var intTimeout=4000;
//var isIe=false;
var curObj,curOpacity,curOpacityIE,curTop,thieLable,thisText,k;

function startObjVisible(objId) {
 curObj=document.getElementById(objId);
 k=0;
 setObjState();
}

function setObjState() {
 if (curObj.style.display=="") {
  curOpacity=1;
  curOpacityIE=100;
  setObjClose();
 } else {
  if (isIe) {
   curObj.style.cssText="filter:alpha(opacity=0); position:absolute;";
   curObj.filters.alpha.opacity=0;
  } else {
   curObj.style.cssText="position:absolute;";
   curObj.style.opacity=0;
  }
  curObj.style.display="";
  curOpacity=0;
  curOpacityIE=0;
  curTop="215px";
  curObj.style.top=curTop;
  setObjOpen();
 }
}

function setObjOpen() {
 thisLable=document.getElementById("list1");
 thisLable.style.color=colors[29-k];
 
 /*if (k<15) {
  document.getElementById("text5").style.color=colors2[29-k];
 } else {
  document.getElementById("text5").style.display="none";
  thisText=document.getElementById("text1");
  thisText.style.display="block";
  thisText.style.color=colors2[k];
 }*/
 
 k+=1;
 if (isIe) {
  curOpacityIE+=intAlphaStep;
  curObj.filters.alpha.opacity =curOpacityIE;
  if (curOpacityIE<100) setTimeout("setObjOpen()",intTimeStep);
 } else {
  curOpacity+=intAlphaStep;
  curObj.style.opacity =curOpacity;
  if (curOpacity<1) setTimeout("setObjOpen()",intTimeStep);
 }
}

function setObjClose() {
 thisLable=document.getElementById("list4");
 thisLable.style.color=colors[k];
 
 k+=1;
 if(isIe) {
  curOpacityIE-=intAlphaStep;
  if (curOpacityIE>0) {
   curObj.filters.alpha.opacity=curOpacityIE;
   setTimeout("setObjClose()",intTimeStep);}
  else {curObj.style.display="none"; main(0);}
 } else {
  curOpacity-=intAlphaStep;
  if (curOpacity>0) {
   curObj.style.opacity=curOpacity;
   setTimeout("setObjClose()",intTimeStep);
  } else {curObj.style.display="none"; main(0);}
 }
}

function main(i) {
 i+=1;
 if (i==4) document.getElementById("moving-png").src="images/moving2.png";
 else document.getElementById("moving-png").src="images/moving.png";
 if (i==1) {
  startObjVisible("moving");
  window.setTimeout("main(1)",intTimeout);
 } else if (i<=4) {
  k=0;
  moveObj(i-1,i);
  if (i==4) window.setTimeout("startObjVisible('moving')",intTimeout);
  else window.setTimeout("main("+i+")",intTimeout);
 }
}

function moveObj(pre,next) {;
 curTop=parseInt(curTop.replace("px",""))+1;
 curTop=curTop+"px";
 curObj.style.top=curTop;
 
 document.getElementById("list"+pre).style.color=colors[k];
 document.getElementById("list"+next).style.color=colors[29-k];

 /*if (k<15) {
  document.getElementById("text"+pre).style.color=colors2[29-k];
 } else {
  document.getElementById("text"+pre).style.display="none";
  thisText=document.getElementById("text"+next);
  thisText.style.display="block";
  thisText.style.color=colors2[k];
 }*/
 
 k+=1;
 if (k<30) window.setTimeout("moveObj("+pre+","+next+")",intTimeStep);
}

var colors=new Array ("#000000","#090E10","#0C1317","#121C21","#152127","#19272F","#1E2F38","#22353F","#263B45","#2B434F","#2F4956","#334F5D","#385766","#3C5D6E","#3F6274","#456B7E","#487084","#4C768C","#517E95","#55849C","#5E92AD","#5E92AD","#6297B3","#6BA5C4","#6BA5C4","#6FACCB","#72B1D1","#78B9DB","#7BBFE2","#7FC5E9");