// Early station input text clearing script
(function(){
	
	FC.temp = {
		vars: {
			INITCLEAR: '',
			CURID: ''
		}
	};
	FS = {};
	FS.vars = {
		idAry: ["txtFrom", "txtTo", "train-from", "train-to", "stn", "station"]
	};
	FS.getElement = function(a){
		return document.getElementById(a)
	};
	FS.addEvent = function(c, b, a){
		if (c.attachEvent) {
			c["e" + b + a] = a;
			c[b + a] = function(){
				c["e" + b + a](window.event)
			};
			c.attachEvent("on" + b, c[b + a])
		}
		else {
			c.addEventListener(b, a, false)
		}
	};
	FS.removeEvent = function(c, b, a){
		if (c.detachEvent) {
			c.detachEvent("on" + b, c[b + a]);
			c[b + a] = null
		}
		else {
			c.removeEventListener(b, a, false)
		}
	};
	FS.overWrite = function(){
		this.value = "";
		FC.temp.vars.INITCLEAR = 'cleared';
		FC.temp.vars.CURID = this.id;
		FS.removeEvent(this, "focus", FS.overWrite);
	};
	FS.fnFocusClear = function(){
		var a;
		for (a = 0; a < FS.vars.idAry.length; a++) {
			if (FS.getElement(FS.vars.idAry[a])) {
				FS.addEvent(FS.getElement(FS.vars.idAry[a]), "focus", FS.overWrite)
			}
		}
	};
	FS.fnFocusClear();
})();
