function SEOURL(strURL) {
	strURL = strURL.toLowerCase();
	strURL = strURL.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");
	strURL = strURL.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");
	strURL = strURL.replace(/ì|í|ị|ỉ|ĩ/g,"i");
	strURL = strURL.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");
	strURL = strURL.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");
	strURL = strURL.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");
	strURL = strURL.replace(/đ/g,"d");
	strURL = strURL.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"-");
	strURL = strURL.replace(/-+-/g,"-"); 
	strURL = strURL.replace(/^\-+|\-+$/g,"");
	return strURL;
} 
/////////////////////////////////////////////////////////////////////////////////////////////////
function confirmAction(strURL, strMessage){
	if(!confirm(strMessage)) return false;
	location.href = strURL;
	return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function selectAll(objForm){
	intTotal = objForm.chkTotal.value;
	for(intCount = 0; intCount < intTotal; intCount++){
		eval('chkNum = objForm.chk' + intCount);
		if(chkNum.checked)
			chkNum.checked = false;
		else
			chkNum.checked = true;
	}
	return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function checkSelect(objForm){
	intTotal = objForm.chkTotal.value;
	for(intCount = 0; intCount < intTotal; intCount++){
		eval('chkNum = objForm.chk' + intCount);
		if(chkNum.checked)
			return true;;
	}
	return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function ProperDelimiter(strValue) {
	strValue = strValue.replace("-", " - ");
	strValue = strValue.replace(",", ", ");
	strValue = strValue.replace(";", "; ");
	strValue = strValue.replace(":", ": ");
	strValue = strValue.replace(".", ". ");
	while(strValue.indexOf(" .") != -1)
		strValue = strValue.replace(" .", ". ");
	while(strValue.indexOf(" ,") != -1)
		strValue = strValue.replace(" ,", ", ");
	while(strValue.indexOf(" ;") != -1)
		strValue = strValue.replace(" ;", "; ");
	while(strValue.indexOf(" :") != -1)
		strValue = strValue.replace(" :", ": ");
	while(strValue.indexOf("  ") != -1)
		strValue = strValue.replace("  ", " ");
	return strValue
}

/////////////////////////////////////////////////////////////////////////////////////////////////
function ProperControl(strControlName){
	objControl = document.getElementById(strControlName);
	if(objControl == null){alert("Not found control: " + strControlName); return;}
	objControl.value = ProperValue(objControl.value);
}
/////////////////////////////////////////////////////////////////////////////////////////////////
function ProperValue(strValue){
    var i, str, lowers, uppers;
    str = strValue.replace(/\w\S*/g, function(txt) {
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    });
    lowers = ['A', 'An', 'The', 'And', 'But', 'Or', 'For', 'Nor', 'As', 'At', 
    'By', 'For', 'From', 'In', 'Into', 'Near', 'Of', 'On', 'Onto', 'To', 'With'];
    for (i = 0; i < lowers.length; i++)
        str = str.replace(new RegExp('\\s' + lowers[i] + '\\s', 'g'), 
            function(txt) {
                return txt.toLowerCase();
            });
    uppers = ['Id'];
    for (i = 0; i < uppers.length; i++)
        str = str.replace(new RegExp('\\b' + uppers[i] + '\\b', 'g'), 
            uppers[i].toUpperCase());

    return str;
}
function isWhitespace(charToCheck) {
	var whitespaceChars = " \t\n\r\f";
	return (whitespaceChars.indexOf(charToCheck) != -1);
}
function LTrim(strValue) { 
	for(var k = 0; k < strValue.length && isWhitespace(strValue.charAt(k)); k++);
	return strValue.substring(k, strValue.length);
}
function RTrim(strValue) {
	for(var j=strValue.length-1; j>=0 && isWhitespace(strValue.charAt(j)) ; j--) ;
	return strValue.substring(0,j+1);
}
function Trim(strValue) {
	return LTrim(RTrim(strValue));
}
////////////////////////////////////////////////////////////////////////////////
function IsEmpty(strValue){
	return (Trim(strValue).length== 0);
}

