//日期自动转换函数
function showlefttime(auctionDate)
{
  
    var _day = '天';
    var _hour = '小时';
    var _minute = '分钟'; 
    var ts=auctionDate;
    var dateLeft = 0;
    var hourLeft = 0;
    var minuteLeft = 0; 
    var Temp='';  
    if(ts < 0)
    {
        Temp="成交结束";   
    } 
    else 
    {       
       dateLeft =parseInt(ts/86400);//剩余多少天
       if( dateLeft > 0 )
           Temp = dateLeft + _day ;
       else
      {
          hourLeft = parseInt(ts/3600);        
          if( hourLeft > 0 )
              Temp = hourLeft + _hour ;
          else
          {
              minuteLeft = parseInt(ts/60);     
              if( minuteLeft > 0 )
                 Temp = minuteLeft + _minute ;
              else 
                 Temp = "成交结束";
          }
       }
    }  
	document.write(Temp);   
}
//图片自适应大小函数
var imageObject;
function ResizeImage(obj, MaxW, MaxH)
{
    if (obj != null) imageObject = obj;
    var state=imageObject.readyState;
	if(state!='complete') {
        setTimeout("ResizeImage(null,"+MaxW+","+MaxH+")",50);
		return;
    }
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW=oldImage.width; var dH=oldImage.height;
    if(dW>MaxW || dH>MaxH) {
        a=dW/MaxW; b=dH/MaxH;
        if(b>a) a=b;
        dW=dW/a; dH=dH/a;
    }
    if(dW > 0 && dH > 0) {
        imageObject.width=dW;
		imageObject.height=dH;
	}
}
function checkSelect(ctlname)
{
  var checkIdObj = eval("infoform.infodelid");
  var flag = false;
    //判断对象是否为空
    if (!checkIdObj.length)
    {
      if(infoform.infodelid.checked)
      {
        infoform.submit();
      }
      else
      {
        alert("请选择要删除的条目！");
        return false;
      }
    }
    else
    {//如果check列表对象多于一个
      for (i=0; i<checkIdObj.length; i++)
      {
         if(checkIdObj[i].checked)
         {
          flag=true;
         }
       }
      if(flag)
      {
          infoform.submit();
      }
      else
      {
         alert("请选择要删除的条目！");
         return false;
      }
    }
}

function showPreview(imgUrl)
{   
  var obj=document.getElementById('show_prieview');
  obj.style.display="";
  obj.style.left=event.x;
  obj.style.top=event.y;
  obj.innerHTML="<img src='"+imgUrl+"' onload='ResizeImage(this, 250, 250);'>";
  
}
function hidenPreview()
{
  var obj=document.getElementById('show_prieview');
  obj.style.display="none";
}
//**********************
//功能---全选复选框
//使用---AdminUser
//**********************
function SelectAllCheckboxes(spanChk){
　var oItem = spanChk.children;
　var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
　xState=theBox.checked;
　elm=theBox.form.elements;
　for(i=0;i<elm.length;i++)
　if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
　{
　　if(elm[i].checked!=xState)
　　elm[i].click();
　}
}
function showHelp(id)
{ 
  var obj=document.getElementById(id);
  obj.style.display="";
  obj.style.left=event.x;
  obj.style.top=event.y;
  
  
}
function hidenHelp(id)
{
  var obj=document.getElementById(id);
  obj.style.display="none";
}