/////////////////////////////////////////////////////////////////////////////////////////////////
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 SEOURL(strURL) {
	strURL = strURL.toLowerCase();
	strURL = strURL.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"-");
	strURL = strURL.replace(/-+-/g,"-"); 
	strURL = strURL.replace(/^\-+|\-+$/g,"");
	return strURL;
} 
/////////////////////////////////////////////////////////////////////////////////////////////////
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);
}
