﻿// Trim
String.prototype.Trim = function() 
{ 
    return this.replace(/(^\s*)|(\s*$)/g, ""); 
} 
//Check Head Search Key
function CheckTbkey(source)
{
     var tbKey = document.getElementById(source);
     if(tbKey.value.Trim().length == 0)
     {
        alert("请输入要查询的关键字");
        tbKey.focus();
        return false;
     }
     else
     {
        return true;
     }
}
//ClickHelpsBar
function ChangeBuyer(tag)
{
    var LiBuyer =  document.getElementById("LiBuyer");
    var LiSeller = document.getElementById("LiSeller");
    var UlBuyer =document.getElementById("UlBuyer");
    var UlSeller = document.getElementById("UlSeller");
    var ASeller = document.getElementById("ASeller");
    var ABuyer = document.getElementById("ABuyer");
    if(tag == "0")
    {
        UlBuyer.className = "ul_first_new"
        UlSeller.className = "Hidd";
        LiBuyer.className =  "but_f_bg01";
        LiSeller.className = "but_f_bg";
        ABuyer.className = "a_but_f01";
        ASeller.className = "a_but_f";
    }
    else
    {
         UlSeller.className = "ul_first_new"
         UlBuyer.className = "Hidd"
         LiBuyer.className =  "but_f_bg";
         LiSeller.className = "but_f_bg01";
         ASeller.className = "a_but_f01";
         ABuyer.className = "a_but_f";
    }
}

//ImgZoom    
function DrawImage(ImgD,w,h)
{
    var flag = false;
    var MyImage = new Image();
    MyImage.src = ImgD.src;

    if(MyImage.readyState != "complete")
    {
        return false; 
    }
   
    if(MyImage.width > 0 && MyImage.height > 0)
    {  
        flag = true;
        if(MyImage.width / MyImage.height >= w / h)
        {
            if(MyImage.width > w)
            {
                ImgD.width = w;
                ImgD.height = (MyImage.height * w) / MyImage.width;
            }
            else
            {
                ImgD.width = MyImage.width;
                ImgD.height = MyImage.height;
            }
 
        }
        else
        {
            if(MyImage.height > h)
            {
                ImgD.height = h;
                ImgD.width = (MyImage.width * h) / MyImage.height;
            }
            else
            {
                ImgD.width = MyImage.width;
                ImgD.height = MyImage.height;
            }
 
        }
    }
}


function ChangeLookTop(tag)
{
    var DivLooktop01 = document.getElementById("DivLooktop01");
    var DivLooktop  = document.getElementById("DivLooktop");
    var LonkPros01 = document.getElementById("LonkPros01");
    var LonkPros = document.getElementById("LonkPros");
    
    if(tag == 1)
    {
    
        DivLooktop.innerHTML =  DivLooktop.innerHTML;
        DivLooktop.className ="cent_third_r_03";
        DivLooktop01.className ="Hidd";
        LonkPros.src = "NewImgs/n_01.gif";
        LonkPros01.src = "NewImgs/n_02_1.gif";
    }
    else
    {
       DivLooktop.className ="Hidd";
       DivLooktop01.innerHTML =  DivLooktop01.innerHTML;
       DivLooktop01.className ="cent_third_r_03";
       LonkPros.src = "NewImgs/n_01_1.gif";
       LonkPros01.src = "NewImgs/n_02.gif";

    }
}
function ChangeTejia(tag1)
{
    var Tejia1 = document.getElementById("Tejia1");
    var tejiaSource = document.getElementById("tejiaSource");
    var tejiaImg01 = document.getElementById("tejiaImg01");
    var tejiaImg = document.getElementById("tejiaImg");
  
    if(tag1 == 1)
    {
        tejiaSource.innerHTML = tejiaSource.innerHTML;
        tejiaSource.className ="cent_third_r_03";
        Tejia1.className ="Hidd";
        tejiaImg.src = "NewImgs/n_01.gif";
        tejiaImg01.src = "NewImgs/n_02_1.gif";
    }
    else
    {  
       tejiaSource.className ="Hidd";
       Tejia1.innerHTML = Tejia1.innerHTML;
       Tejia1.className = "cent_third_r_03";
       tejiaImg.src = "NewImgs/n_01_1.gif";
       tejiaImg01.src = "NewImgs/n_02.gif";
    }
}

function ChangeSelectBar(sourceBar)
 {
    var SeleectBar1 = document.getElementById("SeleectBar1");
    var SeleectBar2 = document.getElementById("SeleectBar2");
    var SeleectBar3 = document.getElementById("SeleectBar3");
    var SeleectBar4 = document.getElementById("SeleectBar4");
    var left001 = document.getElementById("left001");
    var left002 = document.getElementById("left002");
    var right001 = document.getElementById("right001");
    var right002 = document.getElementById("right002");
    switch(sourceBar.id)
    {
        case "SeleectBar1":
            SeleectBar1.className = "HeightSelected";
            SeleectBar2.className = "NoSelected";
            left001.className =  "Show";
            left002.className =  "Hidd";
            StopLeft();
        break;
        
        case "SeleectBar2":
            SeleectBar1.className = "NoSelected";
            SeleectBar2.className = "HeightSelected";
            left001.className =  "Hidd";
            left002.className =  "Show";
           StopLeft();
        break;
        
        case "SeleectBar3":
            SeleectBar3.className = "HeightSelected";
            SeleectBar4.className = "NoSelected";
            right001.className =  "Show";
            right002.className =  "Hidd";
            StopRight();
     
        break;
        
        case "SeleectBar4":
            SeleectBar3.className = "NoSelected";
            SeleectBar4.className = "HeightSelected";
            right001.className =  "Hidd";
            right002.className =  "Show";
            StopRight();
        break;
    }
 }
 
 
 //left
 function Refreshleft()
{
    var left001 = document.getElementById("left001");
    var left002 = document.getElementById("left002"); 
    var SeleectBar1 = document.getElementById("SeleectBar1");
    var SeleectBar2 = document.getElementById("SeleectBar2"); 
    if(left001.className == "Show")
    {
        left001.className = "Hidd";
        SeleectBar1.className = "NoSelected";
        left002.className = "Show";
        SeleectBar2.className = "HeightSelected";
    }
    else
    {
        left001.className = "Show";
        SeleectBar1.className = "HeightSelected";
        left002.className = "Hidd";
        SeleectBar2.className = "NoSelected";
    }
}
var MyIntervalLeft=setInterval("Refreshleft()",7000);


function onMouseOutLeft()
{
   MyIntervalLeft=setInterval("Refreshleft()",7000);
}

function StopLeft()
{  
    clearInterval(MyIntervalLeft);
}


//Right
 function RefreshRight()
{
    var right001 = document.getElementById("right001");
    var right002 = document.getElementById("right002"); 
    var SeleectBar3 = document.getElementById("SeleectBar3");
    var SeleectBar4 = document.getElementById("SeleectBar4"); 
    if(right001.className == "Show")
    {
        right001.className = "Hidd";
        SeleectBar3.className = "NoSelected";
        right002.className = "Show";
        SeleectBar4.className = "HeightSelected";
    }
    else
    {
        right001.className = "Show";
        SeleectBar3.className = "HeightSelected";
        right002.className = "Hidd";
        SeleectBar4.className = "NoSelected";
    }
}

var MyIntervalRight=setInterval("RefreshRight()",7000);
function onMouseOutRight()
{
   MyIntervalRight=setInterval("RefreshRight()",7000);
}
function StopRight()
{  
   clearInterval(MyIntervalRight);
}


