﻿function $(id)
{
    return document.getElementById(id);
}

function getposOffset(what, offsettype)
{ 
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
    var parentEl=what.offsetParent; 
    while (parentEl!=null)
    { 
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
         parentEl=parentEl.offsetParent; 
    } 
    return totaloffset; 
}
//判断IE类型
function getbrower(){
var iefox=1;//1为FF浏览器
var browser=navigator.appName 
var b_version=navigator.appVersion 
var version=b_version.split(";"); 
var trim_Version=version[1].replace(/[ ]/g,""); 
if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0") 
{ 
iefox=7;
} 
else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0") 
{ 
iefox=6;
} 
return iefox;
}
//ff支持
function isIE()
{
  return !!(window.attachEvent && !window.opera);
}

//AtoZ
var AtoZ, atz_o,azt_to;
function initAtoZ()
{
    var u=document.createElement("ul");
    var l, a;
    u.style.position="absolute";
    u.style.zIndex =10001;
    for(var i=0;i<26;i++)
    {
        if(i==20||i==21) continue;
        l=document.createElement("li")
        a=document.createElement("a")
        a.innerHTML=String.fromCharCode(97 + i);//输出字母 ASCII转HTML
        a.className="searchpy_word";
		a.id=i;
        a.name=i;
        a.onmouseover=function(){atzOn(this)};
        a.onmouseout=function(){atzOff_c()};
        a.href="javascript:{}";
        l.appendChild(a);
        u.appendChild(l);
    }
    var s=$("searchpy");
    var sf=$("searchpy_f");
    if(isIE())
         if(getbrower()==7) 
           sf.style.top = "37px";
         else
           sf.style.top = "37px";
		   
    else
       sf.style.top = "37px";
    if(isIE()) 
        if(getbrower()==7)
         {
          sf.style.left= "0px";
          u.style.left="80px";}
        else
         {
          sf.style.left= "0px";
           u.style.left="80px";}
    else
       { sf.style.left= "28px";
        u.style.left="80px";}
    s.appendChild(u);
    sf.style.display="none";
}

function atzOn(o)
{   
    clearTimeout(azt_to);azt_to=null;
    if( atz_o!=o){
        atzOff();
        atz_o=o;
    }//关掉非当前的
    o.className='searchpy_word_frame';
    document.getElementById("searchpy_f").style.display="block";
    var par=o.innerHTML;
    update(par);
}
function atzOff()
{   
    if(atz_o!=null)
    {
        atz_o.className='searchpy_word';
        $("searchpy_f").style.display="none";
    }
}
function atzOff_c()
{ 
    azt_to=setTimeout("atzOff()",1000);
}
//
function atzOff2()
{   
    if(atz_o2!=null)
    {
		
        atz_o2.className='searchpy_word';
        $("searchpy_f2").style.display="none";

    }
}
function atzOff_c2()
{ 
    azt_to2=setTimeout("atzOff2()",1000);
}

function atzOff3()
{   
    if(atz_o3!=null)
    {
        atz_o3.className='searchpy_word';
        $("searchpy_f3").style.display="none";
    }
}
function atzOff_c3()
{ 
    azt_to3=setTimeout("atzOff3()",1000);
}
 

function atzOn2(o)
{   
    clearTimeout(azt_to2);azt_to2=null;
    if( atz_o2!=o){
        atzOff2()
        atz_o2=o;
    }
    o.className='searchpy_word_frame';
    document.getElementById("searchpy_f2").style.display="block";
}

function atzOn3(o)
{   
    clearTimeout(azt_to3);azt_to3=null;
    if( atz_o3!=o){
        atzOff3()
        atz_o3=o;
    }
    o.className='searchpy_word_frame';
    document.getElementById("searchpy_f3").style.display="block";
    var par=o.innerHTML;
    update3(par);
}

