
	var overrideFlag = false;

	function foo() {
	
	}

	function stateInit(flag) {
		
		window.overrideFlag = flag;
		
		var a1=new Image();
		a1.src='/admin/ui/form/input_submit_hover.gif';
		var a2=new Image();
		a2.src='/admin/ui/form/input_browse_hover.gif';
		
		var inputs = document.getElementsByTagName('input');
		var labels = document.getElementsByTagName('label');
		var textareas = document.getElementsByTagName('textarea');
		
		for(var i=0; i < inputs.length; i++) {
		
			if (inputs[i].className == 'text' || inputs[i].className == 'text short' || inputs[i].className == 'submit' || inputs[i].className == 'delete' || inputs[i].className == 'open') {
				
				if (inputs[i].disabled == true || inputs[i].readOnly == true) {
					
					inputs[i].style.border = '1px solid #888888';
					inputs[i].style.color  = '#444444';
					
				} else {
					
					inputs[i].onmouseover = stateHover;
					inputs[i].onmouseout  = stateNormal;
					inputs[i].onfocus     = stateFocus;
					inputs[i].onblur      = stateBlur;
					
				}
				
			}
			
		}
		
		for(var i=0; i < textareas.length; i++) {
			
			if (textareas[i].className == 'edit' || flag) {
			
				textareas[i].onmouseover = stateHover;
				textareas[i].onmouseout  = stateNormal;
				textareas[i].onfocus     = stateFocus;
				textareas[i].onblur      = stateBlur;
				
			}
			
		}
		
		for(var i=0; i < labels.length; i++) {
			
			labels[i].onmouseover = stateHover;
			labels[i].onmouseout  = stateNormal;
			
		}
		
	}
	
	function stateChange(id, cls) {
	
		obj = document.getElementById(id);
	
		if (cls=='hover') { 
		
			obj.style.color      = '#213D7E';
			obj.style.background = 'url(/admin/ui/form/input_browse_hover.gif)';
			
		} else {
		
			obj.style.color      = '#FFFFFF';
			obj.style.background = 'url(/admin/ui/form/input_browse.gif)';
			
		}
			
	}
	
	function stateHover() {
	
		if (this.className=='submit')	{
		
			this.style.color      = '#213D7E';
			this.style.background = 'url(/admin/ui/form/input_submit_hover.gif)';
			
		}
		
		if (this.className=='delete')	{
		
			this.style.color      = '#213D7E';
			this.style.background = 'url(/admin/ui/form/input_del_hover.gif)';
			
		}
		
		if (this.className=='open')	{
		
			this.style.color      = '#213D7E';
			this.style.background = 'url(/admin/ui/form/input_open_hover.gif)';
			
		}
		
		if (this.className=='edit') this.style.border = '1px solid #FF7E00';
		if (this.className=='text') this.style.border = '1px solid #FF7E00';
		if (this.tagName=='LABEL') {
		
			this.style.color  = '#FF7E00';
			this.style.textDecoration = 'underline';
			
		}

		this.state = 'hover'
		
	}
	
	function stateNormal() {

		if (this.className=='submit') {
		
			this.style.color      = '#FFFFFF';
			this.style.background = 'url(/admin/ui/form/input_submit.gif)';
			
		}
		
		if (this.className=='delete') {
			
			this.style.color      = '#FFFFFF';
			this.style.background = 'url(/admin/ui/form/input_del.gif)';
			
		}
		
		if (this.className=='open') {
			
			this.style.color      = '#FFFFFF';
			this.style.background = 'url(/admin/ui/form/input_open.gif)';
			
		}
		
		if (!this.focused) {
			
			if (this.className=='edit') this.style.border = '1px solid #213D7E';
			if (this.className=='text') this.style.border = '1px solid #213D7E';
			this.state = 'normal'
			
		}
		
		if (this.tagName=='LABEL') {
			
			this.style.color = '#213D7E';
			this.style.textDecoration = 'none';
			
		}
		
	}
	
	function stateFocus() {
	
		if (this.tagName == 'INPUT' && this.className == 'text')	this.style.border = '1px solid #FF7E00';
		if (this.tagName == 'TEXTAREA' && (this.className == 'edit' || overrideFlag))	this.style.border = '1px solid #FF7E00';
		this.state = 'focus'
		this.focused = true;
		
	}
	
	function stateBlur() {
		
		if (this.tagName == 'INPUT' && this.className == 'text')	this.style.border = '1px solid #213D7E';
		if (this.tagName == 'TEXTAREA' && (this.className == 'edit' || overrideFlag))	this.style.border = '1px solid #213D7E';
		this.state = 'normal'
		this.focused = false;
		
	}
	
