
/*-----------------------------------------------
'	Company: MassMedia Studios (www.massmedia.com.au)
'	Copyright © 2006, All rights reserved.
'	Date Created: March 2006
'
'	Last Modified Date: 27th March, 2006
'	Last Modified By: Helen -> helen@massmedia.com.au
'
'	DO NOT MODIFY THIS DOCUMENT WITHOUT
'	NOTIFYING THE AUTHOR FIRST
'
------------------------------------------------*/

function dom_browser() {
	// browser identification based on dom capabilities
	this.myNav = this.navigator;
	this.version = this.navigator.appVersion;
	this.name = this.navigator.appName;
	this.userAgt = this.navigator.userAgent;
	this.ns4 = (document.layers) ? true : false;
	this.ns6 = (this.navigator.userAgent.indexOf("Netscape6") != -1) ? true : false;
	this.dom = (document.getElementById) ? true : false;
	this.ie4 = (document.all) ? true : false;
	this.mac = (this.version.indexOf("Mac") != -1) ? true : false;
	this.ie = (this.version.indexOf("MSIE") != -1) ? true : false;
	this.windows = (this.version.indexOf("Windows") != -1) ? true : false;
	this.hasPlugins = (this.navigator.plugins) ? true : false;
	this.ie6 = (this.version.indexOf("MSIE 6.0") != -1) ? true : false; 
	
	this.ie55 = (this.version.indexOf("MSIE 5.5") != -1) ? true : false;
	this.ie5 = (this.version.indexOf("MSIE 5.01") != -1) ? true : false;
	this.ns = (this.userAgt.indexOf("Netscape") != -1) ? true : false;
	this.ff = (this.userAgt.indexOf("Firefox") != -1) ? true : false;
	this.safari = (this.userAgt.indexOf("Safari") != -1) ? true : false;
}

dom_browser();

function setValue(myObj) { // when users click on user and keyword fields, default text disappears
	if(myObj.value == "user" || myObj.value == "keyword") {
		myObj.value = "";
	}
}

function checkValue(myObj,defaultValue) { // if user has not entered any value, default value is restored
	if(myObj.value == "") {
		myObj.value = defaultValue;
	}
}

function setPwdType(myObj) { // changing the default text input for password to a input of type password
	//if(mac && ie) {
		if(myObj.type == "text") {
			document.forms[0].txtPwd.className = "hide";
			document.forms[0].wucHeader_txtPassword.className = "show";
			var tempElem = document.forms[0].wucHeader_txtPassword;
			tempElem.focus();
		}else if(myObj.value == "") {
			document.forms[0].wucHeader_txtPassword.className = "hide";
			document.forms[0].txtPwd.className = "show";
		} else {
			// do nothing
		}
	/*} else {
		if(myObj.type == "text") { // must be fake input type=text field (onfocus check)
			
			var newElem = document.createElement("input");
			newElem.setAttribute("id","txtPwd");
			newElem.setAttribute("name","txtPwd");
			newElem.setAttribute("type","password");
			newElem.onblur = function() {
				setPwdType(this);
			}
			
			var oldElem = myObj;
			oldElem.parentNode.replaceChild(newElem,oldElem);
			
			var myElement = document.forms[0].txtPwd;
			for(var i=0; i < 5; i++) { // attempt to set focus 5 times (hack for IE)
				myElement.focus();
			}
			
		} else if(myObj.value == "") { // must be password field with no data entered (onblur check)
			var newElem = document.createElement("input");
			newElem.setAttribute("type","text");
			newElem.setAttribute("id","txtPassword");
			newElem.setAttribute("name","txtPassword");
			newElem.setAttribute("value","password");
			newElem.onfocus = function() {
				setPwdType(this);
			}
			
			var oldElem = myObj;
			oldElem.parentNode.replaceChild(newElem,oldElem);
			
		} else {
			// do nothing
		}
	}*/
}




