var w3c=(document.getElementById)? true:false;
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
var ie5=(w3c && ie)? true : false;
var ns6=(w3c && (navigator.appName=="Netscape"))? true: false;
var op8=(navigator.userAgent.toLowerCase().indexOf("opera")==-1)? false:true;

String.prototype.replaceAll = function(s1,s2){
this.str=this;
if(s1.length==0)return this.str;
 var idx=this.str.indexOf(s1);
 while(idx>=0){
 this.str=this.str.substring(0, idx)+s2+this.str.substr(idx+s1.length);
 idx=this.str.indexOf(s1);
 }
 return this.str;
}

//var sRootDir="../";
var sRootDir="../"; //临时路径

function HitFam(n1,n2){
 for (var i=1;i<=n2;i++) {
   if (i==n1) {
    //addCls($("FamTab"+i),"active"); 
    //delCls($("famSiteBox"+i),"hidden"); 
	$("FamTab"+i).className="active";
	$("famSiteBox"+i).className="famSiteBox";
   } else {
    //delCls($("FamTab"+i),"active"); 
    //addCls($("famSiteBox"+i),"hidden");   
 	$("FamTab"+i).className="";
	$("famSiteBox"+i).className="hidden";
   }
 }
}

function $(o){
 var o=document.getElementById(o)?document.getElementById(o):o;
 return o;
}

document.getElementsByClassName = function(className,oBox) {
 this.d= oBox || document;
 var children = this.d.getElementsByTagName('*') || document.all;
 var elements = new Array();
 for (var i = 0; i < children.length; i++) {
 var child = children[i];
 var classNames = child.className.split(' ');
 for (var j = 0; j < classNames.length; j++) {
 if (classNames[j] == className) {
 elements.push(child);
 break;
 }
 }
 }
 return elements;
}

$Cls = function (s,o){
return document.getElementsByClassName(s,o);
};

function ExCls(o,a,b){
 o.className=(o.className.indexOf(a)!=-1)?b:a;
}

function addCls(o,s){
 if (o.className.length>0) {
	 o.className+=" "+s;
 } else {
	 o.className=s;
 }
}

function delCls(o,s){
 o.className=o.className.replace(s,"");
  o.className=o.className.replaceAll("  ","");
}


function SetCookie(name,value){
     var argv=SetCookie.arguments;
     var argc=SetCookie.arguments.length;
     var expires=(2<argc)?argv[2]:null;
     var path=(3<argc)?argv[3]:null;
     var domain=(4<argc)?argv[4]:null;
     var secure=(5<argc)?argv[5]:false;
     document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
} 

function GetCookie(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;
}

function GetSubCookie(Name, CookieValue) {
 var search = Name + "=";
 var returnvalue = "";
 if (CookieValue.length > 0) {
  offset = CookieValue.indexOf(search);
  if (offset != -1) {      
   offset += search.length;
   end = CookieValue.indexOf("&", offset);                        
   if (end == -1)
   end = CookieValue.length;
   returnvalue=unescape(CookieValue.substring(offset,end));
  }
 }
 return returnvalue;
}


function SavMyHit(o){
 var MyHitStatus=GetCookie("MyHitStatus");
 if (MyHitStatus=="close") return;
 var sNewSite=o.innerHTML+"|"+o.href+";";
 var sOldSite=GetCookie("MyHappywzHits");
  sOldSite.length>2048?sOldSite=sOldSite.substring(0,2048):"";
 if (sOldSite.indexOf(sNewSite)!=-1) {
  sOldSite=sOldSite.replace(sNewSite,"");
 }
  sNewSite+=sOldSite;
  var expdate=new Date();
  expdate.setTime(expdate.getTime()+(24*60*60*1000*30));
  SetCookie("MyHappywzHits",sNewSite,expdate,"/",null,false);
  //SetCookie("MyHappywzHits","",expdate,"/",null,false);
  //GetMyHit();
}

function ExChgDir(){
 var oBox=$("Bodyer");
 var sCls="noBSide";
 var havCls=(oBox.className.indexOf(sCls)!=-1);
 if (havCls) {
   delCls(oBox,sCls); 
   $("BtnCloseDir").innerHTML="关闭目录";
 } else {
   addCls(oBox,sCls);   
   $("BtnCloseDir").innerHTML="打开目录";
 }
}

