// JavaScript Document

var bdkScript = {
	
	addListeners: function() {
		
		var txtMLLName = document.getElementById('mllName');
		rwScript.addEvent(txtMLLName, 'focus', bdkScript.getFocus(txtMLLName), false);
		rwScript.addEvent(txtMLLName, 'blur', bdkScript.getLoseFocus(txtMLLName), false);
		var txtMLLEmail = document.getElementById('mllEmail');
		rwScript.addEvent(txtMLLEmail, 'focus', bdkScript.getFocus(txtMLLEmail), false);
		rwScript.addEvent(txtMLLEmail, 'blur', bdkScript.getLoseFocus(txtMLLEmail), false);
		
	},
	
	applyFocus: function(e, targetElement) {
		var el = window.event ? targetElement : e ? e.currentTarget : null;
		if (!el) return;

		if ((el.id == "mllName" && el.value == "Name") || (el.id == "mllEmail" && el.value == "Email")) {
			el.value = "";
			el.style.color = "#000000";
		} else {
			el.style.color = "#000000";
		}
	},
	getFocus: function (node) { return function(e) { bdkScript.applyFocus(e, node); }; },
	
	loseFocus: function(e, targetElement) {
		var el = window.event ? targetElement : e ? e.currentTarget : null;
		if (!el) return;
		
		if (el.id =="mllName") {
			if (el.value == "") {
				el.style.color = "#aaaaaa";
				el.value = "Name";
			}
		} else if (el.id == "mllEmail") {
			if (el.value == "") {
				el.style.color = "#aaaaaa";
				el.value = "Email";
			}
		}
	},
	getLoseFocus: function (node) { return function(e) { bdkScript.loseFocus(e, node); }; },
	
	newWindowClick: function(e, targetElement) {
		var el = window.event ? targetElement : e ? e.currentTarget : null;
		if (!el) return;
		
		winEnlargement=window.open(el.href,'winEnlargement','toolbar=no,status=no,width=700,height=740');
		
		if (window.event) {
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}

		if (e && e.stopPropagation && e.preventDefault) {
			e.stopPropagation();
			e.preventDefault();
		}
	},
	getNewWindowClick: function (node) { return function(e) { bdkScript.newWindowClick(e, node); }; }

};

rwScript.addEvent(window, 'load', bdkScript.addListeners, false);
rwScript.addEvent(window, 'unload', EventCache.flush, false);