﻿// JScript 文件
var ajaxObjects = new Array();
var oldobj=null,oldobj2=null,oldobj3=null;
// Use something like this if you want to save data by Ajax.
function showList(obj){     
   window.location='/part/category-'+obj.id.replace(/[^0-9]/gi,'')+'.html';
}

function frameStyleResize(targObj){

    var targWin = targObj.parent.document.all[targObj.name];
    if(targWin != null) {
    var HeightValue = targObj.document.body.scrollHeight;
    if(HeightValue <650){HeightValue =650} 

    targWin.style.pixelHeight = HeightValue;
}
}

function sendMail(obj)
{
    showModelessDialog('/email_to.aspx',window,'dialogWidth:614px;dialogHeight:540px;dialogLeft:200px;dialogTop:160px;center:yes;help:no;resizable:no;status:no');
}

function iframeResize(){    
    frameStyleResize(self);
}

function refresh()  {
    var tid='aTag';
    if(window.location.pathname.split("/")[2])
    {
        if(window.location.pathname.split("/")[2].split("-")[1])
        {
            if(window.location.pathname.split("/")[2].split("-")[0]=="list")
                tid='menu'+window.location.pathname.split("/")[2].split("-")[1].split(".")[0];
            else if(window.location.pathname.split("/")[2].split("-")[0]=="category")
            {
                if(document.getElementById('ctl00_ContentPlaceHolder1_lbLink2').href)
                    tid='aTag'+document.getElementById('ctl00_ContentPlaceHolder1_lbLink2').href.split("-")[1].split(".")[0]; 
                else
                    tid='aTag'+window.location.pathname.split("/")[2].split("-")[1].split(".")[0]; 
            }  
            else
               tid='aTag'+document.getElementById('ctl00_ContentPlaceHolder1_lbLink2').href.split("-")[1].split(".")[0];      
        }
    }
    
    var tab=document.getElementById(tid);
    if(tab)
    {
        if(window.location.pathname.split("/")[2].split("-")[0]=="list")
            tab.style.display="block";
        else
        {
            tab.parentNode.parentNode.parentNode.style.display="block";
            tab.parentNode.parentNode.className="list1";
        }
    }
}


function yan(yy)
{
  var tab1
  var tid;
  tid="aTag"+yy;
   tab1=document.getElementById(tid);
    if(tab1)
    {
                tab1.onmouseover=null;
                tab1.onmouseout=null;
                tab1.childNodes[0].style.backgroundColor='#6fabab';
                tab1.childNodes[1].style.backgroundColor='#6fabab';
                tab1.childNodes[1].style.color='#ffffff';
  }
}



function showHideNode(obj)
{
    var i,j,n,otherNode;
    var node=obj.parentNode.nextSibling;
    if(node){
        if(node.style.display=='block'){
            node.style.display='none';
        }
        else{
            node.style.display='block';
        }
    }
    
    i=(obj.parentNode.parentNode.childNodes.length-2)/2;
    
    for(j=1;j<=i;j++)
    {
        otherNode=document.getElementById('menu'+j);
        if (otherNode!=node){
            otherNode.style.display='none';
        }
    }  
}

function showSHideNode(obj)
{
    var i;
    var node=obj.nextSibling;
    
    if(node){
        if(node.style.display=='block'){
            node.style.display='none';
            obj.firstChild.style.backgroundColor='#DCE0EC'; 
            obj.firstChild.firstChild.style.color='#4e4e4e';   
            obj.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.src='/images/menu_ice_13_bg_2.gif';      
        }
        else{
            node.style.display='block';
            obj.firstChild.style.backgroundColor='#667CA3';
            obj.firstChild.firstChild.style.color='#ffffff'; 
            obj.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.src='/images/menu_ice_13_bg_21.gif'; 
        }
    }
      
    for(i=1;i<=node.parentNode.childNodes.length-1;i++)
    {
        if(node.parentNode.childNodes[i]!=node)
        {
            node.parentNode.childNodes[i].style.display='none';
            node.parentNode.childNodes[i-1].firstChild.style.backgroundColor='#DCE0EC'; 
            node.parentNode.childNodes[i-1].firstChild.firstChild.style.color='#4e4e4e';
            node.parentNode.childNodes[i-1].firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.src='/images/menu_ice_13_bg_2.gif';
        }
        i++;
    }     
}
function showSHideNode1(obj)
{
    var str=window.location.pathname;
    var tab1=str.split("/");
    var tab2=tab1[tab1.length-1].split(".");
    var tid1=tab2[0].split("-");
    var tid=tid1[0]+"-"+tid1[1];
    var i;
//    var node=obj.nextSibling;
//    if(node.childNodes[0]==null)
//    {
    window.location=tid+'-'+obj.id.replace(/[^0-9]/gi,'')+'.html';
//    }
//    else
//    {
//    if(node){
//        if(node.style.display=='block'){
//            node.style.display='none';
//        }
//        else{
//           node.style.display='block';
//        }
//    }
//    }
}

