function getRandom(){return Math.round(Math.random()*2147483647);}
function _rp(s){_n=s.replace(/\?$/,"").replace(/\?/,"[i]").replace(/\=/,"[m]");return _n;}
function cKr(){
  var c="i",_d=document,a=c+"n.as",r=_d.referrer,d="urch"+a,_r=Math.random(),u=_d.location.href,__u=_rp(u),b=d+"px",__r=_rp(r);
    var par={randomer : Math.random(),act : c,r : __r,u : __u}
    $.post(b,par,function(){});
}
function toReset(){if(!confirm("确定重置吗?")){return false;}}
function getVerifyCode()
{
  var i = getRandom();
  $("#verifyCode").attr("src", "images/loading.gif");
  $.get("verify_code.aspx?" + i);
  $("#verifyCode").attr("src", "verify_code.aspx?" + i );
}
function MenuToggle(e)
{
   aTags = new Array('ul','div');
   oTargetArray = new Array();
   oParent = e.parentNode ;
     for(i = 0 ; i < aTags.length; i++) 
	 {
	    oTargetArray.push(oParent.getElementsByTagName(aTags[i]));
	}
   for (i = 0 ; i < oTargetArray.length;i++)
   {
     oTarget = oTargetArray[i];
     // alert(oTarget[0].tagName);
    if(typeof oTarget[0] != 'undefined')
   {
  if(oTarget[0].style.display != 'block'  ){
   oTarget[0].style.display = 'block';
	 oTarget[0].parentNode.className = "list";
	 }
   else{
   oTarget[0].style.display = 'none';
	 oTarget[0].parentNode.className = "";
   return false;}
   }
}  
return true;
}
function menuClick( obj )
{
  obj.nextSibling.style.display = ( obj.nextSibling.style.display == "none" ) ? "" : "none";
}
function preview( obj )
{
  auto = false;
  $( "#imgbox" ).fadeOut( "fast" );
  $( "#imgbox" ).attr( "src", obj.childNodes[0].src );
  $( "#imgbox" ).fadeIn( "normal" );
}
function autoPreview()
{
  if ( auto ) {
    $("#imgbox").fadeOut( "fast" );
    $("#imgbox").attr( "src", "../userfiles/product/" + filename[i] );
    $("#imgbox").fadeIn( "normal" );
    i ++;
    if ( i == filename.length ) i = 0;
  }
}
function getCapability()
{
  document.getElementById( "li_capability" ).className = "select";
  document.getElementById( "li_specification" ).className = "";
  document.getElementById( "li_download" ).className = "";
  document.getElementById( "capability" ).style.display = "";  
  document.getElementById( "specification" ).style.display = "none";
  document.getElementById( "download" ).style.display = "none";
}
function getSpecification()
{
  document.getElementById( "li_capability" ).className = "";
  document.getElementById( "li_specification" ).className = "select";
  document.getElementById( "li_download" ).className = "";
  document.getElementById( "capability" ).style.display = "none";  
  document.getElementById( "specification" ).style.display = "";
  document.getElementById( "download" ).style.display = "none";
}
function getDownload()
{
  document.getElementById( "li_capability" ).className = "";
  document.getElementById( "li_specification" ).className = "";
  document.getElementById( "li_download" ).className = "select";
  document.getElementById( "capability" ).style.display = "none";  
  document.getElementById( "specification" ).style.display = "none";
  document.getElementById( "download" ).style.display = "";
}
function searchProduct( obj )
{
  var e = obj.previousSibling;
  if ( e.value.length == 0 ) 
    alert( "请输入关键字" );
  else
    location.href = "search.aspx?query=" + e.value;
}
function loadNotice()
{
  $.get( "act.aspx?act=notice", function( data ){
    $( "div.maintop" ).prepend( data );
  });
  window.setInterval( changeNotice, 5000 );
}
function changeNotice()
{
  $( "#notice" ).slideToggle("fast", function(){
    $( "#notice li" ).attr( "style", "display:none" );
    var len = $( "#notice li" ).size();
    if ( i >= len - 1 ) { i = 0; }else { i ++; }
    $( "#notice li" ).eq(i).attr( "style", "" );
    $( "#notice" ).slideToggle("slow");
  });
}



/* navb */

function menuFix() {
  var sfEls = document.getElementById("navb").getElementsByTagName("li");
  for(var i=0;i<sfEls.length;i++) {
		var ulss=sfEls[i].getElementsByTagName("ul");	
		if(ulss.length>0) {
		sfEls[i].className="hadChild";
		}
	}
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover=function() {
      this.className+=(this.className.length>0? " ": "") + "show";
    }
    sfEls[i].onmouseout=function() {
      this.className=this.className.replace(new RegExp("( ?|^)show\\b"), "");
    }
  }
}
window.onload=menuFix;

function loadProduct( obj, cid )
{
  $( "#pleaseselect" ).html( obj.innerHTML );
  $( "#productshow" ).load( "act.aspx?act=product_list&cid=" + cid );
  $( "#productlistb" ).attr( "style", "" );
  $( "#productlist" ).attr( "style", "display:none" );  
}