//图片按比例缩放    
var flag=false;    
function DrawImage(ImgD,iwidth,iheight){    
    //参数(图片,允许的宽度,允许的高度)    
    var image=new Image();    
    image.src=ImgD.src;    
    if(image.width>0 && image.height>0){    
    flag=true;    
    if(image.width/image.height>= iwidth/iheight){    
        if(image.width>iwidth){     
        ImgD.width=iwidth;    
        ImgD.height=(image.height*iwidth)/image.width;    
        }else{    
        ImgD.width=image.width;     
        ImgD.height=image.height;    
        }    
        ImgD.alt=image.width+"×"+image.height;    
        }    
    else{    
        if(image.height>iheight){     
        ImgD.height=iheight;    
        ImgD.width=(image.width*iheight)/image.height;            
        }else{    
        ImgD.width=image.width;     
        ImgD.height=image.height;    
        }    
        ImgD.alt=image.width+"×"+image.height;    
        }    
    }    
}

function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
      scroll_div.scrollLeft-=scroll_begin.offsetWidth
    else
      scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}

function openwin(w,h,url)
		{
		var l=(window.screen.width/2)-w/2;
		var t=(window.screen.height/2)-h/2;
		window.open(url,'','width='+w+',height='+h+',top='+t+',left='+l+',menubar=no,toobar=no,scrollbars=No,resizable=no,status=no,location=no');
	
}
 function check(obj)   
  {
      var j=0;   
      var el   =   Upform.elements;   
      var count   =   el.length;   
      for (i=0;i<count;i++)   
      {
      if (el[i].name=="ClassID" && el[i].checked==true)
      j++;   
      }
      if(j>5)   
      {obj.checked=false; }
	  }
	  
function docheck()   
  {     
   if (document.hosturl.Domain[0].checked)     
   {   
   document.all.Domain1.style.display = "";
   document.all.Domain2.style.display = "none";
   return false;   
   }
   if (document.hosturl.Domain[1].checked)     
   {   
   document.all.Domain1.style.display = "none";
   document.all.Domain2.style.display = "";
   return false;   
   }   
  return true;   
  }   
/**
*方法名：NumOnly()
*描述：只允许输入数字及小数点
*输入：空
*输出：空
**/
function NumOnly(){
    var i= window.event.keyCode
	//8=backspace
	//9=tab
	//37=left arrow
	//39=right arrow
	//46=delete
	//48~57=0~9
    if ((i>57 || i<48) && (i!=8) && (i!=9) && (i!= 37) && (i!=39) && (i!=46))
	{
        window.event.keyCode=27;
		return false;
    }
	else
	{
        //window.event.keyCode=keycode;
		return true;
    }
}

function gbcount(message,total,used,remain)
{
  var max;
  max = total.value;
  if (message.value.length > max) {
  message.value = message.value.substring(0,max);
  used.value = max;
  remain.value = 0;
  alert("内容不能超过 200 个字!");
  }
  else {
  used.value = message.value.length;
  remain.value = max - used.value;
  }
}