function loadSupplierCategory(supplierID)
{
	var ajaxIndex = ajaxObjects.length;
	ajaxObjects[ajaxIndex] = new sack();
	var url = '/CategoryManager.aspx?method=loadTreeForSupplier&supplierID='+supplierID;
	ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	ajaxObjects[ajaxIndex].onCompletion = function() {loadSupplierCategoryComplete(ajaxIndex)  } ;	// Specify function that will be executed after file has been found
	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function
}

function loadSupplierCategoryComplete(index)
{
    document.getElementById("supplierCategory").innerHTML=ajaxObjects[index].response;
}

function loadFSupplierCategory(supplierID)
{
	var ajaxIndex = ajaxObjects.length;
	ajaxObjects[ajaxIndex] = new sack();
	var url = '/CategoryManager.aspx?method=loadTreeForfSupplier&supplierID='+supplierID;
	ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	ajaxObjects[ajaxIndex].onCompletion = function() {loadFSupplierCategoryComplete(ajaxIndex)  } ;	// Specify function that will be executed after file has been found
	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function
    //yan(rev);
}

function loadFSupplierCategoryComplete(index)
{
   //document.getElementById("fsupplierCategory").innerHTML=ajaxObjects[index].response;
}

function AddFavorite()
{
   sURL=document.URL;
   sTitle=document.title;
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，有劳您手动添加。");
        }
    }
}
function MostrarTooltip() 
{ 			
    var obj = document.getElementById('ctl00_ContentPlaceHolder1_Model3DList'); 
    document.getElementById("ctl00_ContentPlaceHolder1_lbltooltip").innerHTML = obj.options[obj.selectedIndex].text;
	
    if(obj.options[obj.selectedIndex].text !="") 
    {
        document.getElementById("tooltip").style.position = "absolute";
        document.getElementById("tooltip").style.display = "block"; 
        document.getElementById("tooltip").style.border =  "ActiveBorder 0px solid";
        document.getElementById("tooltip").style.padding =   "0px";
        document.getElementById("tooltip").style.fontSize =  "12px"; 
        document.getElementById("tooltip").style.fontFamily = "Arial,宋体"; 
        document.getElementById("tooltip").style.backgroundColor = "white"; 
        var offsetY=document.documentElement.scrollTop;
        var offsetX=document.documentElement.scrollLeft;
        if(window.scrollY)
        {
            offsetY=window.scrollY;
            offsetX=window.scrollX;
        }
        document.getElementById("tooltip").style.top = offsetY + event.clientY; 
        document.getElementById("tooltip").style.left =	offsetX + 15 + event.clientX;	    
    }  
} 
function OcultarTooltip()
{ 
  document.getElementById("tooltip").style.display = "none"; 
}

function refresh1()  {
   
    var str=window.location.pathname;
    var tab1=str.split("/");
    var tab2=tab1[tab1.length-1].split(".");
    var tid1=tab2[0];
    var tid;
    if(tid1.indexOf("-")==-1)
    {
      tid=tid1;
    }
    else
    {
      var tab3=tid1.split("-");
      var tid2=tab3[0];
      if(tid2=="faq_more" || tid2=="guest_book")
      {
        tid=tab3[0]+"-"+tab3[1];
      }
      else if(tid2=="post")
      {
        tid="guest_book"+"-"+tab3[1];
      }
      else
      {
        tid=tid2;
      }
    }
    
    if(tid=="message")
    {
      tid="message_list";
    }
    
   if(tid=="guest_book-0")
      {
        tid="guest_book";
      }
    
    if(tid=="HelpCenter_bbs_edit")
    {
      tid="guest_book";
    }
    if(tid=="profile1")
    {
      tid="profile";
    }
    
    var tab=document.getElementById(tid);
    if(tid=="faq" || tid=="guest_book")
    {
      tab.firstChild.firstChild.style.color='white';  
    }
    else
    {
    if(tab)
    {
        tab.onmouseover=null;
        tab.onmouseout=null;
        //tab.parentNode.parentNode.parentNode.parentNode.style.display='block';
        tab.style.backgroundImage='url(new_downloadbg.jpg)';
        tab.childNodes[1].firstChild.style.color='black';
        tab.childNodes[2].firstChild.src="/images/index-dir-ar2.jpg";
       //tab.parentNode.parentNode.parentNode.parentNode.previousSibling.firstChild.firstChild.style.color='white';
    }  
    else
    {
        if(document.getElementById('ctl00_ContentPlaceHolder1_lbLink2'))
        {
            var param=document.getElementById('ctl00_ContentPlaceHolder1_lbLink2').href.split("-")[1];
            if(param)
            {
                tid='aTag'+param.split(".")[0];
            }
            else
            {
                tid='aTag11';
            }
            tab=document.getElementById(tid);
            if(tab)
            {
                tab.onmouseover=null;
                tab.onmouseout=null;
                //tab.parentNode.parentNode.parentNode.parentNode.style.display='block';
                tab.style.backgroundImage='url(new_downloadbg.jpg)';
                tab.childNodes[1].firstChild.style.color='black';
                tab.childNodes[2].firstChild.src="/images/index-dir-ar2.jpg";
               //tab.parentNode.parentNode.parentNode.parentNode.previousSibling.firstChild.firstChild.style.color='white';
            } 
        }  
    }
    }
    
}

