
CustomSelect={
		init:function() {
			//console.log("init CustomSelect");
			//alert("init CustomSelect");
			$$("select.custom").each(function(item) {
				options=item.getElementsByTagName("option");
				textnode = options[0].innerHTML;
				var nbOptions=options.length;
				for (var i=0;i<nbOptions;i++) {
					if (options[i].selected == true) {
						textnode =options[i].innerHTML;
					}
				}

				var _parentDims=item.getDimensions();
				var _span=new Element("span",{"class":"rzselect","id":"select"+item.id,"style":"width:"+(_parentDims.width-26)+"px;margin-top:-"+_parentDims.height+"px;"}).update(textnode);

				item.parentNode.appendChild(_span);
				item.setStyle({"opacity":"0"});
				
				//item.onchange=CustomSelect.choose;
				item.observe("change",CustomSelect.choose);
				
			});
		},
		choose:function() {
			option = this.getElementsByTagName("option");
			for(d = 0; d < option.length; d++) {
				if(option[d].selected == true) {
					document.getElementById("select" + this.id).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
				}
			}
		}
		
		
}


document.observe("dom:loaded", function() {
	if (Prototype.Browser.Opera) {
		function initOpera(){
			CustomSelect.init();
		}
		initOpera.defer();
	} else {
		if (!Prototype.Browser.IE) {
			CustomSelect.init();
		}
	}
});
