var W3CDOM = (document.createElement && document.getElementsByTagName);

function initInputs(imgroot) {
	if (!W3CDOM) return;
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {	
	
	if (x[i].className == 'inputtext')
	{		
			if ( (x[i].type == 'text') || (x[i].type == 'password') ){				
				//x[i].id='inputS'+i;
				// functions for standard input boxes	
				x[i].onmouseout = function() { this.style.background  = "none";};
				x[i].onmouseover = function() { this.style.backgroundImage= 'url('+imgroot+'images/input_inner.gif)';};				
			}
	}
	}
}




function initFileUploads(imgroot) {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src=''+imgroot+'images/browse.gif';
	image.height="43";
	image.id='imgH1';
	fakeFileUpload.appendChild(image);
	//var img = document.getElementById('imgH1');
	
	
	var mouseOver;
	var mouseOver2;
	
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		// functions for hidden file input boxes		
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].id='inputHFile'; //alert(x[i].id);
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;		
			mouseOver = false;
			check();
		}
		x[i].onmouseover = function() {
			mouseOver= true;
			check();
		}
		//x[i].onmousedown = function() {
			//document.getElementById('inputH6').style.marginTop = '80px';
		//}
	}
	
	document.getElementById('imgH1').onmousedown = function() {
			//document.getElementById('inputHFile').click();
	}
	document.getElementById('imgH1').onmouseover = function() {
			mouseOver2 = true;
			check();
	}
	document.getElementById('imgH1').onmouseout = function() {
			mouseOver2 = false;			
			check();
	}	
	
	function check() {
		if(mouseOver2) {
				//document.getElementById('inputH6').style.marginTop = '5px';				
				document.getElementById('inputHFile').style.zIndex = '3';
				document.getElementById('inputHFile').style.visibility = "visible"; 
				document.getElementById('imgH1').src=''+imgroot+'images/browse3.gif';
		} else {
			if(mouseOver) {
				//document.getElementById('inputH6').style.marginTop = '5px';
				document.getElementById('inputHFile').style.zIndex = '3';
				document.getElementById('inputHFile').style.visibility = "visible"; 
				document.getElementById('imgH1').src=''+imgroot+'images/browse3.gif';
			} else {
				//document.getElementById('inputH6').style.marginTop = '55px';
				document.getElementById('inputHFile').style.zIndex = '1';
				document.getElementById('inputHFile').style.visibility = "hidden"; 
				document.getElementById('imgH1').src=''+imgroot+'images/browse.gif';
			}
		}
	}
}				