function moveTab(obj)
{
    obj.style.backgroundImage='url(new_downloadbg.jpg)';
    obj.childNodes[2].firstChild.src="/images/index-dir-ar2.jpg";
}

function outTab(obj)
{
    obj.style.backgroundImage='url(/images/index-dir-bg2.jpg)';
   obj.childNodes[2].firstChild.src="/images/index-dir-ar1.jpg";
}

function moveTabMain(obj)
{
    obj.firstChild.childNodes[1].style.color='#2970a6';
}

function outTabMain(obj)
{
    obj.firstChild.childNodes[1].style.color='#666666';
}

function moveTab1(obj)
{
    obj.childNodes[1].firstChild.style.color='#BA0303';
    obj.childNodes[1].firstChild.style.textDecorationUnderline=true;
    obj.childNodes[1].lastChild.src ="/images/my_ice_1.gif";
}

function outTab1(obj)
{
    obj.childNodes[1].firstChild.style.color='#2970a6';
    obj.childNodes[1].firstChild.style.textDecorationUnderline=true;
    obj.childNodes[1].lastChild.src="/images/main_ice_go2.gif";
}

function moveTab2(obj)
{
    obj.childNodes[1].firstChild.src="/images/ice_goto.gif";
}

function outTab2(obj)
{
obj.childNodes[1].firstChild.src="/images/ice_goto2.gif";
}


function moveTab3(obj)
{
    obj.childNodes[2].firstChild.src ="/images/main_ice_go.gif";
}

function outTab3(obj)
{
    obj.childNodes[2].firstChild.src="/images/main_ice_go2.gif";
}

function moveTab4(obj)
{
    obj.childNodes[0].firstChild.src ="/images/help_ice_jc1.jpg";
}

function outTab4(obj)
{
    obj.childNodes[0].firstChild.src="/images/help_ice_jc.gif";
}


function moveTab5(obj)
{
    obj.childNodes[0].firstChild.src="/images/ice_goto.gif";
}

function outTab5(obj)
{
    obj.childNodes[0].firstChild.src="/images/ice_goto2.gif";
}



function moveTab6(obj)
{
    obj.childNodes[1].firstChild.src ="/images/download_ice_j2.gif";
}

function outTab6(obj)
{
    obj.childNodes[1].firstChild.src="/images/download_ice_j.gif";
}

function moveTab7(obj)
{
    obj.childNodes[0].firstChild.style.color='#2970a6';
    obj.childNodes[1].firstChild.style.color='#2970a6';
}

function outTab7(obj)
{
    obj.childNodes[0].firstChild.style.color='#545454';
    obj.childNodes[1].firstChild.style.color='#545454';
}

function moveTab8(obj)
{
    if(obj.nextSibling.style.display=='none')
        obj.firstChild.style.backgroundColor='#C2C9DD';
}

function outTab8(obj)
{
    if(obj.nextSibling.style.display=='none')
        obj.firstChild.style.backgroundColor='#DCE0EC';
}

function moveTab9(obj)
{
    if(obj.nextSibling.style.display=='none')
        obj.style.backgroundImage='url(/images/bj_titile_top_3.gif)';
}

function outTab9(obj)
{
    if(obj.nextSibling.style.display=='none')
        obj.style.backgroundImage='url(/images/bj_titile_top_2.gif)';
}


function showList1(obj){ 
    var objid=obj.id;
    if(objid=="faq" || objid=="faq_more-33" || objid=="faq_more-34" || objid=="faq_more-35" || objid=="faq_more-36")
      objid="/help/"+objid;
    if(objid=="contact_1" || objid=="contact" || objid=="guest_book" || objid=="guest_book-1" || objid=="guest_book-2" || objid=="guest_book-3" || objid=="guest_book-4")
      objid="/"+objid;          
    window.location=objid+'.html';
}

