// JavaScript Document
function GetMiniShoppingCar2(id) {
	if(!document.getElementById('youm'))return false;
    if (document.getElementById('youm').innerHTML=="false") {
       // GetJsonForShoppingCar();
	   ajax("shoppingCarNone",id)
	}
	   else if(id!="" && id!=0)
	   {
	     ajax("shoppingCarNone",id)
	   }
}
function ajax(iid,goodid)
 {
	 //alert("ok")
 var xmlHttp;
 //sword=trimspace(document.yy.sword.value);
 idx=document.getElementById(iid);
 //alert(sword);
 try
    {
   // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

  // Internet Explorer
   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("您的浏览器不支持AJAX！");
         return false;
         }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4&&xmlHttp.status==200)
        {
		//document.getElementById("str").style.display="block";
		idx.innerHTML=xmlHttp.responseText;
		 //clearTimeout(clearToss);
		 //alert(xmlHttp.responseText);
      }
	  else
	  {
		document.getElementById("loadxx").innerHTML="<img src='/images/load.gif'>";  
	  }
	  }
	  
    xmlHttp.open("GET","/cart_s.php?id="+escape(goodid),true);
	//var clearToss=setTimeout(function(){xmlHttp.abort();},60000);
 xmlHttp.send(null);
 }
 function setContentTab(name, curr, n) {
    for (i = 1; i <= n; i++) {
        var menu = document.getElementById(name + i);
        var cont = document.getElementById("con_" + name + "_" + i);
        menu.className = i == curr ? "hover" : "";
        if (i == curr) {
            cont.style.display = "block";
            //lazyloadForPart($(cont));
        } else {
            cont.style.display = "none";
        }
    }
}
function showDropMenu(Obj) {
    Obj.className = "hover";
}
function hideDropMenu(Obj) {
    Obj.className = "active";
}
function OnEnter(field) {
    if (field.value == field.defaultValue) {
        field.value = "";
    }
}
function OnExit(field) {
    if (trimspace(field.value) == "") {
        field.value = field.defaultValue;
    }
}
function OnKeyUp(event, field) {
    if (event.keyCode == 13) {
        window.setTimeout(function () {
            Search(field);
        }, 500);
    }
}
function trimspace(str)//去除首尾空格函数
{
   while(str.substring(0,1)==" ")
   {
    str=str.substring(1);
   }
   while(str.substring(str.length-1)==" ")
   {
    str=str.substring(0,str.length-1);
   }
   return str;
}
function Search(field) {
    var value = '';
	if(!document.getElementById('skey'))return false;
        value = document.getElementById('skey').value;
    if (typeof (value) == 'undefined' || (value == '请输入关键词') || (trimspace(value)== '请输入关键词')) {
        value = '';
    }
    var sid = getCookie('sid');
    if (typeof (sid) == 'undefined') {
        sid = '';
    }
           window.location.href = '/type.php?search=' +value;
 
}
function getCookie(name) {
  var cookieValue = "";
  var search = name + "=";
	if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
		if (offset != -1) {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
function hotKindsShowBg(BG) {
    BG.className = "hotKindsBg";
}
function hotKindsHideBg(BG) {
    BG.className = "";
}
