String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
//----------------------------------------------------------
function CheckInputs()
{
	if (getObjById("strLoginname").value.trim() == ""){
		alert("Please enter a LOGIN name.");
		getObjById("strLoginname").value = "";
		getObjById("strLoginname").focus();
		return false;
	} else if (getObjById("strPassword").value.trim() == ""){
		alert("Please enter a PASSWORD.");
		getObjById("strPassword").value = "";
		getObjById("strPassword").focus();
		return false;
	} else {					
		return true;	
	}
};

//-----------------------------------------------------------
function changeBTN(){
	//if ((getObjById("strPassword").value.trim() != "") && (getObjById("strLoginname").value.trim() != ""))
		getObjById("tdbtnLogin").innerHTML="<input class='btnLogin' id='btnLogin' type='submit' name='btnLogin' value='GO'>";
};
//-----------------------------------------------------------
function replaceString(sString, sReplaceThis, sWithThis) {
    if (sReplaceThis != "" && sReplaceThis != sWithThis) {
      var counter = 0;
      var start = 0;
      var before = "";
      var after = "";
      while (counter<sString.length) {
        start = sString.indexOf(sReplaceThis, counter);
        if (start == -1){
         break;
         } else {
           before = sString.substr(0, start);
           after = sString.substr(start + sReplaceThis.length, sString.length);
           sString = before + sWithThis + after;
           counter = before.length + sWithThis.length;
          }
        }
      }
   return sString;
 };

//-----------------------------------------------------------
function getObjById(id)
{
	var obj;

	if (document.getElementById)
	{
		obj = document.getElementById(id);
	}
	else if (document.all)
	{
		obj = document.all[id];
	}
	else if (document.layers)
	{
		obj = document.layers[id];
	};

	return obj;
};

var currentCharacter;

function fCharacterPlus(d){

	if (typeof(currentCharacter)=='object' && typeof(currentCharacter.style)=='object') {
		if (currentCharacter.style.display=='block') {
			currentCharacter.style.display='none';
		} else {
			currentCharacter.style.display='block';
		}
	}
	if (typeof(d)=='object' && typeof(d.style)=='object'){
		if (d.style.display=='block') {
			d.style.display='none';
		} else {
			d.style.display='block';
		}
		currentCharacter = d;
		return false;
	}
}

function ExpandOrCollapse(o,p,m){
	if (typeof(o.style)=='object'){
		if (o.style.display=='block') {
			p.style.display='inline';
			m.style.display='none';
			o.style.display='none';
		} else {
			if (o.style.display=='none' || o.style.display=='') {
				p.style.display='none';
				m.style.display='inline';
				o.style.display='block';
			}
		}
	}
}
