/*//////////////////////////////////////////////////////////////////////////

	FOR GENERAL FUNCTIONS
	
///////////////////////////////////////////////////////////////////////////*/

/*function initLogin() {
	if (!document.getElementById) return;
	
	var usernameInput = document.getElementById('Username');
	var passwordInput = document.getElementById('Password');
	
	usernameInput.value = "username";
	usernameInput.onfocus = function() {
		this.value = "";
	}

	if (!window.attachEvent) {	
		passwordInput.type = "text";
		passwordInput.value = "password";
		
		passwordInput.onfocus = function() {
			this.value = "";
			this.type = "password";
		}
	}
}*/

function changeInputType(oldElm,iType,iValue, noFocus, endType) {
  if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
    !document.getElementById || !document.createElement) return;
  var newElm = document.createElement('input');
  newElm.type = iType;
  if(oldElm.name) newElm.name = oldElm.name;
  if(oldElm.id) newElm.id = oldElm.id;
  newElm.onfocus = function() {
    if(this.hasFocus) return;
    var newElm = changeInputType(this,endType,
      (this.value.toLowerCase()==iValue)?'':this.value);
    if(newElm) newElm.hasFocus=true;
  }
  
 // hasFocus is to prevent a loop where onfocus is triggered over and over again
  newElm.hasFocus=false;
  oldElm.parentNode.replaceChild(newElm,oldElm);
  if(iValue) newElm.value = iValue;
  if(!noFocus || typeof(noFocus)=='undefined') {
    window.tempElm = newElm;
    setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
  }
  return newElm;
}

/*//////////////////////////////////////////////////////////////////////////

	INTITIALIZE DOCUMENT


///////////////////////////////////////////////////////////////////////////*/

window.onload = function() {
  // Example 2
  // Normally I use object detection, however, in this case since I need to 
  // detect Konqueror and Safari which don't have unique objects,
  // I will use the user agent string to detect them. Only use this type of 
  // detection as a last resort.
  // I'm doing this because example 2 crashes Konqueror and Safari and 
  // generates errors in IE5/Mac

  var ua = navigator.userAgent.toLowerCase();
  if(!((ua.indexOf('konqueror')!=-1) && (document.all || 
    (ua.indexOf('khtml/3.4')!=-1))) && !(((ua.indexOf('safari')!=-1) && 
    !window.print) || (document.defaultCharset && !window.print)))
      changeInputType(document.forms[0].Password,'text','password',true,'password');
      changeInputType(document.forms[0].Username,'text','username',true,'text');
}