function check_from(a,b)
{ 
 var array=a.split(";");
 var desrc=b.split(";");
 for(var i=0;i<array.length;i++)
 {
	 var value_str=document.getElementById(array[i]).value; 
	 if(value_str.length<1)
	 {
		alert(desrc[i]) ;
		return false;
	 } 
 }   

 return true;
}
//check_("a,b,c,d");

///判断2字符串是否相等
function equals(stra,strb)
{
  return (stra == strb) ? true : false;
}

///校验是否为数字
function isNotaNumber (inputString)
{
  return isNaN(inputString);
}
//校验是否为float
function isNumberFloat(inputString)
{
  return (!isNaN(parseFloat(inputString))) ? true : false;
}
 
///判断第一个参数是否小于等于第二个参数
function minLength(inputString,inputLength)
{
  return (inputString.length <= inputLength) ? true : false;
}

///判断第一个参数是否大于等于第二个参数
function minLength(inputString,inputLength)
{
  return (inputString.length >= inputLength) ? true : false;
}

//把所有字符变为大写
function stringToUppercase(inputString)
{
  return inputString.toUpperCase();
}

//把所有字符变为小写
function stringToUppercase(inputString)
{
  return inputString.toLowerCase();
}

//取字符长度
function getStrLenth(sChars){
	return sChars.replace(/[^\x00-\xff]/g,"xx").length;
}

//是否日期格式
function isDate(val){
	var patn = /^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s(((0?[0-9])|(1[0-9])|(2[0-3]))\:(([0-5][0-9])|([0-9]))(((\s)|(\:(([0-5][0-9])|([0-9]))))?)))?$/;
	if(!patn.test(val)){
		return false;
	}else{
		return true;
	}
}

function DrawImage(ImgD,FitWidth,FitHeight){	
	try{
		var width = ImgD.width;
		var height = ImgD.height;
		if(width > 0 && height > 0){
			if (width / height >= FitWidth / FitHeight){
				if (width > FitWidth){                
					ImgD.width=FitWidth;                 
					ImgD.height=(height*FitWidth)/width;           
				}else{                 
					ImgD.width=width;                
					ImgD.height=height;             
				}
			}
		}else{
			if(height>FitHeight){
				ImgD.height=FitHeight;                
				ImgD.width=(width*FitHeight)/height;            
			}else{                
				ImgD.width=width;                
				ImgD.height=height;            
			}       
		}
	}catch(ex){
		alert(ex.name + "\t" + ex.message);
	}
}

function DrawImage2(ImgD,FitWidth){	
	try{
		var width = ImgD.width;
		var height = ImgD.height;
		if(width > 0){
			if(width > FitWidth){
				var percent = FitWidth/width;
				$(ImgD).attr("width",FitWidth);
				$(ImgD).attr("height",height*percent);
			}
		}
	}catch(ex){
		alert(ex.name + "\t" + ex.message);
	}
}

function resize(ImgD,FitWidth,FitHeight){	 
	try{	
		var oldImage = new Image();
		oldImage.src = ImgD.src;
		
		var oldWidth = oldImage.width;
		var oldHeight = oldImage.height;
	 
		if(oldWidth > 0 && oldHeight > 0){
			if(oldWidth / oldHeight >= FitWidth / FitHeight){
				if(oldWidth > FitWidth){                
					ImgD.width = FitWidth;                 
					ImgD.height = (oldHeight * FitWidth) / oldWidth;           
				}else{                 
					ImgD.width = oldWidth;                
					ImgD.height = oldHeight;             
				}
			}else{            
				if(oldHeight > FitHeight){
					ImgD.height = FitHeight;                
					ImgD.width = (oldWidth * FitHeight) / oldHeight;            
				}else{        
					ImgD.width = oldWidth;                
					ImgD.height = oldHeight;            
				}       
			}
		} 
	}catch (ex){
		alert(ex.name + "\t" + ex.message);
	}
}