// smx_gp: Skript zum Umgehen der fixen Breite von Drop-down-Boxen
// im IE.
// Benutzung: Einmal (z.B. in body.onload) ie_select_fix() aufrufen.

function ie_select_onmousedown(e) {
	s = e.srcElement;
	if(!s.opened) {
		s.oldwidth = s.style.width; 
		s.style.minWidth = s.oldwidth;
		s.style.width = 'auto';
		s.opened=1;
		s.opening=1;
	}
	return true;
}

function ie_select_onclick(e) {
	s = e.srcElement;
	if(s.opened) {
		if(s.opening) {
			s.opening=0;
		} else {
			s.style.width=s.oldwidth;
			s.opened=0;
		}
	}
	return false;
}

function ie_select_onblur(e) {
	s = e.srcElement;
	s.style.width = s.oldwidth;
	s.opened = 0;
}

function ie_select_fix() {
	ss = document.getElementsByTagName('select');
	for(i=0;i<ss.length;++i) {
		s = ss[i];
		s.opened = 0;
		s.attachEvent('onmousedown',ie_select_onmousedown);
		s.attachEvent('onclick',ie_select_onclick);
		s.attachEvent('onblur',ie_select_onblur);
	}
}