function recordresult()
{
    for(var i=0;i<document.getElementById('ctl00_ContentPlaceHolder1_dlstSurvey').rows.length;i++)
    {
        var pname="ctl00_ContentPlaceHolder1_dlstSurvey_ctl0"+i+"_rblAnswer";
        for(var j=0;j<document.getElementById(pname).rows.length;j++)
        {
            var name=pname+"_"+j;
            if(document.getElementById(name).checked==true)
            {
                document.cookie="answer"+i+"="+j;
            }
        }
    }
}

function restoreresult()
{
    for(var i=0;i<document.getElementById('ctl00_ContentPlaceHolder1_dlstSurvey').rows.length;i++)
    {
        var pname="ctl00_ContentPlaceHolder1_dlstSurvey_ctl0"+i+"_rblAnswer";
        var arr = document.cookie.match(new RegExp("(^| )answer"+i+"=([^;]*)(;|$)"));
       
        if(arr != null)
        {
            var name=pname+"_"+unescape(arr[2]);            
            document.getElementById(name).checked=true;
        }
    }
}

function moveyanfm(obj,level)
{
   if(level==0)
   {
    obj.childNodes[0].style.backgroundColor='#b4d0d1';
    obj.childNodes[1].style.backgroundColor='#b4d0d1';
   }
   else
   {
    obj.childNodes[1].style.color='#2970a6';
   }
}

function outyanfm(obj,level)
{
    if(level==0)
    {
     obj.childNodes[0].style.backgroundColor='#d0e4e2';
    obj.childNodes[1].style.backgroundColor='#d0e4e2';
    }
    else
    {
    obj.childNodes[1].style.color='#666666';
    }
}
function setCookie()
{
    document.cookie = "website=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtWebSite").value);
    document.cookie = "url=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtUrl").value);
    document.cookie = "myurl=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtMyUrl").value);
    document.cookie = "intro=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtIntro").value);
    document.cookie = "LOGO=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtLOGO").value);
    document.cookie = "Contactor=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtContactor").value);
    document.cookie = "phone=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtPhone").value);
    document.cookie = "email=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtEMail").value);
    document.cookie = "other=" + escape(document.getElementById("ctl00_ContentPlaceHolder1_txtOther").value);
    if(document.getElementById("ctl00_ContentPlaceHolder1_RequiredFieldValidator1").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_RequiredFieldValidator2").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_RequiredFieldValidator3").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvWebSite").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvUrl").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvMyUrl").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvIntro").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvLOGO").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvContactor").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvPhone").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvEMail").style.display=="none"
    &&document.getElementById("ctl00_ContentPlaceHolder1_cvOther").style.display=="none")
    {
        document.getElementById("ctl00_ContentPlaceHolder1_btnSubmit").style.visibility="hidden";
        document.getElementById("ctl00_ContentPlaceHolder1_btnReset").style.visibility="hidden";
    }
}
function clearCookie()
{
    var exp = new Date();    
    exp.setTime (exp.getTime() - 1);       
    document.cookie = "website=null; expires=" + exp.toGMTString();  

    document.getElementById("ctl00_ContentPlaceHolder1_txtUrl").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtMyUrl").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtIntro").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtLOGO").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtContactor").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtPhone").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtEMail").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtOther").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtWebSite").value="";
}

function loadSpaceCategory(spaceID)
{
	var ajaxIndex = ajaxObjects.length;
	ajaxObjects[ajaxIndex] = new sack();
	var url = '/CategoryManager.aspx?method=loadTreeForSpace&spaceID='+spaceID;
	ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	ajaxObjects[ajaxIndex].onCompletion = function() {loadSpaceCategoryComplete(ajaxIndex)  } ;	// Specify function that will be executed after file has been found
	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function
}

function loadSpaceCategoryComplete(index)
{
    document.getElementById("spaceCategory").innerHTML=ajaxObjects[index].response;
}

function ShowFLT(obj)
{
    if (obj.parentNode.nextSibling.style.display == 'none') {
        obj.parentNode.nextSibling.style.display = 'block';
    }
    else {
        obj.parentNode.nextSibling.style.display = 'none';
    }
}

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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.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 t(id1,id2,id3)
    {
      var speed=60
      var td1 = document.getElementById(id1);
      var td2 = document.getElementById(id2);
      var tblSindyUC = document.getElementById(id3);
      td2.innerHTML=td1.innerHTML
      function Marquee(){
        if(td2.offsetWidth-tblSindyUC.scrollLeft<=0){
          tblSindyUC.scrollLeft-=td1.offsetWidth;
        }
        else{ 
          tblSindyUC.scrollLeft++;
        }
      }
      var MyMar=setInterval(Marquee,speed)
      tblSindyUC.onmouseover=function() {clearInterval(MyMar)}
      tblSindyUC.onmouseout=function() {MyMar=setInterval(Marquee,speed)}     
	}