//AtoZ
var AtoZ2, atz_o2,azt_to2;
function initAtoZ2()
{
    var u2=document.createElement("ul");
    var l2, a2;
    u2.style.position="absolute";
    u2.style.zIndex =10001;
    for(var j=0;j<26;j++)
    {
        if(j==20||j==21) continue;
        l2=document.createElement("li")
        a2=document.createElement("a")
        a2.innerHTML=String.fromCharCode(97 + j);//输出字母 ASCII转HTML
        a2.className="searchpy_word";
		a2.id=j;
        a2.name=j;
        a2.onmouseover=function(){atzOn2(this)};
	   // a.onmouseover=function(){hxq(i)};   //显示层
        a2.onmouseout=function(){atzOff_c2()};
        a2.href="javascript:{}";
        l2.appendChild(a2);
        u2.appendChild(l2);
    }
    var s2=$("searchpy2");
    var sf2=$("searchpy_f2");
	if(isIE())
         if(getbrower()==7) 
           sf2.style.top = "37px";
         else
           sf2.style.top = "37px";
		   
    else
       sf2.style.top = "37px";
    if(isIE()) 
        if(getbrower()==7)
         {
          sf2.style.left= "0px";
          u2.style.left="80px";}
        else
         {
          sf2.style.left= "0px";
           u2.style.left="80px";}
    else
       { sf2.style.left= "28px";
        u2.style.left="80px";}
    s2.appendChild(u2);
    sf2.style.display="none";
}
//AtoZ
var AtoZ3, atz_o3,azt_to3;
function initAtoZ3()
{
    var u3=document.createElement("ul");
    var l3, a3;
    u3.style.position="absolute";
    u3.style.zIndex =10001;
    for(var k=0;k<26;k++)
    {
        if(k==20||k==21) continue;
        l3=document.createElement("li")
        a3=document.createElement("a")
        a3.innerHTML=String.fromCharCode(97 + k);//输出字母 ASCII转HTML
        a3.className="searchpy_word";
		a3.id=k;
        a3.name=k;
        a3.onmouseover=function(){atzOn3(this)};
	   // a.onmouseover=function(){hxq(i)};   //显示层
        a3.onmouseout=function(){atzOff_c3()};
        a3.href="javascript:{}";
        l3.appendChild(a3);
        u3.appendChild(l3);
    }
    var s3=$("searchpy3");
    var sf3=$("searchpy_f3");
     if(isIE())
         if(getbrower()==7) 
           sf3.style.top = "37px";
         else
           sf3.style.top = "37px";
		   
    else
       sf3.style.top = "37px";
    if(isIE()) 
        if(getbrower()==7)
         {
          sf3.style.left= "0px";
          u3.style.left="80px";}
        else
         {
          sf3.style.left= "0px";
           u3.style.left="80px";}
    else
       { sf3.style.left= "28px";
        u3.style.left="80px";}
    s3.appendChild(u3);
    sf3.style.display="none";
}
function clickTime()
{
var thistime = new Date();
var years = thistime.getYear();
var days = thistime.getDay();
var hours = thistime.getHours();
var minutes = thistime.getMinutes();
var seconds = thistime.getSeconds();
var lastDate = new Date(thistime.getYear(), thistime.getMonth(), thistime.getDate(),hours,5*parseInt(minutes/5));
if(hours>17||hours<9){
document.getElementById("mainbody").parentNode.className="row11";
if(hours>=18){
document.getElementById("mainbody").innerHTML = "下次更新时间明日9:00";
}else{
document.getElementById("mainbody").innerHTML = "下次更新时间今日9:00";
}
document.getElementById("lastTime").innerHTML="上次更新时间18:00";
}else{
document.getElementById("mainbody").parentNode.className="row1";
minutes = 4 - minutes % 5;
seconds = 59 - seconds;
var smin = lastDate.getMinutes();
if(smin<10)smin="0"+smin;
document.getElementById("lastTime").innerHTML="上次更新时间"+(lastDate.getHours())+":"+smin;
if(minutes == 0 && seconds == 0){
    //window.location.reload();
    document.getElementById('timeIframe').src='http://www.01w.com/01w/bus01w.html';
}else{
if(minutes<10)minutes="0"+minutes;
if(seconds<10)seconds="0"+seconds;
thistime = minutes + ":" + seconds;
document.getElementById("mainbody").innerHTML = thistime;
}
}
setTimeout("clickTime()",1000);
}
function update(par)
{
     try
     {        　
           $('searchpy_f').innerHTML="正在加载中...";             
            SendData(par);    
                     
     
     }
     catch(e)
     {
       
     }    

}

function SendData(par)
{   
   try
   {
           
				
			var url = 'http://b2b.01w.com/EpClassxmlTrans.ajaxdo';	
			 var pars =''+
        	'&type='+par;		
        	
					
                   
        var myAjax = new Ajax.Request(
        url,
        {
          method: 'post',
          parameters: pars,
          onComplete: ShowPublishStatus
          
        });
           
           
   }
   catch(e)
   {
     alert(e);
     
   }  

}

function ShowPublishStatus(originalRequest)
{
   var result=originalRequest.responseText;
   if(result=='F')
   {
    $('searchpy_f').innerHTML="没有数据！";
   
   }else
   {
    $('searchpy_f').innerHTML=result; 
   var allarray=result.split("|");
   var dd="<ul>";
   for(i=0; i<allarray.length;i++)
   {
      
         var itemarray=allarray[i].split(",");
         dd+="<li><a href='http://"+itemarray[1]+".01w.com'>";
         dd+=itemarray[0];
         dd+="</a></li>"
        
       
   }
  $('searchpy_f').innerHTML=dd;
          
    
   } 
}
function update3(par)
{
        $('searchpy_f3').innerHTML="正在加载中..."; 
            
          SendData3(par);    
                     
   

}

function SendData3(par)
{   
   try
   {
           
				
			var url = 'http://b2b.01w.com/EpClassxmlTrans.ajaxdo';	
			 var pars =''+
        	'&ctype='+par;		
        	
					
                   
        var myAjax = new Ajax.Request(
        url,
        {
          method: 'post',
          parameters: pars,
          onComplete: ShowPublishStatus3
          
        });
           
           
   }
   catch(e)
   {
   alert(e);
     
   }  

}

function ShowPublishStatus3(originalRequest)
{
   var result=originalRequest.responseText;
   if(result=='F')
   {
    $('searchpy_f3').innerHTML="没有数据！";
   
   }else
   {
    $('searchpy_f').innerHTML=result; 
   var allarray=result.split("|");
   var dd="<ul>";
    for(i=0; i<allarray.length;i++)
   {
      
         var itemarray=allarray[i].split(",");
          dd+="<li><a href='http://"+itemarray[1]+".01w.com'>";
         dd+=itemarray[0];
         dd+="</a></li>"
        
       
   }
  $('searchpy_f3').innerHTML=dd;
          
    
   }  
    
}