function MySkin(n){
 var sHtml="";
 if (n!=1) {
 sHtml="<a id=\"BtnCloseDir\" href=\"javascript:void(0)\" onclick=\"ExChgDir();\">关闭目录</a>&nbsp;|&nbsp;"
 sHtml+="<a href=\"#\" title=\"界面更新，暂不提供！！！\">页面风格</a>&nbsp;|&nbsp;"
 sHtml+="<a href=\"../post/r.asp\" target=\"_blank\">注册会员</a>";
 } else {
 sHtml="<a href=\"#\" title=\"界面更新，暂不提供！！！\">页面风格</a>&nbsp;|&nbsp;"
 sHtml+="<a href=\"../post/r.asp\" target=\"_blank\">注册会员</a>&nbsp;";
 }
 sHtml="<p id=\"OrdSkin\">"+sHtml+"</p>";
 document.write (sHtml);
}


function HitTree(e){
 var tag = ie ? e.srcElement : e.target;ExCls(tag.parentNode,"open","close");
}

function SetEvt(o,a,b){
 ie?o.attachEvent("on"+a,b):o.addEventListener(a,b, false);
}



function CNLTree(id,ClsOpen,ClsClose,ClsChild){
 this.id=id;
 this.ClassOpen=ClsOpen || "open";
 this.ClassClose=ClsClose || "close";
 this.ClassChild=ClsChild || "child";
 this.AddEvt = function () {
  var arrObj=$(this.id).getElementsByTagName("img");
  for (var i=0;i<arrObj.length; i++) {
   //arrObj[i].className=="s"?SetEvt(arrObj[i],"click",HitTree):"";
   if (arrObj[i].className=="s") {
     SetEvt(arrObj[i],"click",HitTree);
	 ie?arrObj[i].style.cursor="hand":"";
   }
  }
 }
}
function gt(f){
 var t;
 var u;
 if(f.a0 != undefined){
  u = 'Y:';
  t = f.k.value;
  if(f.a0.checked==true){u+='0;';}
  if(f.a1.checked==true){u+='1;';}
  if(f.a2.checked==true){u+='2;';}
  if(f.a3.checked==true){u+='3;';}
  if(f.a4.checked==true){u+='4;';}
  if(f.a5.checked==true){u+='5;';}
  if(f.a6.checked==true){u+='6;';}
  if(f.a7.checked==true){u+='7;';}
  if(f.a8.checked==true){u+='8;';}
  if(f.a9.checked==true){u+='9;';}
  if(f.a10.checked==true){u+='10;';}
  if(f.a11.checked==true){u+='11;';}
  if(f.a12.checked==true){u+='12;';}
  if(f.a13.checked==true){u+='13;';}
  if(f.a14.checked==true){u+='14;';}
  if(f.a15.checked==true){u+='15;';}
 }
 else{
  t = f.Ka.value;
  u = 'G';
 }
 try{
  new Image().src = "http://www.pic22.com/web/url?a=S&u="+u+"&t="+t;
 }catch(ex){}
 if($("Ka").value == ""){
  $("ch").value = "noprefill";
 } else {
  $("ch").value = "prefill";
 }
}

function s4(){
 var v=$("Kaa").value
 if($("a0").checked)
 window.open("http://www.google.cn/search?complete=1&hl=zh-CN&q="+v,"0");
 if($("a1").checked)
 window.open("http://www.baidu.com/baidu?tn=pic22&word="+v,"1");
 if($("a2").checked)
 window.open("http://www.sogou.com/web?query="+v,"2");
 if($("a3").checked)
 window.open("http://search.cn.yahoo.com/search?ei=gbk&fr=fp-tab-web-ycn&pid=ysearch&source=yahoo_yhp_0706_search_button&p="+v,"4");
 if($("a4").checked)
 window.open("http://www.iask.com/w?pid=40623&fromlianmeng&k="+v,"4");
 if($("a5").checked)
 window.open("http://map.baidu.com/#word="+v+"&ct=10","5");
 if($("a6").checked)
 window.open("http://zhidao.baidu.com/q?word="+v+"&ct=17&pn=0&tn=ikaslist&rn=10","6");
 if($("a7").checked)
 window.open("http://cb.kingsoft.com/search?t=word&lang=gb2312&s="+v,"7");
 if($("a8").checked)
 window.open("http://music.cn.yahoo.com/search?pid=ysearch&source=ysmi_hsch_r&p="+v,"8");
 if($("a9").checked)
 window.open("http://mp3.baidu.com/m?f=ms&rn=10&tn=pic22&ct=150994944&word="+v+"&lm=-1","9");
 if($("a10").checked)
 window.open("http://movie.baidu.com/srh.php?tn=pic22&word="+v,"10");
 if($("a11").checked)
 window.open("http://chaoji.yok.com/Result.aspx?page=1&keyword="+v+"&by=soft_name","11");
 if($("a12").checked)
 window.open("http://image.cn.yahoo.com/search?pid=ysearch&source=ysearch_img_result_topsearch&p="+v,"12");
 if($("a13").checked) 
 window.open("http://www.cmfu.com/searchbook.asp?s_class=Bl_name&s_book="+v,"13");
 if($("a14").checked)
 window.open("http://news.baidu.com/ns?word="+v,"14");
 if($("a15").checked)
 window.open("http://search.qihoo.com/search.html?kw="+v,"15");
 var cusSea="";
 for(i=0;i<16;i++){
    if($("a"+i).checked)   cusSea=cusSea+i+"|";
 }
 if (cusSea=="") cusSea = "0|1";
 else cusSea=cusSea.substr(0,cusSea.length-1);
 setCusSea(cusSea);
 return false;
}

