﻿// JScript 文件
 function changePicText(flag)
 {
    var url=location.pathname;
    if(flag=="pic")
    {
         location.href=url.replace("1.aspx",".aspx")+location.search;
    }
     if(flag=="text")
    {
        location.href=url.replace("1.aspx",".aspx").replace(".aspx","1.aspx")+location.search;
    }
   
 }
 function Sortindex(sortfun)
 {
    var sort="";
    
   
     if(GetObj(sortfun).src.indexOf("images/jian1.gif")>=0)
     {
        sort=sortfun+"dw";
     }
     else
     {
        sort=sortfun+"up";
     }
  var search=location.search.toLowerCase();
  search=search.replace("&sort=timeup","").replace("&sort=timedw","");
  search=search.replace("&sort=priceup","").replace("&sort=pricedw","");
  search=search.replace("&sort=buildup","").replace("&sort=builddw","");
  location.href=location.pathname+search+"&sort="+sort;
 }
 function show(imgid)
 {
    GetObj("time").style.display="none";
    GetObj("price").style.display="none";
    GetObj("build").style.display="none";
    GetObj(imgid).style.display="";
     GetObj("atime").className="title3";
    GetObj("aprice").className="title3";
    GetObj("abuild").className="title3";
     GetObj("a"+imgid).className="title4";
 }
 function init()
 {
  var search=location.search.toLowerCase();
  
  if(search.indexOf("&sort=timeup")>=0)
  {
    GetObj("time").src="images/jian1.gif";
    show("time");
  }else
   if(search.indexOf("&sort=priceup")>=0)
  {
    GetObj("price").src="images/jian1.gif";
    show("price");
  }else
   if(search.indexOf("&sort=pricedw")>=0)
  {
    GetObj("price").src="images/jian2.gif";
    show("price");
  }else
   if(search.indexOf("&sort=buildup")>=0)
  {
    GetObj("build").src="images/jian1.gif";
    show("build");
  }else
   if(search.indexOf("&sort=builddw")>=0)
  {
    GetObj("build").src="images/jian2.gif";
    show("build");
  }else
  {
     GetObj("time").src="images/jian2.gif";
     show("time");
  }
 
 }
 init();
