
var flag=false;
function DrawImage(ImgD,x,y){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= x/y){
     if(image.width>x){  
     ImgD.width=x;
     ImgD.height=(image.height*x)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     //ImgD.alt=image.width+"×"+image.height;
     }
    else{
     if(image.height>y){  
     ImgD.height=y;
     ImgD.width=(image.width*y)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     //ImgD.alt=image.width+"×"+image.height;
     }
    }
} 


	

//函数名：fucCheckTel
//功能介绍：检查是否为电话号码
//参数说明：要检查的电话号码
//返回值：1为是电话号码，0为不是电话号码
function fucCheckTel(Tel)
{
	var i,j,strTemp;
	strTemp="0123456789-#() ";
	if (Tel.length < 7 )
	{
	 return 0;
	 }
	for (i=0;i<Tel.length;i++)
	{
		j=strTemp.indexOf(Tel.charAt(i));	
		if (j==-1)
		{
		//说明不是电话号码
			return 0;
		}
	}
	//说明是电话号码
	return 1;
}

function email(str)
{
    var email = str;
    if (email.length < 8)
    {
        return false;
    }
    else
    {
        if (email.indexOf(".") <=1 || email.indexOf("@") == -1)
        {
            return false;
        }    
    }
}
function jtrim(str)
{     while ((str.charAt(0)==" ")||(str.charAt(0)=="　"))
          {str=str.substr(1);}      
     while (str.charAt(str.length-1)==" ")
         {str=str.substr(0,str.length-1);}
     return(str);
}






