﻿// JScript 文件
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadimg() { //v3.0
  var d=document; if(d.img){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimg.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadimg() { //v3.0
  var d=document; if(d.img){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimg.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function GetUrl()
{   
    var url = location.href.replace('http://','');
   if(url.indexOf("sell")>0)
   {
    url="sell";
   }
   else if(url.indexOf("buy")>0)
   {
    url="buy";
   }
   else
   {   
       url = url.split('/');
       var index = url[url.length-1].indexOf('.');
       url = url[url.length-1].substring(0,index);
   }
   SetImg(url)
}

function SetSelect(value)
{    
  //var select_type = document.getElementsByName("select_type");
  
  if(value=="找买家")
  {
    document.getElementById("select_type_2").checked="checked";
  }
  else if(value=="找卖家")
  {
    document.getElementById("select_type_1").checked="checked";
  }  
}

function SetImg(res)
{
    var td_buy = document.getElementById("li_buy");
    var a_buy = document.getElementById("a_buy");
    
    var td_sell = document.getElementById("li_sell");
    var a_sell = document.getElementById("a_sell");
    
    //var td_room = document.getElementById("li_room");
    var a_room = document.getElementById("a_room");
    
    var td_refer = document.getElementById("li_ad");
    var a_refer = document.getElementById("a_ad");
    
    if(res)
    {
        switch(res)
        {        
            case "buy":
            td_buy.className="w63 cur";
            a_buy.style.color="White";
            a_buy.style.font="bold 14px/26px '宋体'";
            SetSelect('找买家');
                break;
            case "sell":
            td_sell.className="w63 cur";
            a_sell.style.color="White";
            a_sell.style.font="bold 14px/26px '宋体'";
            SetSelect('找卖家');
                break;
            case "BuyRecordList":
             td_buy.className="w63 cur";
             a_buy.style.color="White";
             a_buy.style.font="bold 14px/26px '宋体'";
             SetSelect('找买家');
                break;
             case "SellRecordList":
               td_sell.className="w63 cur";
               a_sell.style.color="White";
               a_sell.style.font="bold 14px/26px '宋体'";
               SetSelect('找卖家');
               break; 
              case "BuySelInfo":
                td_buy.className="w63 cur";
                a_buy.style.color="White";
                a_buy.style.font="bold 14px/26px '宋体'";
             SetSelect('找买家');
                break;
             case "SellSelInfo":
              td_sell.className="w63 cur";
               a_sell.style.color="White";
               a_sell.style.font="bold 14px/26px '宋体'";
               SetSelect('找卖家');
               break; 
             case "U1D1Room":
                li_room.className="w63 cur";
                a_room.style.color="White";
                a_room.style.font="bold 14px/26px '宋体'";              
               break; 
              case "Refer":
                td_refer.className="w91";
                //a_refer.style.color="White";
                //a_refer.style.font="bold 14px/26px '宋体'";
               break; 
        }
    }
    
}


/*订阅信息方法-开始*/
function OpenSetupWindow(url, winName, w, h)
{		    
    window.open(url, winName, 'width='+w+',height='+h+',resizable=0,scrollbars=no,menubar=no,status=yes');
}	        
function NoLoginDy(){alert('您尚未登陆或登陆超时无法订阅信息!');}
function LoginDy(){OpenSetupWindow('/go2aspx.aspx?m=/chat/&tourl=MessageSub.aspx', 'MsgSubscribe', 490, 385);}
/*订阅信息方法-结束*/

function addHome()
{
    document.body.style.behavior='url(#default#homepage)';
    document.body.setHomePage('http://www.u1d1.com');
}
function HotKey_click(key)
{
    document.getElementById("input_search_text").value=key;
    search();
}


 var hot_key=new Array()
      hot_key[0]="服装";
      hot_key[1]="皮具";
      hot_key[2]="食品";      
      hot_key[3]="家具";
      hot_key[4]="厨卫";
      hot_key[5]="家电";
      hot_key[6]="礼品";
      hot_key[7]="家居";
      hot_key[8]="数码";
      hot_key[9]="办公";
      hot_key[10]="保健";
      hot_key[11]="设备";
      hot_key[12]="五金";
      hot_key[13]="建材";
      hot_key[14]="电子";
      hot_key[15]="鞋帽";
      
      
      var hot_key_more=new Array()
      hot_key_more[0]="女装 时装 内衣 内裤 衬衣 T恤 睡衣 服饰 孕妇装 牛仔裤  男装 童装 制服 西服 袜子 领带 夹克";
      hot_key_more[1]="商务包 旅行包 皮包 手提包 男包 女包 手包 背包 挎包 腰包 钱包 运动包 箱包 皮带 书包 电脑包";      
      hot_key_more[2]="美食 快餐 奶茶 饮料 冰淇淋 酒 咖啡 糖 水果 蔬菜 果汁 牛奶 花生油 火腿 调味 纯净水 矿泉水 牛羊";
      hot_key_more[3]="沙发 双人床 餐桌 书桌 衣架 梳妆台 写字台 吧台 茶几 橱柜 衣柜 红木 椅子 书柜 展示柜 户外";
      hot_key_more[4]="油烟机 灶具 厨具 洁具 水龙 马桶 浴缸 浴盆 淋浴 电饭煲 电磁炉 换气扇 消毒柜 豆浆机 榨汁机";
      hot_key_more[5]="热水器 洗衣机 冰箱 风扇 空调 电视 音箱 饮水机 太阳能 熨斗 按摩器 干手器 净水器 吸尘器";
      hot_key_more[6]="工艺品 礼盒 化妆品 玉石 瓷器 陶瓷 杯 饰品 挂件 画 相册 水晶 首饰 项链 手表 戒指 酒具 摆件 鲜花";
      hot_key_more[7]="窗帘 卫浴 毛巾 护肤 洗发 假发 洗涤 饰品 消毒 沐浴 香水 卫生 玩具 灯具 餐具 茶具 搬家 快递 维修";      
      hot_key_more[8]="相机 显示器 电脑 mp3 上网本 笔记本 硬盘 U盘 鼠标 键盘 手机 麦克 对讲机 功放 摄像 投影";
      hot_key_more[9]="传真机 打印机 复印机 碎纸机 文具 隔断 耗材 墨盒 硒鼓 文件柜 电脑桌 签字笔 文件夹 咖啡机";
      hot_key_more[10]="医疗 按摩 减肥 健身器 美容 护理 纹身 不孕 磁疗 颈椎 中成药 视力 眼镜 增高 活络 蒸熏 美白 护肤";
      hot_key_more[11]="仪器 仪表 机械 电动 铲车 叉车 吊车 升降机 机床 车床 刨床 发动机 发电机 制冷 冲压 平衡";
      hot_key_more[12]="阀门 泵 轴承 工具 扳手 钳子 锤子 螺丝刀 合叶 锁 丝网 护栏 铁艺  车棚 配件 管件 磨具 电焊";
      hot_key_more[13]="钢材 不锈钢 铝合金 涂料 漆 门窗 楼梯 瓷砖 地板 木材 装修 装饰 黏合剂 施工 吊顶 石材 防水";
      hot_key_more[14]="语音 报警 录音 门铃 门禁 开关 遥控 安防 监控 解码 贴片 温控 稳压 感应 光电 激光 电磁";
      hot_key_more[15]="皮鞋 女鞋 男鞋 高跟鞋 运动鞋 旅游鞋 休闲鞋 拖鞋 布鞋 棒球帽 帽子 太阳帽 高尔夫帽";
      hot_key_more[16]="求购 设备 塑料 纸 水 钢 胶 服装 配件 棉 电子 MP3 背包 首饰 饰品 灯具 美容 休闲鞋";

                  
      function showHotkey()
      {
        var tmp="";
        var i=0;
        for(i=0;i<hot_key.length;i++)
        {
            tmp+="<span style='margin-left:5px;'><a href='JavaScript:showMoreHotKey("+i+");'>"+hot_key[i]+"</a><span>";
        }
        //alert(tmp);
        tmp="<div style='margin:5px 5px 0px 5px;high:80px;'>"+tmp+"</div><div style='margin:5px 0px 0px 90px;'><a href='JavaScript:showMoreHotKey(16);' style='color:red;'>热门关键词</a><div>";
        showMsgTip ("a_index_hot_key",tmp,250,95,-3,20)
      }
      
      function showMoreHotKey(i)
      {
        var tmp="";
        isShowTip=false;
        try
        {HidMsgTip_msg();}
        catch(exception){}        
        if(hot_key[i]!=null)
        {
        tmp="<a href='/sell/search-0-"+makeKey(hot_key[i])+"-list.html' style='color:#4C4C4C;'>"+hot_key[i]+"</a> ";
        }
          var k=hot_key_more[i].split(" ");
        var i=0;
        for(i=0;i<k.length;i++)
        {
        /*if(tmp!="")
        {tmp+=" | ";}*/
            if(k[i]!="")
            {
            tmp+=" <a href='/sell/search-0-"+makeKey(k[i])+"-list.html' style='color:#4C4C4C;'>"+k[i]+"</a>"
            }
        }
        
        document.getElementById("dv_hotkey").innerHTML=tmp;
      }
      
      
      
       function showMsgTip (elId,msg,width,height,X,Y)
    {
        
       setTmpDv();
       document.getElementById(elId).onmouseout=function ev() {mousOut_msg();}
       isShowTip=true;
       var dv_con=document.getElementById("dv_msgTip_con");
       dv_con.innerHTML=msg;
       dv_con.style.width=width-4+"px";
       dv_con.style.height=height-4+"px";

       var o=getObjectPosition(elId);
       var dv_msg=document.getElementById("dv_msgTip");
       dv_msg.style.top=o.y+Y+"px";
       dv_msg.style.left=o.x+X+"px";           
       dv_msg.style.width=width+"px";
       dv_msg.style.height=height+"px";
       dv_msg.style.display="block";
       
    }  
    
    function setTmpDv()
    {
    
        if(!document.getElementById("dv_msgTip"))
        {
            var dvmsgTip = document.createElement("div");  
            dvmsgTip.style.cssText = "text-align:left;width: 350px; height: 130px; position: absolute; background-color: #EEEEEE;border: solid 1px #CCCCCC; display: none;";  
            dvmsgTip.id="dv_msgTip";
            dvmsgTip.onmousemove=function ev() {isShowTip=true;};//"JavaScript:isShowTip=true;";
            dvmsgTip.onmouseout=function ev() {HidMsgTip_msg();}
            var img=document.createElement("img");  
            img.src="/img/ic_cp_arr.gif";
            img.style.cssText="margin-left: 20px; position: absolute; margin-top: -6px;";
            dvmsgTip.appendChild(img);        

            var msgTip_con=document.createElement("div");  
            msgTip_con.style.cssText ="margin: 2px 2px 2px 2px; overflow-y: auto; width: 346px; height: 126px;background-color: White;";
            msgTip_con.id="dv_msgTip_con";        
            dvmsgTip.appendChild(msgTip_con);
            
            document.body.appendChild(dvmsgTip);
        }
    }
    
    function setHotKey()
    {
        var _key=document.getElementById("input_search_text").value;
        if(_key!="" ||_key!="请输入关键字")
        {     
            var i=0;
            for(i=0;i<hot_key.length;i++)
            {
                if(hot_key[i]==_key)
                {
                    showMoreHotKey(i);
                    return;
                }
            }
            
            for(i=0;i<hot_key_more.length;i++)
            {
            
                var k=hot_key_more[i].split(" ");                
                var ii=0;
                for(ii=0;ii<k.length;ii++)
                {            
                    if(k[ii]==_key)
                    {
                        showMoreHotKey(i);
                        return;
                    }
                }            
            }           
        }
        else
        {    showMoreHotKey_D(0);    }           
    }
   
    function mousOut_msg()
    {
        isShowTip=false;
        window.setTimeout('HidMsgTip_msg()',300);
    }

    function HidMsgTip_msg()
    {        
        if(!isShowTip)            
        {
            document.getElementById("dv_msgTip").style.display="none";
        }
    }
   
  if(typeof(runScript) != "undefined" && runScript!=null && runScript )
  {
    runScript+="setHotKey();";      
  }
  else
  {
    var runScript="setHotKey();";      
  }
  
function ShowMsg_indexTip(a,b)
{
    var dv_style=" background-color: #FFFFE6;width: 120px;height: 63px;border: 1px solid #EBD7BA; position: absolute;";
    var indexTip_msg="<div class='hui-12'><a href='JavaScript:openPage(\"/MemberCenter/ShowMessage.aspx\",600,500);'>询价留言</a>(<span class='red-12'>" +a + "</span>)条 </div><div class='hui-12'><a href='/Go2Aspx.aspx?m=/chat/&tourl=ViewMessages.aspx?colId=7' target='_blank'>求购商机</a>(<span class='red-12'>" +b + "</span>)条 </div>";
    showMsgTip ('img_index_tip',indexTip_msg,120,75,0,20,dv_style,false)
}
function openPage(url,w,h)
{
window.open (url, 'newwindow', 'height='+h+', width='+w+', top=0,left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no') 

}
        function showMoreHotKey_D(i)
      {
        var tmp="";
        isShowTip=false;
        
        if(hot_key[i]!=null)
        {
        tmp="<a style='color:#4C4C4C;' href='/sell/search-0-"+makeKey(hot_key[i])+"-list.html'>"+hot_key[i]+"</a> ";
        }
        
        
        var k=hot_key_more[i].split(" ");
        var i=0;
        for(i=0;i<k.length;i++)
        {
        /*if(tmp!="")
        {tmp+=" | ";}*/
            if(k[i]!="")
            {
            tmp+=" <a style='color:#4C4C4C;' href='/sell/search-0-"+makeKey(k[i])+"-list.html'>"+k[i]+"</a>"
            }
        }
        
        document.getElementById("dv_hotkey").innerHTML=tmp;
      }
function makeKey(strKey)
{
    var is_IE =("\v"=="v");
    if(is_IE)
    {
       return encodeURI(strKey);
    }
    else
    {
        return escape(strKey);
    }
}
