   	/**
   	 * 定义新的ajax调用类
   	 */
   	
   	
   	/*
 	 * 出价记录Ajax,开始
 	 * var prdid 
 	 * var bidurl 
 	 * var prdnum	
 	 * */
function _$(p) {
	return document.getElementById(p);
}
    var bidpage = 1;
    var bidpagesize = 5;    
    //页面载入时读取Ajax
    function bidStart(){
    	if(ifbid!=null&&ifbid!=0){
    		var ajax = new Ajaxer();
	   	 	var bidpage = 1;
			var pars = 'prdId='+ prdid + '&pageSize='+ bidpagesize + '&currPage='+ bidpage + '&ifbid=' + ifbid + '&timestamp=' + new Date().getTime();
			var timestamp = new Date().getTime();
			ajax.get(
	   			bidurl,
	   			{prdId:prdid, pageSize:bidpagesize, currPage:bidpage, ifbid:ifbid, timestamp:timestamp},
	   			function(xml) {listBid(xml);},
	   			"xml"
	   		);
	   		if(_$('check_allbid')){_$('check_allbid').style.display="inline";} 
	   		if(_$('check_partbid')){_$('check_partbid').style.display="none";}
	   		if(_$('bidtotal')){_$('bidtotal').style.display="none";}
	   		if(_$('show_bid_all')){_$('show_bid_all').style.display="inline"; }
    	}
   	}
   	//全部显示   	
   	function bidViewAll(){
   		var ajax4 = new Ajaxer();
		if(ifbid!=null&&ifbid!=0){
	   		checkBidList();
			var timestamp = new Date().getTime();
			ajax4.get(
	   			bidurl,
	   			{prdId:prdid, pageSize:999999, currPage:1, ifbid:ifbid, timestamp:timestamp},
	   			function(xml){listBid(xml);},
	   			"xml"
	   		);
	   		if(_$('check_allbid')){_$('check_allbid').style.display="none"; }
	   		if(_$('check_partbid')){_$('check_partbid').style.display="inline";}
	   		if(_$('bidtotal')){_$('bidtotal').style.display="inline";}
	   		if(_$('show_bid_all')){_$('show_bid_all').style.display="none"; }
   		}
   	}
   	//返回显示
   	function bidBack(){
   		if(ifbid!=null&&ifbid!=0){
   			var ajax = new Ajaxer();
	   		checkBidList();
	   	 	var bidpage = 1;
			var pars = 'prdId='+ prdid + '&pageSize='+ bidpagesize + '&currPage='+ bidpage + '&ifbid=' + ifbid + '&timestamp=' + new Date().getTime();
			var timestamp = new Date().getTime();
			ajax.Request(
	   			bidurl,
	   			{prdId:prdid, pageSize:bidpagesize, currPage:bidpage, ifbid:ifbid, timestamp:timestamp},
	   			function(xml) {listBid(xml);}		
	   		);
	   		if(_$('check_allbid')){_$('check_allbid').style.display="inline";} 
	   		if(_$('check_partbid')){_$('check_partbid').style.display="none";}
	   		if(_$('bidtotal')){_$('bidtotal').style.display="none";}
	   		if(_$('show_bid_all')){_$('show_bid_all').style.display="inline"; }
   		}  		   					 
   	}
   	//复位清空
   	function checkBidList(){
   		if(_$('bidBody')&&_$('bidBody').hasChildNodes){
   			while(_$('bidBody').firstChild !== null){_$('bidBody').removeChild(_$('bidBody').firstChild);}
   			}
    }
   	//生成出价列表
   	function listBid(xmlDoc){
		if (xmlDoc.getElementsByTagName('bidorder').length>0) {
			var ss = xmlDoc.getElementsByTagName('bidorder');
			var bidcount = xmlDoc.getElementsByTagName('list')[0].getAttribute('total');   
			_$('bidcount').innerHTML=bidcount;
			for(var i=0 ; i<ss.length; i++){    		
				pp = ss[i];
				username = pp.getElementsByTagName("username")[0].firstChild.nodeValue;
				userid = pp.getElementsByTagName("userid")[0].firstChild.nodeValue;
				bidprice = pp.getElementsByTagName("bidprice")[0].firstChild.nodeValue;       		
				bidprdnum = pp.getElementsByTagName("bidprdnum")[0].firstChild.nodeValue;   		
				realprdnum = pp.getElementsByTagName("realprdnum")[0].firstChild.nodeValue;    	
				bidtime = pp.getElementsByTagName("bidtime")[0].firstChild.nodeValue;
				bidleader = pp.getElementsByTagName("bidleader")[0].firstChild.nodeValue;
				if(prdnum != 1 ){       		
				addTableRowForMultiple(username,userid,bidprice,bidprdnum,realprdnum,bidtime,bidleader);
				}else{
				addTableRowForSingle(username,userid,bidprice,bidtime,bidleader);
				}
			}
			sideSwitch.fixHeight();
		}
    }
	//多物品竞价记录显示
	function addTableRowForMultiple(username,userid,bidprice,bidprdnum,realprdnum,bidtime,bidleader){
        var row = document.createElement("tr");  
        var username = createCellWithTextForBuyer(username,userid);       
        var bidprice = createCellWithTextForBidPrice(bidprice);               
        var bidprdnum = createCellWithTextForVolume(bidprdnum);     
        var realprdnum = createCellWithTextForVolume(realprdnum);	           
        var bidtime = createCellWithTextForTime(bidtime);
        if(bidleader=='0'){
        	var bidleader = createCellWithTextForStatus(bidleader.replace('0','出局'))        	
        	};
        if(bidleader=='1'){
        	var bidleader = createCellWithTextForStatus(bidleader.replace('1','领先'))
        	row.setAttribute("class","table_hlight");
        	row.style.cssText = "background-color:#FFFADA";
        	};
        row.appendChild(username);
        row.appendChild(bidprice);
        row.appendChild(bidprdnum);
        row.appendChild(realprdnum);
        row.appendChild(bidtime);
        row.appendChild(bidleader);
		_$("bidBody").appendChild(row);		
     }
    //单物品竞价记录显示		
	function addTableRowForSingle(username,userid,bidprice,bidtime,bidleader){
        var row = document.createElement("tr");
        var username = createCellWithTextForBuyer(username,userid); 
        var bidprice = createCellWithTextForBidPrice(bidprice);
        var bidtime = createCellWithTextForTime(bidtime);
        if(bidleader=='0'){
        	var bidleader = createCellWithTextForStatus(bidleader.replace('0','出局'))
        	
        	};
        if(bidleader=='1'){
        	var bidleader = createCellWithTextForStatus(bidleader.replace('1','领先'))
        	row.setAttribute("class","table_hlight");
        	row.style.cssText = "background-color:#FFFADA";
        	};
        row.appendChild(username);
        row.appendChild(bidprice);
        row.appendChild(bidtime);
        row.appendChild(bidleader);
		_$("bidBody").appendChild(row);		
     }

	/*
 	* 成交记录Ajax,开始
 	* var prdid 
 	* var orderurl	
 	* */				 
    var orderpage = 1;   
	var orderpagesize = 5;
    //页面载入时读取Ajax
    function orderStart(){
   		var ajax2 = new Ajaxer();
   		if(ifor!=null&&ifor!=0){    
	    	orderpage = 1;
	   		var timestamp = new Date().getTime();
			ajax2.cache = true;
	   		ajax2.get(
	   			orderurl,
	   			{prdId:prdid, pageSize:orderpagesize, currPage:orderpage, ifor:ifor, timestamp:timestamp},
	   			function(xml) {listOrder(xml);},
	   			"xml"
	   		);
	   		if(_$('check_allorder')){_$('check_allorder').style.display="inline";} 
	   		if(_$('check_partorder')){_$('check_partorder').style.display="none";}
	   		if(_$('ordertotal')){_$('ordertotal').style.display="none";}
	   		if(_$('show_order_all')){_$('show_order_all').style.display="inline";}
	   	}
   	}
	//全部显示
    function orderViewAll(){
    	var ajax3 = new Ajaxer(); 
   		if(ifor!=null&&ifor!=0){  
	   		checkOrderList();
			var timestamp = new Date().getTime();
			ajax3.cache = true;
			ajax3.get(
	   			orderurl,
	   			{prdId:prdid, pageSize:999999, currPage:1, ifor:ifor, timestamp:timestamp},
	   			function(xml){listOrder(xml);}	
	   		);
	   		if(_$('check_allorder')){_$('check_allorder').style.display="none";} 
	   		if(_$('check_partorder')){_$('check_partorder').style.display="inline";}
	   		if(_$('ordertotal')){_$('ordertotal').style.display="inline";}
	   		if(_$('show_order_all')){_$('show_order_all').style.display="none";}
	   	}					 
   	}
    //返回显示
    function orderBack(){
   		if(ifor!=null&&ifor!=0){   
   			var ajax = new Ajaxer();     
	    	checkOrderList();
	    	orderpage = 1;
			var pars = 'prdId='+ prdid + '&pageSize='+ orderpagesize + '&currPage='+ orderpage + '&ifor=' + ifor + '&timestamp=' + new Date().getTime();
			var timestamp = new Date().getTime();
			ajax.cache = true;
			ajax.get(
	   			orderurl,
	   			{prdId:prdid, pageSize:orderpagesize, currPage:orderpage, currPage:orderpage, ifor:ifor, timestamp:timestamp},
	   			function(xml) {listOrder(xml);}
	   		);
	   		if(_$('check_allorder')){_$('check_allorder').style.display="inline";} 
	   		if(_$('check_partorder')){_$('check_partorder').style.display="none";}
	   		if(_$('ordertotal')){_$('ordertotal').style.display="none";}
	   		if(_$('show_order_all')){_$('show_order_all').style.display="inline";}
	   	}			 
   	}
    //复位清空
    function checkOrderList(){
	    if(_$('orderBody')&&_$('orderBody').hasChildNodes){
    	while(_$('orderBody').firstChild != null){_$('orderBody').removeChild(_$('orderBody').firstChild);}
    		}
    }	
    //生成成交列表
	function listOrder(xmlDoc){    
   		//var xmlDoc = order_Request.responseXML;
    	var ss = xmlDoc.getElementsByTagName('order');
    	var ordercount = xmlDoc.getElementsByTagName('list')[0].getAttribute('total');
    	_$('ordercount').innerHTML=ordercount;
    	for(var i=0 ; i<ss.length; i++){
      		pp = ss[i];
      		username = pp.getElementsByTagName("username")[0].firstChild.nodeValue;
      		useronlyid = pp.getElementsByTagName("useronlyid")[0].firstChild.nodeValue;
			num = pp.getElementsByTagName("num")[0].firstChild.nodeValue;
			saltype = pp.getElementsByTagName("saltype")[0].firstChild.nodeValue;
			productprice = pp.getElementsByTagName("productprice")[0].firstChild.nodeValue;
			ordertime = pp.getElementsByTagName("ordertime")[0].firstChild.nodeValue;
			orderstatus = pp.getElementsByTagName("status")[0].firstChild.nodeValue;
			addTableRowForOrder(username,useronlyid,num,saltype,productprice,ordertime,orderstatus);
		}
		sideSwitch.fixHeight();
	}
	//成交记录显示
	function addTableRowForOrder(username,useronlyid,num,saltype,productprice,ordertime,orderstatus){
		var row = document.createElement("tr");		
        var username = createCellWithTextForBuyer(username,useronlyid);            
        var num = createCellWithTextForVolume(num);       
        var ordertime = createCellWithTextForTime(ordertime);          
        if(saltype=='1')  var salprice = createCellWithTextForPrice(saltype.replace('1','竞标价：'),productprice);
        if(saltype=='2')  var salprice = createCellWithTextForPrice(saltype.replace('2','一口价：'),productprice);
        if(saltype=='3')  var salprice = createCellWithTextForPrice(saltype.replace('3','仓储式：'),productprice);                 
        if(saltype=='5')  var salprice = createCellWithTextForPrice(saltype.replace('5','竞标/一口：'),productprice);                 
        if(orderstatus=='0') var orderstatus = createCellWithTextForStatus(orderstatus.replace('0','交易完成'));
        if(orderstatus=='1') var orderstatus = createCellWithTextForStatus(orderstatus.replace('1','交易完成'));
        if(orderstatus=='2') var orderstatus = createCellWithTextForStatus(orderstatus.replace('2','交易完成'));
        if(orderstatus=='3') var orderstatus = createCellWithTextForStatus(orderstatus.replace('3','交易完成'));
        if(orderstatus=='4') var orderstatus = createCellWithTextForStatus(orderstatus.replace('4','交易完成'));
        if(orderstatus=='5') var orderstatus = createCellWithTextForStatus(orderstatus.replace('5','交易完成'));
        //if(orderstatus=='0')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('0','交易完成'));
        //if(orderstatus=='1')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('1','交易关闭'));
        //if(orderstatus=='2')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('2','交易退款'));
        //if(orderstatus=='3')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('3','等待买家付款'));
        //if(orderstatus=='4')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('4','等待卖家发货'));
        //if(orderstatus=='5')  var orderstatus = createCellWithTextForStatus(orderstatus.replace('5','等待买家收货并放款'));
        row.appendChild(username);
        row.appendChild(salprice);
        row.appendChild(num);
        row.appendChild(ordertime);
        row.appendChild(orderstatus); 
		_$("orderBody").appendChild(row);
	}
	     
	/*
	 *出价、购买记录cell生成函数
	 * */
	//买家cell	
	function createCellWithTextForBuyer(username,useronlyid){
		var cell = document.createElement("td");
		var celllink = document.createElement("a");
		var textNode = document.createTextNode(username);
		cell.setAttribute("class","object");
		cell.setAttribute("style","text-align:left");
		cell.style.cssText = "text-align:left";
		
		celllink.setAttribute("href",usrurl+useronlyid);
		celllink.appendChild(textNode);
		cell.appendChild(celllink);
		return cell;
	}
	//价格cell
	function createCellWithTextForPrice(saltype,productprice){
		var cell = document.createElement("td");
		var textNode1 = document.createTextNode(saltype);
		var textNode2 = document.createTextNode(productprice+"元");
		cell.appendChild(textNode1);
		cell.appendChild(textNode2);
		return cell;				
	}
	//出价cell
	function createCellWithTextForBidPrice(bidprice){
		var cell = document.createElement("td");
		var textNode = document.createTextNode(bidprice+"元");
		cell.appendChild(textNode);
		return cell;				
	}
	//购买数量cell
	function createCellWithTextForVolume(num){
		var cell = document.createElement("td");
		var textNode = document.createTextNode(num);
		cell.appendChild(textNode);
		return cell;				
	}	
	//成交&出价时间cell
	function createCellWithTextForTime(time){
		var cell = document.createElement("td");
		var times = String(time).split('-');
		if(times[0]&&times[1]&&times[2]&&times[3]&&times[4]&&times[5]){
			var chime = times[0]+"年"+times[1]+"月"+times[2]+"日"+times[3]+"点"+times[4]+"分"+times[5]+"秒";
		}
		var textNode = document.createTextNode(chime);
		cell.appendChild(textNode);
		return cell;				
	}		
	//状态cell
	function createCellWithTextForStatus(orderstatus){
		var cell = document.createElement("td");
		var textNode = document.createTextNode(orderstatus);
		cell.appendChild(textNode);
		return cell;				
	}			
		   
	/*
	 * 生成导航条函数
	 * var classpath,classid
	 * */
	function chPrdAttr1(){    
		var strs = String(classpath).split('|:|');
		var clsId = classid;
		for(var i=0; i<strs.length; i++){
        var temp= clsId.substring(0,(i+1)*3);
        var text1 = document.createTextNode(strs[i]);
        var text2 = document.createTextNode(' > ');
        var element = document.createElement("a");
        element.setAttribute("href",address+'/search/basicsearch.do?sacat='+temp);
        element.appendChild(text1);        
        _$("prdatb").appendChild(text2);
        _$("prdatb").appendChild(element);
		}		
		var lastoldelement = _$("prdatb").lastChild;
		var newtext = lastoldelement.firstChild.nodeValue;
		var lastnewelement = document.createElement("strong");
		lastnewelement.appendChild(document.createTextNode(newtext));
		_$("prdatb").removeChild(lastoldelement);
		_$("prdatb").appendChild(lastnewelement);		
	}
		 
	/*
	 * 切换tab标签函数
	 * */
	 function chDiv(num){
	 	if(num==1){
	 	chDiv1();
	 	}else
	 	if(num==2){
	 	chDiv2();
	 	}else
	 	if(num==3){
	 	chDiv3();
	 	}else
	 	if(num==4){
	 	chDiv4();
	 	}
	 }
	 
	 
	//物品详情 	
	function chDiv1(){
		_$('li1').className='c';
		_$('li2').className='';
		_$('li3').className='';
		_$('li4').className='';	  
		_$('li1').innerHTML="物品详情";
		_$('li2').innerHTML="<a href=javascript:chDiv(2)>其他信息</a>";
		_$('li3').innerHTML="<a href=javascript:chDiv(3)>出价/购买记录</a>";
		_$('li4').innerHTML="<a href=javascript:chDiv(4)>留言本</a>";	  
		_$('id_box').style.display='inline';
		_$('trade_info').style.display='inline';
		_$('buy_log').style.display='inline';
		_$('message_board').style.display='inline';	  
	}
	//其他信息
	function chDiv2(){
		_$('li1').className='';
		_$('li2').className='c';
		_$('li3').className='';
		_$('li4').className='';	  
		_$('li1').innerHTML="<a href=javascript:chDiv(1)>物品详情</a>";
		_$('li2').innerHTML="其他信息";
		_$('li3').innerHTML="<a href=javascript:chDiv(3)>出价/购买记录</a>";
		_$('li4').innerHTML="<a href=javascript:chDiv(4)>留言本</a>";	  
		_$('id_box').style.display='none';
		_$('trade_info').style.display='inline';
		_$('buy_log').style.display='none';
		_$('message_board').style.display='none';
	}
	//出价、购买记录	  
	function chDiv3(){
		_$('li1').className='';
		_$('li2').className='';
		_$('li3').className='c';
		_$('li4').className='';	  
		_$('li1').innerHTML="<a href=javascript:chDiv(1)>物品详情</a>";
		_$('li2').innerHTML="<a href=javascript:chDiv(2)>其他信息</a>";
		_$('li3').innerHTML="出价/购买记录";
		_$('li4').innerHTML="<a href=javascript:chDiv(4)>留言本</a>";	  
		_$('id_box').style.display='none';
		_$('trade_info').style.display='none';
		_$('buy_log').style.display='inline';
		_$('message_board').style.display='none';
	}
	//留言本	  
	function chDiv4(){
		_$('li1').className='';
		_$('li2').className='';
		_$('li3').className='';
		_$('li4').className='c';	  
		_$('li1').innerHTML="<a href=javascript:chDiv1()>物品详情</a>";
		_$('li2').innerHTML="<a href=javascript:chDiv2()>其他信息</a>";
		_$('li3').innerHTML="<a href=javascript:chDiv3()>出价/购买记录</a>";
		_$('li4').innerHTML="留言本";	  
		_$('id_box').style.display='none';
		_$('trade_info').style.display='none';
		_$('buy_log').style.display='none';
		_$('message_board').style.display='inline';
	}	 	  	  
	
	/*
	 * 滚动定位函数
	 * */
	// 转换为数字
	function intval(v){
		v = parseInt(v);
		return isNaN(v) ? 0 : v;
	} 
	// 获取元素信息
	function getPos(e){
		var l = 0;
		var t = 0;
		var w = intval(e.style.width);
		var h = intval(e.style.height);
		var wb = e.offsetWidth;
		var hb = e.offsetHeight;
		while (e.offsetParent){
			l += e.offsetLeft + (e.currentStyle?intval(e.currentStyle.borderLeftWidth):0);
			t += e.offsetTop + (e.currentStyle?intval(e.currentStyle.borderTopWidth):0);
			e = e.offsetParent;
		}
			l += e.offsetLeft + (e.currentStyle?intval(e.currentStyle.borderLeftWidth):0);
			t += e.offsetTop + (e.currentStyle?intval(e.currentStyle.borderTopWidth):0);
		return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
	} 
	// 获取滚动条信息
	function getScroll(){
		var t, l, w, h;
		if (document.documentElement && document.documentElement.scrollTop) {
			t = document.documentElement.scrollTop;
			l = document.documentElement.scrollLeft;
			w = document.documentElement.scrollWidth;
			h = document.documentElement.scrollHeight;
		} else if (document.body) {
			t = document.body.scrollTop;
			l = document.body.scrollLeft;
			w = document.body.scrollWidth;
			h = document.body.scrollHeight;
		}
		return { t: t, l: l, w: w, h: h };
	} 
	// 锚点(Anchor)间平滑跳转
	function scroller(el, duration){
		if(typeof el != 'object') { el = document.getElementById(el); }
		if(!el) return;
		var z = this;
		z.el = el;
		z.p = getPos(el);
		z.s = getScroll();
		z.clear = function(){window.clearInterval(z.timer);z.timer=null};
		z.t=(new Date).getTime();
		z.step = function(){
			var t = (new Date).getTime();
			var p = (t - z.t) / duration;
			if (t >= duration + z.t) {
				z.clear();
				window.setTimeout(function(){z.scroll(z.p.y, z.p.x)},13);
			} else {
				st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t;
				sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l;
				z.scroll(st, sl);
			}
		};
		z.scroll = function (t, l){window.scrollTo(l, t)};
		z.timer = window.setInterval(function(){z.step();},13);
	} 	
	  	
	  
	  /*
	   * 时间处理工具函数
	   * */	   
	  //取得中文日期 
	  function chTime(param){ 	
 	  var myDate = new Date(param*1000);      
	  return myDate.toLocaleDateString();	  
	  }
	  //取得当前年	
	  function getThisYear(param){
	  var myDate = new Date(param*1000);
	  return myDate.getFullYear()>9?myDate.getFullYear():("0"+myDate.getFullYear());
	  }	
	  //取得当前月	
	  function getThisMonth(param){
	  var myDate = new Date(param*1000);
	  var month = myDate.getMonth()+1;
	  return month>9?month:("0"+month);
	  }	
	  //取得当前日	
	  function getThisDate(param){
	  var myDate = new Date(param*1000);
	  return myDate.getDate()>9?myDate.getDate():("0"+myDate.getDate());
	  }	 	  
	  //取得当前小时	
	  function getThisHour(param){
	  var myDate = new Date(param*1000);
	  return myDate.getHours()>9?myDate.getHours():("0"+myDate.getHours());
	  }		  
	  //取得当前分钟
	  function getThisMinute(param){
	  var myDate = new Date(param*1000);
	  return myDate.getMinutes()>9?myDate.getMinutes():("0"+myDate.getMinutes());
	  }
	  //取得当前秒
	  function getThisSecond(param){
	  var myDate = new Date(param*1000);
	  return myDate.getSeconds()>9?myDate.getSeconds():("0"+myDate.getSeconds());	
	  }
	  
	  /*
	   * 处理物品开始时间和结束时间
	   * */
	  function sellBegAndEndTime(){
	  	var sellBegTime = _$('sellBegTime').getAttribute('sellBegTime');
	  	var sellEndTime = _$('sellEndTime').getAttribute('sellEndTime');
	  	_$('sellBegTime').innerHTML=chTime(sellBegTime)+'&nbsp;&nbsp;'+getThisHour(sellBegTime)+'点'+getThisMinute(sellBegTime)+'分'+getThisSecond(sellBegTime)+'秒';
	  	_$('sellEndTime').innerHTML=chTime(sellEndTime)+'&nbsp;&nbsp;'+getThisHour(sellEndTime)+'点'+getThisMinute(sellEndTime)+'分'+getThisSecond(sellEndTime)+'秒';
	  }
	  
	  //剩余时间调用	 	  
	  function startTime(){	  		    	
	    setInterval("activeTime()",1000);
	  }	  	  
	  /*
	   * 剩余时间
	   * salend,systemTime
	   **/
	   
	  function activeTime(){
	     var systemTime = new Date().getTime()/1000;	 
	     var restTime1 = salend - systemTime;   	     
	    if(_$('timeTag')){
	     if(restTime1 > 0 ){
	     	var restTime = restTime1/3600;
	     	var restHour = restTime % 24;	    
	     	var restDay = restTime / 24;
	     	var restMin = (restTime1%3600)/60;
	     	var restSec = (restTime1%3600)%60;	    		 		    
	     	_$('timeTag').innerHTML=(Math.floor(restDay)>0 ? Math.floor(restDay)+'天':'')+(Math.floor(restHour)>0?Math.floor(restHour)+'小时':'')+(Math.floor(restMin)>0?Math.floor(restMin)+'分':'')+Math.floor(restSec)+'秒';	     
	     }else if(restTime1 < 0){
	     	_$('timeTag').innerHTML="<strong color='red'>该产品已过期</strong>";
	     	}else
	     	_$('timeTag').innerHTML="<strong color='red'>该产品预售中</strong>";
	     }
	  }
