function isNotEmpty(checkValue) {
	if(checkValue == null)
	 return false;
	if (trim(checkValue).length == 0) {
		return false;
	}
	if (checkValue.replace(/(^\s*)|(\s*$)/g, "").length == 0) {
		return false;
	}
	return true;
}

function trim(checkValue) {
	return checkValue.replace(/(^\s*)|(\s*$)/g, "");
}

function isNumber(checkValue) {
	var pattern = /^\-?[0-9]+(\.[0-9]{0,2}){0,1}$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}
function isNumber1(checkValue) {
	var pattern = /^(0|([1-9]\d*))(\.\d+)?$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}
function IntNumber(checkValue) {
	var pattern = /^[1-9]\d*$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}
function isEmailAddr(checkValue) {
	var pattern = /^(\w+@\w+\.\w+)(\.{0,1}\w*)$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}

function checkYear(checkValue){
	
	if (checkValue.match(/^\d{4}$/) == null) {
		return false;
	} else {
		return true;
	}
}
function checkMonth(checkValue){
		
	if(checkValue>=1 && checkValue <=12)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function nowDate() {
	var dtime = new Date();
	var year = dtime.toLocaleString().substring(0, 4);
	var month = (dtime.getMonth() + 1) < 10 ? "0" + ((dtime.getMonth() + 1)) : (dtime.getMonth() + 1);
	var day = dtime.getDate() < 10 ? "0" + dtime.getDate() : dtime.getDate();
	return year + "-" + month + "-" + day;
}

function isMobileNumber(checkValue) {
	var pattern = /^1\d{10}$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}

function isPhoneNumber(checkValue) {
	var pattern = /^[1-9]\d{6,7}$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}

function isPhoneNumWithArea(checkValue) {
	var pattern = /^0\d{2,3}\-[1-9]\d{6,7}$/;
	if (checkValue.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}

function compareStringLength(checkValue, standardLength) {
	if (checkValue.length > standardLength) {
		return 1;
	} else {
		if (checkValue.length < standardLength) {
			return -1;
		} else {
			return 0;
		}
	}
}

function beginWithWhite(valueString) {
	var pattern = /^\s/;
	if (valueString.match(pattern) == null) {
		return false;
	} else {
		return true;
	}
}




function getLength(str) {
	var n = 0 ;
	var s;
	if (str == null ||str =="") return n= 0  ;
	for (var i = 0;i < str.length;i++) {
		s = str.charCodeAt(i);
		if (s >= 128) n = n + 2;
		else n ++;
	}
	
	return n;
}

function isLength(str,min,max,Message1,Message2){
    var n = getLength(str);
	if(n==0){
		alert(Message1);
		return false  ;}
	if(n<min||n>max){
		alert(Message2);
		return false  ;}
    return true;
}


