/*
	By Aien (aien@pixl8.co.uk). Last modified at 11th March 2008.

	Pass this line into the form.cfc for the particular input:

		stTemp.extendedAttribute = 'onFocus="selectExpand(this)" onBlur="selectNormal(this)"
		
	Insert this ONCE into the page:
	
	<script type="text/javascript" src="/inc/js/ie-select-width.js"></script>
*/

if (navigator.appName == 'Microsoft Internet Explorer') bIsIE = true;
else bIsIE = false;

//bIsIE = true;

var aObj_id = new Array();
var iWidth	= new Array();

function selectExpand(obj) {
	var iNumber = getPosition(obj.id);									
	if (bIsIE) {
		iWidth[iNumber]		= obj.style.width;
		obj.style.position	= 'absolute';
		//obj.style.left		= '0';
		obj.style.width		= 'auto';
	}
}		
function selectNormal(obj) {
	var iNumber = getPosition(obj.id);
	
	if (bIsIE) {
		obj.style.width		= iWidth[iNumber];
		obj.style.position	= 'static';
	}
}

function getPosition(obj_id) {
	if (aObj_id.length == 0) {
		aObj_id[0] = obj_id;
		return 0;
	}
	else if (aObj_id.length > -1) {
		for (var i=0; i<aObj_id.length; i++) {
			if (aObj_id[i] == obj_id) return i;
		}
		aObj_id[aObj_id.length-1] = obj_id;
		return aObj_id.length-1;
	}
}
