function showview(){
  var $wareid_obj=$("wareid");
  if(typeof($wareid_obj)=="undefined"){
	return;
  }
  var $wareid=$wareid_obj.value;
  var $wareid_str=GetCookie("ware");
  var $i=0;
  var $wareid_array=new Array();
  var $new_wareid_str='';
  if($wareid_str){
	$wareid_array=$wareid_str.split(",");
  }
  for($key in $wareid_array){
    if($i<5&&$wareid_array[$key]!=$wareid){
	  $new_wareid_str+=","+$wareid_array[$key];
	  $i++;
	}
  }
  $new_wareid_str=$wareid+$new_wareid_str;
  SetCookie("ware",$new_wareid_str,365);
  ajax("POST","/html/productsearch/","wareid="+$wareid_str,"view_rightfun","view_errorfun","view_endfun");
}
function otherbrowse(){
  try{
	var $wareid_obj=$("wareid");
	if(typeof($wareid_obj)=="undefined"){
	  return;
    }
	var $wareid=$wareid_obj.value;
	ajax("POST","/html/otherbrow","wareid="+$wareid+"&action=0","obrowse_rightfun","view_errorfun","view_endfun");
  }catch(e){}
}
function otherbuy(){
  try{
	var $wareid_obj=$("wareid");
	if(typeof($wareid_obj)=="undefined"){
	  return;
    }
	var $wareid=$wareid_obj.value;
	ajax("POST","/html/otherbrow","wareid="+$wareid+"&action=1","obuy_rightfun","view_errorfun","view_endfun");
  }catch(e){}
}
function view_rightfun(){
  var $res=view_rightfun.arguments[0];
  $("recentbrowse").innerHTML=$res;
}
function view_errorfun(){}
function view_endfun(){}
var xmlHttp;
var cache=new Array();
onload=function(){
  showview();
  discount();
  var $wareid_obj=$("wareid");
  if(typeof($wareid_obj)=="undefined"){
	return;
  }
  var $wareid=$wareid_obj.value;
  xmlHttp=createXmlHttpRequestObject();
  cache.push("wareid="+$wareid+"&action=0&return_id=otherbrowse");
  cache.push("wareid="+$wareid+"&action=1&return_id=otherbuy");
  process();
  if(typeof(search_set)=="function"){
	search_set();
  }
}
function process(){
  if(xmlHttp){
	try{
	  if((xmlHttp.readyState==4 || xmlHttp.readyState==0) && cache.length>0){
		var cacheEntry=cache.shift();
		xmlHttp.open("POST","/html/otherbrow",true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlHttp.onreadystatechange=handleRequestStateChange;
		xmlHttp.send(cacheEntry);
	  }
	}catch(e){}
  }
}
function handleRequestStateChange(){
  if(xmlHttp.readyState==4){
	if(xmlHttp.status==200){
	  try{
		var responseXml=xmlHttp.responseXML;
		var xmlDoc=responseXml.documentElement;
		var return_id=xmlDoc.getElementsByTagName("return_id")[0].firstChild.data;
		$return_id=document.getElementById(return_id);
		$ul=document.createElement("ul");
		$return_id.appendChild($ul);
		var ware_array=xmlDoc.getElementsByTagName("ware");
        $i=0;
		while($i<ware_array.length){
		  $li=document.createElement("li");
		  $li.innerHTML='<a href="/html/'+ware_array[$i].getElementsByTagName("wareinfo")[0].firstChild.data+'/'+ware_array[$i].getElementsByTagName("wareid")[0].firstChild.data+'">'+ware_array[$i].getElementsByTagName("warename")[0].firstChild.data+'</a>';
		  $ul.appendChild($li);
		  $i++;
		}
	  }catch(e){}
	}
	process();
  }
}