// JScript 文件
//显示评价等级
function displayStar(points)
{ 
   var Point=points;
   var ShopPath="../"
   if(arguments[1]!=null)
   {
       ShopPath=arguments[1];
   }
   if(Point<=4)
   {
     document.write(Point);
   }
   else
   { 
      if(Point>4 && Point<11)
      {
         document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin1.gif' alt='5-10分信用积分'/>");
      }     
      else
      { 
          if(Point>10 && Point<41)
         {
            document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin2.gif' alt='10-40分信用积分 '/>");
          }
          else
          {
            if(Point>40 && Point<91)
            {
                 document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin3.gif' alt='40-90分信用积分'/>");
            }  
            else
            {
              if(Point>90 && Point<151)
              {
                 document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin4.gif' alt='90-150分信用积分'/>");
               }  
              else
              {
                if(Point>150 && Point<251)
                {
                   document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin5.gif' alt='150-250分信用积分'/>");
                 }  
                else
                {
                    if(Point>250 && Point<501)
                    {
                       document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin1.gif' alt='250-500分信用积分'/>");
                    }   
                    else
                    {
                       if(Point>500 && Point<1001)
                       {
                        document.write("&nbsp;<img src='"+ShopPath+"Images/xin2.gif' alt='500-1000分信用积分'/>");
                       }   
                       else
                       {
                           if(Point>1000 && Point<2001)
                           {
                              document.write("&nbsp;<img src='"+ShopPath+"Images/xin3.gif' alt='1000-2000分信用积分'/>");
                           }  
                           else
                           {
                              if(Point>2000 && Point<5001)
                              {
                                 document.write("&nbsp;<img src='"+ShopPath+"Images/xin4.gif'alt='2000-5000分信用积分'/>");
                              }   
                              else
                              {
                                  if(Point>5000 && Point<10001)
                                  {
                                     document.write("&nbsp;<img src='"+ShopPath+"Images/xin5.gif' alt='5000-10000分信用积分'/>");
                                  } 
                                  else
                                  {
                                      document.write("&nbsp;<img src='"+ShopPath+"Images/xin5.gif' alt='最高等级'/>");
                                  }
                               }    
                           }
                       }
                    }  
                }
              }     
            }
          }  
      }
   } 
}
//日期自动转换函数




//

function displayStarUrl(points,path)
{ 
   var Point=points;
   
   var ShopPath=path;
   if(arguments[1]!=null)
   {
       ShopPath=arguments[1];
   }
   if(Point<=4)
   {
     document.write(Point);
   }
   else
   { 
      if(Point>4 && Point<11)
      {
         document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin1.gif' alt='5-10分信用积分'/>");
      }     
      else
      { 
          if(Point>10 && Point<41)
         {
            document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin2.gif' alt='10-40分信用积分 '/>");
          }
          else
          {
            if(Point>40 && Point<91)
            {
                 document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin3.gif' alt='40-90分信用积分'/>");
            }  
            else
            {
              if(Point>90 && Point<151)
              {
                 document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin4.gif' alt='90-150分信用积分'/>");
               }  
              else
              {
                if(Point>150 && Point<251)
                {
                   document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin5.gif' alt='150-250分信用积分'/>");
                 }  
                else
                {
                    if(Point>250 && Point<501)
                    {
                       document.write("&nbsp;<img src='"+ShopPath+"Images/xinxin1.gif' alt='250-500分信用积分'/>");
                    }   
                    else
                    {
                       if(Point>500 && Point<1001)
                       {
                        document.write("&nbsp;<img src='"+ShopPath+"Images/xin2.gif' alt='500-1000分信用积分'/>");
                       }   
                       else
                       {
                           if(Point>1000 && Point<2001)
                           {
                              document.write("&nbsp;<img src='"+ShopPath+"Images/xin3.gif' alt='1000-2000分信用积分'/>");
                           }  
                           else
                           {
                              if(Point>2000 && Point<5001)
                              {
                                 document.write("&nbsp;<img src='"+ShopPath+"Images/xin4.gif'alt='2000-5000分信用积分'/>");
                              }   
                              else
                              {
                                  if(Point>5000 && Point<10001)
                                  {
                                     document.write("&nbsp;<img src='"+ShopPath+"Images/xin5.gif' alt='5000-10000分信用积分'/>");
                                  } 
                                  else
                                  {
                                      document.write("&nbsp;<img src='"+ShopPath+"Images/xin5.gif' alt='最高等级'/>");
                                  }
                               }    
                           }
                       }
                    }  
                }
              }     
            }
          }  
      }
   } 
}

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==undefined)
        state=imageObject.complete;
    
	if(state!='complete' && state!=true) {
        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 CheckTextBoxLength(MaxLength,ControlID,CanEmpty)
  {
     var CheckObj=document.getElementById(ControlID);
     if(CheckObj!=null)
     {
        if(CheckObj.value=="" &&!CanEmpty)
        {
           alert("输入不能为空！");
           return false;
        }
        else  if(CheckObj.value.length>parseInt(MaxLength))
        {
           alert("输入内容长度超出限制！,请重新输入");
           return false;
        }
     }
  }
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;
	}
}
 