function checkIsSn(str){
        str = $.trim(str);
	if(str == "") 
		return true; 
	if(/^[a-zA-Z0-9\-]+$/.test(str)) 
		return true; 
	else 
		return false;     
}

function checkIsInteger(str) 
{ 
        str = $.trim(str);
	if(str == "") 
		return true; 
        str = Math.abs(str);    
	if(/^(\d+)$/.test(str)) 
		return true; 
	else 
		return false; 
}

function checkIntegerMinValue(str,val) 
{ 
        str = $.trim(str);
        val = $.trim(val);
	if(str == "") 
		return true; 
	if(typeof(val) != "string") 
	val = val + ""; 
	if(checkIsInteger(str) == true) 
	{ 
		if(parseInt(str,10)>=parseInt(val,10)) 
			return true; 
		else 
			return false; 
	} 
	else 
		return false; 
}

function checkIntegerMaxValue(str,val) 
{ 
        str = $.trim(str);
        val = $.trim(val);    
	if(str == "") 
	return true; 
	if(typeof(val) != "string") 
	val = val + ""; 
	if(checkIsInteger(str) == true) 
	{ 
		if(parseInt(str,10)<=parseInt(val,10)) 
			return true; 
		else 
			return false; 
	} 
	else 
		return false; 
}

function isNotNegativeInteger(str) 
{ 
        str = $.trim(str); 
	if(str == "") 
		return true; 
	if(checkIsInteger(str) == true) 
	{ 
		if(parseInt(str,10) < 0) 
		return false; 
		else 
		return true; 
	} 
	else 
		return false; 
}

function checkIsFloat(str) 
{ 
        str = $.trim(str);    
	if(str == "") 
		return true; 
	if(str.indexOf(".") == -1) 
	{ 
		if(checkIsInteger(str) == true) 
			return true; 
		else 
			return false; 
	}else{ 
                str = Math.abs(str);
		if(/^[0-9]+(\.[0-9]{1,}){0,1}$/g.test(str)) 
			return true; 
		else 
			return false; 
	} 
}

function checkIsDouble(str) 
{ 
        str = $.trim(str);    
	if(str == "") 
		return true; 
	if(str.indexOf(".") == -1) 
	{ 
		if(checkIsInteger(str) == true) 
			return true; 
		else 
			return false; 
	}else{ 
                str = Math.abs(str); 
		if(/^(\\-?)(\\d+)(.{1})(\\d+)$/g.test(str)) 
			return true; 
		else 
			return false; 
	} 
}

function checkDoubleMinValue(str,val) 
{ 
        str = $.trim(str);
        val = $.trim(val);    
	if(str == "") 
		return true; 
	if(typeof(val) != "string") 
	val = val + ""; 
	if(checkIsDouble(str) == true) 
	{ 
		if(parseFloat(str)>=parseFloat(val)) 
			return true; 
		else 
			return false; 
	}
	else 
		return false; 
}
	
function checkDoubleMaxValue(str,val) 
{ 
        str = $.trim(str);
        val = $.trim(val);    
	if(str == "") 
		return true; 
	if(typeof(val) != "string") 
		val = val + ""; 
	if(checkIsDouble(str) == true) 
	{ 
		if(parseFloat(str)<=parseFloat(val)) 
			return true; 
		else 
			return false; 
	} 
	else 
		return false; 
}

function isNotNegativeDouble(str) 
{ 
        str = $.trim(str);  
	if(str == "") 
		return true; 
	if(checkIsDouble(str) == true) 
	{ 
		if(parseFloat(str) < 0) 
		return false; 
		else 
		return true; 
	} 
	else 
		return false; 
}

function checkIsValidDate(str) 
{ 
        str = $.trim(str);
	if(str == "") 
		return true; 
	var pattern = /^\d{4}-((0{1}[1-9]{1})|(1[0-2]{1}))-((0{1}[1-9]{1})|([1-2]{1}[0-9]{1})|(3[0-1]{1}))$/; 
	if(!pattern.test(str)) 
		return false; 
	return true;
//	alert(str);
//	var arrDate = str.split("-"); 
//	if(parseInt(arrDate[0],10) < 100) 
//		arrDate[0] = 2000 + parseInt(arrDate[0],10) + ""; 
//	var date = new Date(arrDate[0],(parseInt(arrDate[1],10) -1)+"",arrDate[2]); 
//	alert(date.getYear());alert(arrDate[0]);
//	alert(date.getMonth());alert((parseInt(arrDate[1],10) -1));
//	if(date.getYear() == arrDate[0] && date.getMonth() == (parseInt(arrDate[1],10) -1)+"" && date.getDate() == arrDate[2]) 
//		return true; 
//	else 
//		return false; 
}

function checkDateEarlier(strStart,strEnd) 
{ 
        strStart = $.trim(strStart);
        strEnd = $.trim(strEnd);    
	if(checkIsValidDate(strStart) == false || checkIsValidDate(strEnd) == false) 
		return false; 
	if (( strStart == "" ) || ( strEnd == "" )) 
		return true; 
	var arr1 = strStart.split("-"); 
	var arr2 = strEnd.split("-"); 
	var date1 = new Date(arr1[0],parseInt(arr1[1].replace(/^0/,""),10) - 1,arr1[2]); 
	var date2 = new Date(arr2[0],parseInt(arr2[1].replace(/^0/,""),10) - 1,arr2[2]); 
	if(arr1[1].length == 1) 
		arr1[1] = "0" + arr1[1]; 
	if(arr1[2].length == 1) 
		arr1[2] = "0" + arr1[2]; 
	if(arr2[1].length == 1) 
		arr2[1] = "0" + arr2[1]; 
	if(arr2[2].length == 1) 
		arr2[2]="0" + arr2[2]; 
	var d1 = arr1[0] + arr1[1] + arr1[2]; 
	var d2 = arr2[0] + arr2[1] + arr2[2]; 
	if(parseInt(d1,10) > parseInt(d2,10)) 
		return false; 
	else 
		return true; 
}

function checkIsEmail(str) 
{ 
        str = $.trim(str);       
	if(str == "") 
		return true; 
	var pattern = /^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+){1,4}$/;
	  return pattern.test(str);
}

function checkIsMoney(str){
    str = $.trim(str);      
    if(str == "")
        return true;
    var pattern1 = /^[0-9]+$/;
    var pattern2 = /^[0-9]+\.[0-9]{1,2}$/;
    return pattern1.test(str) || pattern2.test(str) ;
}
	
function checkIsChinese(str) 
{ 
        str = $.trim(str);       
	if (str == "") 
		return true; 
	var pattern = /^([\\u4E00-\\u9FA5]|[\\uFE30-\\uFFA0])*$/gi; 
	if (pattern.test(str)) 
		return true; 
	else 
		return false; 
}

function checkStrLengthRange(str, minl, maxl){
        str = $.trim(str);
        minl = $.trim(minl);    
        maxl = $.trim(maxl);          
	if (str == "") 
		return true;
	if(str.length <= minl || str.length >= maxl)
		return false;
	return true;				
}

