﻿ //******************初始化****************
var Speed = 0;
var Space = 5;
var PageWidth = 96;
var fill = 0;
var MoveLock = false;
var MoveTimeObj;
var Comp = 0;
var AutoPlayObj = null;

function SearchUrl()
{
    var vSearchKey = $("#txtSearchKey").val();
    if (vSearchKey == null || vSearchKey == "" || vSearchKey.replace("按关键字搜索", "") == "") 
    {
        alert("请输入查询关键字！");
    }
    else 
    {
        var vSort = document.all["hdSort"].options[document.all["hdSort"].selectedIndex].value
        var _url = "";
        switch (vSort) 
        {
            case "0":
            _url = "http://so.artnet.cn/SoAuction.aspx";
            break;
            case "1":
            _url = "http://so.artnet.cn/SoNews.aspx";
            break;
            case "2":
            _url = "http://so.artnet.cn/SoGoods.aspx";
            break;
            case "3":
            _url = "http://so.artnet.cn/SoArtist.aspx";
            break;
            default:
            _url = "http://so.artnet.cn/SoGoods.aspx";
            break;
        }

        _url += "?txt=" + escape($("#txtSearchKey").val());
        window.location.href = _url;
    }
}

function ErrorSearchUrl(num) {
    if (num == 1) {
        var vSearchKey = document.getElementById("pst_keyword").value;
        if (vSearchKey == null || vSearchKey == "" || vSearchKey.replace("请输入您要找的宝贝", "") == "") {
            alert("请输入您要找的宝贝！");
        }
        else {

            var _url = "http://so.artnet.cn/SoGoods.aspx";

            _url += "?txt=" + escape(vSearchKey);
            window.location.href = _url;
        }
    }
    else {
        var vSearchKey = document.getElementById("pst_keyword02").value; ;
      if (vSearchKey == null || vSearchKey == "" || vSearchKey.replace("请输入您要找的店铺", "") == "") {
          alert("请输入您要找的店铺！");
        }
        else {

            var _url = "http://so.artnet.cn/SoGoods.aspx";

            _url += "?shopname=" + escape(vSearchKey);
            window.location.href = _url;
        }
    }
}
function this_loadme()
{

    //期刊
    GetObj("List2").innerHTML = GetObj("List1").innerHTML;
    GetObj('ISL_Cont').scrollLeft = fill;
    GetObj("ISL_Cont").onmouseover = function(){clearInterval(AutoPlayObj);}
    GetObj("ISL_Cont").onmouseout = function(){AutoPlay();}
    AutoPlay();


    //滚动快讯
    announcementScroll();  
}

 //*************新闻 News(图片浏览)********
function GetflashCode()
{
    imgUrl1="images/flash1.jpg";
    imgtext1="11"
    imgLink1=escape("http://www.artent.com/");
    //imgLink1="";

    imgUrl2="images/flash2.jpg";
    imgtext2="22"
    imgLink2=escape("http://www.artent.com/");
    //imgLink2="";

    var focus_width=304
    var focus_height=198
    var text_height=0
    var swf_height = focus_height+text_height

    var pics=imgUrl1+"|"+imgUrl2
    var links=imgLink1+"|"+imgLink2
    var texts=imgtext1+"|"+imgtext2
    
    var flashCode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/hotdeploy/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">';
    flashCode = flashCode + '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="flash/focus.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">';
    flashCode = flashCode + '<param name="menu" value="false"><param name=wmode value="opaque">';
    flashCode = flashCode + '<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">';
    flashCode = flashCode + '<embed src="flash/focus.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ focus_width +'" height="'+ swf_height +'" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"></embed>';
    flashCode = flashCode + '</object>';
	return flashCode;
}

//****************滚动快讯**********************


