function hideInputLabel(inputID) {
	var input = document.getElementById(inputID);			
	var inputParameters = input.alt.split(":");
	var inputFictionalType = trim(inputParameters[0]);
	var inputDefaultValue = trim(inputParameters[1]);

    if(inputFictionalType=="Password") {
		return changeInputType(input, 'password', 'Password', false, false);
    } else {
        if(trim(input.value).toLowerCase() == inputDefaultValue.toLowerCase()) {
		    input.value = '';
		}
    }

}

function showInputLabel(inputID) {
	var input = document.getElementById(inputID);			
	var inputParameters = input.alt.split(":");
	var inputFictionalType = trim(inputParameters[0]);
	var inputDefaultValue = trim(inputParameters[1]);
    if(inputFictionalType=="Password") {
		return changeInputType(input, 'password', inputDefaultValue, false, false);
	    
	} else {
        if(trim(input.value)=="") {
		    input.value = inputDefaultValue;
	    }
    }
}

// Set's the specified input to password onfocus, and return's its initial value and type onblur
//  see function members for info on usage
// ---------------------------------------------------------------------------------------------
// oldElement - reference to input element
// inputType - value of the type property: 'text' or 'password'
// inputValue - the default value, set to 'password' in the demo
// blankValue - true if the value should be empty, false otherwise
// nofocus - set to true if the element should not be given focus

function changeInputType(oldElement, inputType, inputValue, blankValue, noFocus) {
    
    if (!oldElement || !oldElement.parentNode || (inputType.length<4) || !document.getElementById || !document.createElement) return;
    
    var isMSIE = /*@cc_on!@*/false; //http://dean.edwards.name/weblog/2007/03/sniff/

    if(!isMSIE){
        var newElement = document.createElement('input');
        newElement.type = inputType;
    } else {
        var newElement = document.createElement('span');
        newElement.innerHTML = '<input type="' + inputType + '" name="' + oldElement.name + '">';
        newElement = newElement.firstChild;
    }
    var inputProperties = ['name','id','className','size','alt','tabIndex','accessKey'];
    
    /* Assigning properties to new Element */
    for(var i = 0; i < inputProperties.length; i++) {
        if(oldElement[inputProperties[i]]) newElement[inputProperties[i]] = oldElement[inputProperties[i]];
    }
    
    newElement.onfocus = function(){
        return function(){
            if(this.hasFocus) return;
            var newElement = changeInputType(this, 'password', inputValue, (this.value == inputValue)?true:false);
            if(newElement) newElement.hasFocus = true;
        }
    }();
    newElement.onblur = function(){
        return function(){
            if(this.hasFocus)
            if(trim(this.value)=='') {
                changeInputType(this, 'text', inputValue, false, true);
            }
        }
    }();
    
    // hasFocus is to prevent a loop where onfocus is triggered over and over again
    newElement.hasFocus = false;
    
    // some browsers need the value set before the element is added to the page
    // while others need it set after
    if(!blankValue) newElement.value=inputValue;
    oldElement.parentNode.replaceChild(newElement, oldElement);
    if(!isMSIE && !blankValue) newElement.value = inputValue;
    if(!noFocus || typeof(noFocus)=='undefined') {
        window.tempElement = newElement;
        window.tempElement.value = "";
        setTimeout("tempElement.hasFocus = true; tempElement.focus();", 1);
    }
    return newElement;
}