/*webchat 暂时去掉      
	//取得webchater的状态
    function get_useronline_pic(){
    	var pars;
    	if( window.ActiveXObject ){
    	url= webchaturl + escape(webchater);
    	}else
    	url=webchaturl + webchater;
    	var myAjax = new Ajax.Request(
    		url,
    		{ method: 'get', parameter: pars, onComplete: webchatview}
    	)
    }
   	//webchat回调函数 
    function webchatview(request){
    	var status = request.responseText;
    	if(status == 0){
    		_$('webchatuserview').innerHTML="<a href='javascript:gotoWebchat();' onclick='return addChatter(\""+ webchater+ "\");'><img src='"+webchrurl+"/pic/wc_offline.jpg' border='0'></a>";
    	}else if(status == 1){
    		_$('webchatuserview').innerHTML="<a href='javascript:gotoWebchat();' onclick='return addChatter(\""+ webchater+ "\");'><img src='"+webchrurl+"/pic/wc_online.jpg' border='0'></a>";
    		}else
    		return null;
    }

	function AjaxSellerDesc(){
		var ajax1 = new Ajaxer();
		ajax1.cache = true;
		ajax1.get(
			describeURL,
			{prdDesc:valOfPrdDesc, prdVersion:valOfPrdVersion},
			function(val){document.getElementById("sellerDesc").innerHTML = val;},
			"text"
		);
	} 
 */
	//处理计数
