﻿// JScript 文件
function TXZLogin()
{
  var Username=document.getElementById("Username").value;
  //alert(Username);
  var Password=document.getElementById("Password").value;
  
  //alert(Password);
  if(Username==""){alert("请填写用户名!");return;}
  if(Password==""){alert("请填写密码!");return;}
  var v=AjaxStr.TxzLogin(Username,Password).value;
 // alert(v);
  if(v==true)
  {
    location.href="http://Login.inmachine.com/welcome.aspx";
    return;
  }
   alert("用户名或密码错误！");
}

function showMarqueeBox(id, lh, speed, delay) {
		var o = document.getElementById(id);
		var p = false;
		var t;
		o.style.overflow = "hidden";
		o.style.height =lh + "px";
		o.style.lineHeight = "21px";
		//o.style.height = o.style.lineHeight;
		o.onmouseover = function() { p = true; }
		o.onmouseout = function() {	p = false; }
		function start() {
			t = setInterval(scrolling, speed);
			if (!p) o.scrollTop++;
		}
		function scrolling() {
			if ((o.scrollTop % lh) != 0) {
				o.scrollTop++;
				if (o.scrollTop >= o.scrollHeight - lh - 1) 
				{
				o.scrollTop = 0;
				}
			} else {
				clearInterval(t);
				setTimeout(start, delay);
			}
		}
		setTimeout(start, delay);
	}


  function ChangeSearch(Id)
  {
    Getbrand(Id);
    if(Id==1)
    {

      document.getElementById("AccessoryCode").style.display="none";
      document.getElementById("Keyword").style.width="140px";
      document.getElementById("Keyword").value="";
      
    }
    else
    {

     
      document.getElementById("AccessoryCode").style.display="";
      document.getElementById("Keyword").style.width="70px";
      document.getElementById("Keyword").value="配件名称";
    }
  }
  function Getmachine(BrandId)
  {
    //alert(BrandId);
    var id
    var Id=document.getElementsByName("rtype");
    for(var i=0;i<Id.length;i++)
    {
      if(Id[i].checked==true)
      {
        id=Id[i].value;
      }
    }
   // alert(id);
    var v=AjaxStr.Getproduct(BrandId,id).value;
   // alert(v);
    if(v!=null)
    {
      var obj=document.getElementById("MachineName");
      obj.options.length=0;
       obj.options.add(new Option("选择机型",""));
      for(var i=0;i<v.Rows.length;i++)
      {
        obj.options.add(new Option(v.Rows[i].ProductName,v.Rows[i].id));
      }
    }
  }
  
  function ClearWord(obj,v)
  {
  
    if(obj.value==v)
    {
      obj.value="";
    }
  }  
  
  function Search()
  {
    var id
    var Id=document.getElementsByName("rtype");
    for(var i=0;i<Id.length;i++)
    {
      if(Id[i].checked==true)
      {
        id=Id[i].value;
      }
    }
    var brandId=document.getElementById("brandId").value;
    var MachineName=document.getElementById("MachineName").value;
    var Keyword=document.getElementById("Keyword").value;
    if(Keyword=="配件名称"){Keyword="";}
    
    var AccessoryCode=document.getElementById("AccessoryCode").value;
    if(AccessoryCode=="配件编号"){AccessoryCode="";}
    
    if(id==1)
    {
       location.href="http://mart.inmachine.com/mart/MachineSearch.aspx?keyword="+Keyword+"&brandId="+brandId+"&ProductId="+MachineName;
    }
    else
    {
      location.href="http://mart.inmachine.com/mart/AccessorySearch.aspx?keyword="+Keyword+"&brandId="+brandId+"&MachineName="+MachineName+"&AccessoryCode="+AccessoryCode;
    }
  }
  
  
       function Getbrand(Id){
         //alert(Id);
         var v=AjaxStr.Getbrand(Id).value;
         if(v!=null)
         {
          var obj=document.getElementById("brandId");
          obj.options.length=0;
          obj.options.add(new Option("选择品牌",""));
          //初始型号
          document.getElementById("MachineName").options.length=0;
          document.getElementById("MachineName").options.add(new Option("选择机型",""));
          
          for(var i=0;i<v.Rows.length;i++)
          {
            obj.options.add(new Option(v.Rows[i].brand,v.Rows[i].brandId));
          }
         }
     }
     
   function ShowIN(Id)
   {
     for(var i=1;i<4;i++)
     {
       document.getElementById("Info"+i).style.display="none";
       document.getElementById("IN_"+i).className="es_bg";
  
     }

     document.getElementById("Info"+Id).style.display="";
     document.getElementById("IN_"+Id).className="es_dt";
   }
   
   function ShowHr(Id)
   {
     for(var i=1;i<3;i++)
     {
       document.getElementById("centec"+i).style.display="none";
       document.getElementById("tr_"+i).className="es_bg";
     }
     document.getElementById("centec"+Id).style.display="";
     document.getElementById("tr_"+Id).className="es_dt";
 }

 function KFClick() {
     window.open("http://chat.53kf.com/company.php?arg=inmachinecom&style=1", null, "height=700, width=730, top=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
 }