function setCusSea(cusSea){
 var expdate=new Date();
 expdate.setTime(expdate.getTime()+(24*60*60*1000*365));
 SetCookie("cusSea_happywz",cusSea,expdate,"/",null,false);
}
function getCusSea() {
 var cusSea = GetCookie("cusSea_happywz")?GetCookie("cusSea_happywz"):"0|1";
 cusSea=cusSea.split("|");
 for(var i=0;i<16;i++){
  $("a"+i).checked=false;
 }
 for(var j=0;j<cusSea.length;j++){
  $("a"+cusSea[j]).checked=true;
 }
}


function tracking(e){
 e = e ? e : window.event;
 var s = e.srcElement ? e.srcElement : e.target;
 var a = s.tagName;
 var u = s.href;
 var t = s.innerText ? s.innerText : s.textContent;
 if(a == "A" || a == "IMG"){
  if(a == "IMG"){
   t = s.href || s.src;
   u = s.parentElement || s.parentNode;
  }
  try{
   new Image().src = "http://www.pic22.com/web/url?a="+a+"&u="+escape(u)+"&t="+t;
  }catch(ex){}
 }
 return true;
} 

function LTrim(str){
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(0)) != -1){
var j=0, i = s.length;
while (j < i && whitespace.indexOf(s.charAt(j)) != -1){
	j++;
}
s = s.substring(j, i);
}
return s;
}

function RTrim(str){
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(s.length-1)) != -1){
var i = s.length - 1;
while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1){
i--;
}
s = s.substring(0, i+1);
}
return s;
}

function getBase() {
    var base_yimu = GetCookie("base_yimu")?GetCookie("base_yimu"):"";
    if (base_yimu==1)  setBase(1);
    showBase(base_yimu);
}

function setBase(n){
 var tar="";
 n!=0?tar="blank":"";
 //var urls = document.getElementsByTagName("A");
 var urls=$("hSiteCate").getElementsByTagName("a");
 for (var i=0;i<urls.length;i++ ) {
  urls[i].target=tar;
 }
 urls=$("hCoolSite").getElementsByTagName("dt");
 for (var i=0;i<urls.length;i++ ) {
  urls[i].getElementsByTagName("a")[0].target=tar;
 }
  var expdate=new Date();
 expdate.setTime(expdate.getTime()+(24*60*60*1000*365));
 SetCookie("base_yimu",n,expdate,"/",null,false);
 showBase(n);
}
function showBase(n) {
    if (n=="" || n==0) {
        $("setBase").innerHTML = "<a href='javascript:setBase(1);' title='点此设置，在您点击“网址分类”中的分类项时，&#10;将在新窗口打开新链接' target='_self'>在新窗口打开链接</a>";
    } else {
        $("setBase").innerHTML = "<a href='javascript:setBase(0);' title='点此设置，在您点击“网址分类”中的分类项时，&#10;将在当前页打开新链接' target='_self'>在当前页打开链接</a>";
    }
}
function showUrl(hot) {
for(i=0;i<hot.length;i++){
  var lst = '';
  if (i == (hot.length -1))
    lst = ' class="lst"';
  document.write('<LI'+lst+'><b>'+(i+1)+'.</b><a href="'+unescape(hot[i][0])+'" target="_blank">'+hot[i][1]+"</a></LI>");
}
}