//	function AjaxPageCount(){
//		var pars;
//		var myAjax = new Ajax.Request(	
//		pageviewURL,
//   	{ method: 'get', parameter: pars, onComplete: calculatePageView}
//    	)
//	}	
    
    //浏览量回调函数     
    function calculatePageView(){
    	if(num && num!=null&&_$('viewcount')){
    		_$('viewcount').innerHTML="浏 览 量：";
    		if (_$('viewcount_num')) {_$('viewcount_num').innerHTML=num+"次";}
    	}
    }
    
    //处理物品属性
	function sellerAttribute(){
		if(_$('atb_info')){
	    	var links = _$('atb_info').getElementsByTagName('li');
	    	for(var i=0;i<links.length;i++){
				var atbrow = links[i].getAttribute("atb");
		   		var str = atbrow.split("|-|");					
		   		var strname = str[1]+"：";
		   		var strvalue = str[3];
		   		strvalue1 = strvalue.replace(/\|=\|/g,",");
		   		//links[i].innerHTML="<span class='help_txt'>"+strname+": "+"</span>"+strvalue1;
		   		var text1 = document.createTextNode(strname);
		   		var text2 = document.createTextNode(strvalue1);
		       	links[i].appendChild(text1);
		       	links[i].appendChild(text2);
		    }
   		}
    }
    //处理物品图片
    function sellerPrdImage(){
//   	function openwindow(){
//   	window.open(imgzoominurl+imgs[j],imgs[j],'height=420,width=420,toolbar=0,menubar=0,scrollbars=0');
//   	}
   			var imgs = imgUrl.split("|:|");
   			if(imgUrl.indexOf("upload.eachnet.com")!=-1){
				return false;
   			}   						
			for(var j=0;j<imgs.length-1;j++){

				var li = document.createElement("li");
				var div = document.createElement("div");
				var img = document.createElement("img");
				var a = document.createElement("a");
				//IE浏览器不支持绑定onclick属性,不支持style属性，需要判断浏览器				
				if(window.ActiveXObject){
				img.onclick=function(){
					var tempurl=this.src.replace("_l.",".");
					window.open(tempurl,imgs[j],"resizable=yes,toolbar=0,menubar=0,scrollbars=yes");
					};
				//img.onerror=function(){
				//	img.src="'"+imgs[j].replace('_l','')+"'";
				//	}	
				a.style.cssText="color:#0D62BC;cursor:pointer;";		
				}else{
				img.setAttribute("onclick","window.open('"+imgs[j].replace('_l.','.')+"','"+imgs[j]+"','resizable=yes,toolbar=0,menubar=0,scrollbars=yes');");
				a.setAttribute("class","tag");
				}
				img.setAttribute("src",imgs[j]);
				img.setAttribute("width","188");
				img.setAttribute("height","188");
				img.setAttribute("id",imgs[j]);	
				//img.setAttribute("onerror","javascript:this.src='"+imgs[j].replace('_l','')+"'");				
				_$("imageUrl").appendChild(li);
				li.appendChild(div);
				div.appendChild(a);
				a.appendChild(img);

				}
		   	
    }
    
    /*
     * 橱窗图片Ajax
     * */
    function getZoomPicture(imgsrc){
    	var pars='imgsrc='+imgsrc;
    	alert(imgsrc);   	
    	var myAjax = new Ajax.Request(
   			url,
   			{method: 'get', parameters: pars, onComplete: function(){
   				
   			}}
   			);
    }
    //处理留言和答复时间
    function messageTime(){
    	var links = _$('message').getElementsByTagName('span');
    	for(var i=0;i<links.length;i++){
    	if(links[i].getAttribute("messageCreatTime")){
    		var time = links[i].getAttribute("messageCreatTime");
    		var myDate = new Date(time*1000);
         	 	links[i].innerHTML=getThisYear(time)+'-'+getThisMonth(time)+'-'+getThisDate(time)+' '+getThisHour(time)+':'+getThisMinute(time)+':'+getThisSecond(time);
        	}        
        if(links[i].getAttribute("messageAnswerTime")){
    		var time = links[i].getAttribute("messageAnswerTime");  		
       	 	links[i].innerHTML=getThisYear(time)+'-'+getThisMonth(time)+'-'+getThisDate(time)+' '+getThisHour(time)+':'+getThisMinute(time)+':'+getThisSecond(time);
        	}
        }    	 
    }    
	//留言和答复的转义
	function messageContent(){
    	var links = _$('message').getElementsByTagName('span');
    	for(var m=0;m<links.length;m++){
    	if(links[m].getAttribute("queContent")){
    		var askcontent = links[m].getAttribute("queContent");
	   		//var step1 = askcontent.stripTags();
    		//var step2 = step1.striptScripts();
       	 	//var text = document.createTextNode(step2);
       	 	var text = document.createTextNode(askcontent);
       	 	links[m].appendChild(text);
        	}        
        if(links[m].getAttribute("answerContent")){
    		var answercontent = links[m].getAttribute("answerContent");
    		//var step1 = answercontent.stripTags();
    		//var step2 = step1.striptScripts();
       	 	//var text = document.createTextNode(step2);
       	 	var text = document.createTextNode(answercontent);
       	 	links[m].appendChild(text);
        	}
        }		
	}
	
	//处理付款方式
	function parsePayType(){
		var paytype = _$('paytype').getAttribute("paytype");
	  	var temp='';
	    for(var i=0; i<paytype.length;i++){
	       if(paytype.charAt(i)=="1"&i==0) temp=temp+" <img src='"+ staticaddress + "/pic/escrow.gif' alt='安付通标志' width=72 height=22 vspace=2 align=absmiddle />（网上支付免手续费，收货满意后放款，安全购物百分百！  <a href='"+helpserver+"/escrow/' target='_blank'>了解更多</a>）<br />";
	       if(paytype.charAt(i)=="1"&i==1) temp=temp+" 银行转帐<br />";
	       if(paytype.charAt(i)=="1"&i==2) temp=temp+" 一手交钱，一手交货 （限同城)<br />";
	       if(paytype.charAt(i)=="1"&i==3) temp=temp+" 货到付款<br />";
	       if(paytype.charAt(i)=="1"&i==4)  temp=temp+" 邮局汇款<br />";	       
	    }
	     _$("paytype").innerHTML = temp;	    	  
	  }
	    
    //退换货说明转义
    function grarDesc(){
    	if(_$('grardesc')){
    	var grardesc = _$('grardesc').getAttribute("grardesc");
    	 _$('grardesc').appendChild(document.createTextNode(grardesc));}
    }

    //结束单个物品提示
	function EndItemSingle(prdid){
	var ask = window.confirm("您确定要提前结束此物品吗？");  		
 		if(ask){
 			if(ifbid==null||ifbid==0){
 				window.location.href=myeachnetserver+"/my/endsold.do?singlePrdId="+prdid;
 			}else
 				alert("物品已经出价，不能结束！");
 		}	
	}
	
	//编辑单个物品提示
	function EditItemSingle(prdid){
	var ask = window.confirm("您确定要编辑此物品吗？");  		
 		if(ask){
 			window.location.href=syiserver+"/prd/editPrdInfo.do?prdId="+prdid+"&action=modify";
 		}	
	}
	    
    //to do
	function SetWinHeight(obj)
	{
	    var win=obj;
	    if (document.getElementById)
	    {
	        if (win && !window.opera)
	        {	
	            if (win.contentDocument && win.contentDocument.body.scrollHeight){				
	                win.height = win.contentDocument.body.scrollHeight;
	                win.width = win.contentDocument.body.scrollWidth;
	                //alert("1");alert(win.height);				               
	            }else if(win.Document && win.Document.body.scrollHeight){
	                win.height = win.Document.body.scrollHeight;
	                win.width = win.Document.body.scrollWidth;
	                //alert("2");alert(win.height);
	            }    
	        }
	    }
	}
    
    //显示coupon 
    function show_couponinfo(couponinfo) {
		if(couponinfo.CouponValidNum==0){
			var html_coupon = document.createElement('div');
			html_coupon.id = "userPoints";
			_$('itemProperty').insertBefore(html_coupon,_$('itemPropertyDetail'));
			html_coupon.innerHTML = LinkText;
		} else {
			var html_coupon = document.createElement('div');
			html_coupon.id = "userPoints";
			_$('itemProperty').insertBefore(html_coupon,_$('itemPropertyDetail'));
			html_coupon.innerHTML = '您有<span class="hl">'+couponinfo.CouponValidNum + '</span>张购物券,总计<span class="hl">' + couponinfo.CouponValidAmount + '</span>元，请在购买时选择使用。<span class="hl">' + couponinfo.CouponValidList[0].CouponAmount + '</span>元购物券即将在' + couponinfo.CouponValidList[0].CouponEndTime + '到期。';
		}
	}
	

    
    //初始化载入
    window.onload = function(){
    	//AjaxSellerDesc();
    	startTime();
    	bidStart();
    	orderStart();
//    	if(prd_id!=0&&prd_id!=null){//如果是预览则不执行
//    		chPrdAttr1();
//    	}
    	parsePayType();
    	sellBegAndEndTime();
//    	sellerAttribute();
//    	recommadPrdsView();
    	showMessages();
    	sellerPrdImage();
    	grarDesc();
    	calculatePageView();
    	//resetIframeHeight();
    }

    //为蜂抢专区页面提供物品信息
    function getXMLRequester(){
	    var xmlhttp_request = false;
	    try{
	        if( window.ActiveXObject ){
	            for( var i = 5; i; i-- ){
	                try{
	                    if( i == 2 ){
							xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" );    
	                    }else{
							xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );	
							xmlhttp_request.setRequestHeader("Content-Type","text/xml");
							xmlhttp_request.setRequestHeader("Content-Type","UTF-8");
	            		    }
						break;
						}catch(e){                        
	                    	xmlhttp_request = false;
	                }
	            }
	        }else if( window.XMLHttpRequest ){
	            xmlhttp_request = new XMLHttpRequest();
	            if (xmlhttp_request.overrideMimeType) {
	                xmlhttp_request.overrideMimeType('text/xml');
	            }
	        }
	    }catch(e){
	        xmlhttp_request = false;
	    }
	    return xmlhttp_request ;
	}
	//url：获取数量的action地址
	function getQuantity(url) {
	        xmlhttp_request=getXMLRequester();
	        xmlhttp_request.onreadystatechange = doContents;
			xmlhttp_request.open('POST', url, true);
	        xmlhttp_request.send(null);
	}
	
	function doContents() {
	     if (xmlhttp_request.readyState == 4) {
	        if (xmlhttp_request.status == 200) {
				 var SoldQuantity =xmlhttp_request.responseXML.getElementsByTagName("SoldQuantity")[0].firstChild.data;//可售剩余数量
				 var RemainQuantity=xmlhttp_request.responseXML.getElementsByTagName("RemainQuantity")[0].firstChild.data;//累计售出数量
				 alert("可售剩余数量:"+SoldQuantity+"  累计售出数量:"+RemainQuantity);
			} else {
	         return false;
	      }
	   }
	}
	//展示卖家推荐物品信息
	function recommadPrdsView() {
		var ajax14 = new Ajaxer();
		ajax14.cache = true;
		ajax14.get(
			recomPrdsUrl,
			{ usrOnlyid:usrOnlyid },
			function(val) {document.getElementById("itemSellerRec").innerHTML = val;},
			"text"
		);
	}
	
	function showMessages() {
   		var ajax15 = new Ajaxer();
   		ajax15.get(
   			messUrl,
   			{prdId:prd_id, usrOnlyid:usrOnlyid, loginOnlyid:loginOnlyid},
   			function(val) {document.getElementById("itemFeedback").innerHTML = val;},
   			"text"
   		);
   	}
	