//***********************国内市场|国际视角*****************
function InlandTag(modtag,modcontent,modk) {
       for(i=1; i<=2; i++) {
       if (i==modk) {
            document.getElementById(modtag+i).className="n_b_i_navon";
            document.getElementById(modcontent+i).className="n_b_i_on"; 
        }
        else 
        {
            document.getElementById(modtag+i).className="n_b_i_navoff";
            document.getElementById(modcontent+i).className="n_b_i_off";
        }
    }
}
//*************************网拍区***************
function Wpq(modtag,modcontent,modk) 
{
    for(i=1; i<=4; i++) 
    {
        if (i==modk)
        {
            document.getElementById(modtag+i).className="f_a_l_navon";
            document.getElementById(modcontent+i).className="f_a_l_on"; 
        }
        else 
        {
            document.getElementById(modtag+i).className="f_a_l_navoff";
            document.getElementById(modcontent+i).className="f_a_l_off";
        }
    }
}
//************************网上店铺 Shop*************
function Shopkind(modtag,modcontent,modk) 
{
    for(i=1; i<=13; i++) 
    {
        if (i==modk) 
        {
            document.getElementById(modtag+i).className="f_s_k_navon";
            document.getElementById(modcontent+i).className="f_s_k_on"; 
        }
        else 
        {
            document.getElementById(modtag+i).className="f_s_k_navoff";
            document.getElementById(modcontent+i).className="f_s_k_off";
        }
    }
}
//************************淘宝区|精品区*************
function TaoBao(modtag,modcontent,modk) 
{
    for(i=1; i<=2; i++) 
    {
        if (i==modk) 
        {
            document.getElementById(modtag+i).className="taobao_t_navon";
            document.getElementById(modcontent+i).className="taobao_t_on"; 
        }
        else 
        {
            document.getElementById(modtag+i).className="taobao_t_navoff";
            document.getElementById(modcontent+i).className="taobao_t_off";
        }
    }
}
//**************根据ID取所对应的对象***************
function getObj(args)
{
    return document.getElementById(args)
}
//function $(id)
//{
//   return document.getElementById(id);
//}
function GetObj(objName)
{
  if(document.getElementById)
  {
    return eval('document.getElementById("'+objName+'")')
  }
  else
  {
    return eval('document.all.'+objName)
  }
}

//****************图片滚动(开始）*******************

//自动滚动
function AutoPlay()
{ 
  clearInterval(AutoPlayObj);
  AutoPlayObj = setInterval('ISL_GoDown();ISL_StopDown();',3000000);
}
//上翻开始
function ISL_GoUp()
{ 
  if(MoveLock) return;
  clearInterval(AutoPlayObj);
  MoveLock = true;
  MoveTimeObj = setInterval('ISL_ScrUp();',Speed);
}
//上翻停止
function ISL_StopUp()
{ 
  clearInterval(MoveTimeObj);
  if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0)
  {
      Comp = fill - (GetObj('ISL_Cont').scrollLeft % PageWidth);
      CompScr();
  } 
  else
  {
    MoveLock = false;
  }
  AutoPlay();
}
//上翻动作
function ISL_ScrUp()
{ 
  if(GetObj('ISL_Cont').scrollLeft <= 0)
  {
    GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft + GetObj('List1').offsetWidth
  }
  GetObj('ISL_Cont').scrollLeft -= Space ;
}
//下翻
function ISL_GoDown()
{ 
  clearInterval(MoveTimeObj);
  if(MoveLock) return;
  clearInterval(AutoPlayObj);
  MoveLock = true;
  ISL_ScrDown();
  MoveTimeObj = setInterval('ISL_ScrDown()',Speed);
}
//下翻停止
function ISL_StopDown()
{ 
  clearInterval(MoveTimeObj);
  if(GetObj('ISL_Cont').scrollLeft % PageWidth - fill != 0 )
  {
      Comp = PageWidth - GetObj('ISL_Cont').scrollLeft % PageWidth + fill;
      CompScr();
  } 
  else 
  {
     MoveLock = false;
  }
  AutoPlay();
}
 //下翻动作
function ISL_ScrDown()
{
    if(GetObj('ISL_Cont').scrollLeft >= GetObj('List1').scrollWidth)
    {
        GetObj('ISL_Cont').scrollLeft = GetObj('ISL_Cont').scrollLeft - GetObj('List1').scrollWidth;
    }
    GetObj('ISL_Cont').scrollLeft += Space ;
}
function CompScr()
{
    var num;
    if(Comp == 0)
    {
      MoveLock = false;
      return;
    }
    if(Comp < 0)
    { 
      //上翻
      if(Comp < -Space)
      {
          Comp += Space;
          num = Space;
      } 
      else
      {
          num = -Comp;
          Comp = 0;
      }
          GetObj('ISL_Cont').scrollLeft -= num;
          setTimeout('CompScr()',Speed);
    } 
    else
    { 
      //下翻
      if(Comp > Space)
      {
          Comp -= Space;
          num = Space;
      } 
      else 
      {
          num = Comp;
          Comp = 0;
      }
      GetObj('ISL_Cont').scrollLeft += num;
      setTimeout('CompScr()',Speed);
    }
}
//****************图片滚动（结束）*******************