function changeType(elementId, type){
    el=document.getElementById(elementId);

    if(el!=null){
        el.setAttribute('type',type);
    }
}

function hasPlaceholderSupport(){
    input = document.createElement('input');
    return ('placeholder' in input);
}

function addPlaceHolder(elementId, text){
    el=document.getElementById(elementId);

    if(el!=null){
        
        
        if(!hasPlaceholderSupport()){
            el.value=text;

            currentClass=el.className;
            if(currentClass == null){
                currentClass="";
            }
            el.className = currentClass + " placeholder";

            currentOnclick = el.getAttribute("onclick");
            currentOnclickIE = el.onclick;
            if(currentOnclick == null){
                currentOnclick="";
            }
            el.setAttribute("onclick",currentOnclick + " " + "removePlaceholder(this, '"+  text + "','"+ currentClass +"')");
            el.onclick=function(){ removePlaceholder(this, text, currentClass ) };
        }
        else{
            el.setAttribute('placeholder',text);
        }
    }
}

function removePlaceholder(el, text, classAttribute){
    if(el.value == text){
        el.value="";
        el.className= classAttribute;
    }
}



