// JavaScript Document
//Define the Ajax Gateway URL
var ajax_url = 'Tech/Gateway.inc.php'

/*************************************************************
* The womOn() function will set the window.onload function to
* be womGo() which will run all of your window.onload
* functions.
*************************************************************/
function womOn(){
  window.onload = womGo;
}
/*************************************************************
* The womGo() function loops through the woms array and
* runs each function in the array.
*************************************************************/
function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}
/*************************************************************
* The womAdd() function will add another function to the woms
* array to be run when the page loads.
*************************************************************/
function womAdd(func){
  woms[woms.length] = func;
}
/*************************************************************
* The woms array holds all of the functions you wish to run
* when the page loads.
*************************************************************/
var woms = new Array();


//Login Controller to assign Input Methods
function LoginController () {
	this.attachAction ()
}
	LoginController.prototype.attachAction = function () {
		document.LoginForm.User_Email.onclick = function () {
			if (this.value == 'Email') {
				this.value = ''
			}
		}
		document.LoginForm.User_Email.onblur = function () {
			if (this.value == '') {
				this.value = 'Email'
			}
		}
		
		//onfocus need method 
		document.LoginForm.User_Pass.onfocus = function () {
		if (this.value == 'Password') {
				this.value = ''
				this.setAttribute('type', 'Password')
			}
		}
		document.LoginForm.User_Pass.onclick = function () {
			if (this.value == 'Password') {
				this.value = ''
				this.setAttribute('type', 'Password')
			}
		}
		document.LoginForm.User_Pass.onblur = function () {
			if (this.value == '') {
				this.setAttribute('type', 'Text')
				this.value = 'Password'
			}
		}
	}
//Login Form Validity Check Upon Submition
function ValidateLogin (that) {
var Validity = true
var Error = ''
if (that.User_Email.value == 'Email' || that.User_Pass.value == 'Password') {
	Validity = false
	document.getElementById('UserControl').innerHTML += '<br /><br />Please fill in the missing fields'
}
return Validity
}
//Remove a DOM Object with a fade out / shrink
function FadeRemove (ObjId) {
	IntervalId = 0
	Opacity = 70
	IntervalId = setInterval('Fade(\'' + ObjId + '\')', 125) 
}
	function Fade (ObjId) {
		this.Obj = document.getElementById(ObjId)
		/*
		if (navigator.appName.indexOf("Netscape")!=-1 &&parseInt(navigator.appVersion) >= 5) {
			this.Obj.style.MozOpacity = Opacity / 100
		} else if (navigator.appName.indexOf("Microsoft")!= -1 &&parseInt(navigator.appVersion) >= 4) {
			this.Obj.filters.alpha.opacity = Opacity
		}
		*/
		this.Obj.style.opacity = Opacity / 100
		Opacity = Opacity - 10
		if (Opacity == 0) {
			clearInterval(IntervalId)
			RemoveObj(ObjId)
		}
	}
	function RemoveObj (ObjId) {
		IntervalId = 0
		IntervalId = setInterval('HideObject(\'' + ObjId + '\')', 50) 
	}
		function HideObject (ObjId) {
			this.Obj = document.getElementById(ObjId)
			this.Obj.style.height = (this.Obj.offsetHeight - 30) + 'px'
			if (parseInt(this.Obj.offsetHeight) < 30) {
				clearInterval(IntervalId)
				this.Obj.parentNode.removeChild(this.Obj)
			}
		}