
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;
}


//函数名：chkemail
//功能介绍：检查是否为Email Address
//参数说明：要检查的字符串
//返回值：0：不是  1：是
function chkemail(a)
{

	var i=a.length;

	var temp = a.indexOf('@');
	//var tempd = a.indexOf('.');
	var tempd = a.indexOf('.');

	if (tempd > 0) {
		tempd = (a.substring(temp)).indexOf('.');
		
		if (temp > 1) {
		
			if ((i-temp) > 6){
				if (tempd > 1){
				
					if ((i-temp-tempd)>2){
						return 1;
					}
				}
			}
		}

	}
	
	return 0;
	
}


//函数名：fucStrchk
//功能介绍：检查是否含有非数字或字母
//参数说明：要检查的字符串
//返回值：0：含有非数字或字母 1：全部为数字或字母
function fucStrchk(str)
{
  var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
  var ch;
  var i;
  var temp;
  
  for (i=0;i<=(str.length-1);i++)
  {
  
    ch = str.charAt(i);
    temp = strSource.indexOf(ch);
    if (temp==-1) 
    {
     return 0;
    }
  }
    return 1;
}





