	
function initCustomsel(){
	
		ACTIVESELECT=false;
	
		var sels=getCn('customsel');
		
		for(var i=0;i<sels.length;i++){
		
			sels[i].style.visibility='hidden';
		
			/* create the parts of the custom select object */
			var dsp=document.createElement('DIV');
			var btn=document.createElement('DIV');
			var lst=document.createElement('DIV');
			
			/* get the option items of the original select */
			var  items=getTn('OPTION',sels[i]);
			
			/* set the head of the custom select */
			dsp.className='csDisplay';
			dsp.innerHTML='<span></span>';
			with(dsp.style){
				position='absolute';
				width=sels[i].offsetWidth+'px';
				left=sels[i].offsetLeft+'px';
				top=sels[i].offsetTop+'px';
				overflow='hidden';
			};
			sels[i].parentNode.appendChild(dsp);
			
			
			/* set the button of the custom select */
			btn.className='csButton';
			btn.lst=lst;
			btn.opn=false;
			with(btn.style){
				position='absolute';
				height='100%';
				top='0px';
				right='0px';
			};
			btn.onmousedown=function(){
				switch(this.opn){
					case false: with(this.lst){style.display='block'; style.zIndex=1000; parentNode.style.zIndex=1000;} this.opn=true; break;
					case true:  with(this.lst){style.display='none'; style.zIndex=1; parentNode.style.zIndex=1;} this.opn=false; break;
				}
			};
			btn.onmouseover=function(){ACTIVESELECT=this; this.className='csButton_hover'};
			btn.onmouseout=function(){ACTIVESELECT=false; this.className='csButton'};
			dsp.appendChild(btn);
			
			/* set the option field of the custom select */
			lst.className='csList';
			with(lst.style){
				position='absolute';
				top=dsp.offsetHeight+dsp.offsetTop+'px';
				left=dsp.offsetLeft+'px';
				visibility='hidden';
			};
			
			/* set the option items of the custom select */
			for(var j=0;j<items.length;j++){
				
				if(items[j].selected==true)getTn('SPAN',dsp)[0].innerHTML=items[j].innerHTML;
				
				var item=document.createElement('DIV');
				item.className='csOptions';
				item.style.cursor='default';
				item.innerHTML=items[j].innerHTML+'&nbsp;';
				item.str=items[j].innerHTML;
				item.lst=items;
				item.dsp=dsp;
				item.onmousedown=function(){
					for(var k=0;k<this.lst.length;k++){
						if(this.lst[k].innerHTML!=this.str) this.lst[k].selected=false;
						else{this.lst[k].selected=true; getTn('SPAN',this.dsp)[0].innerHTML=this.innerHTML}		
					}	
				};
				item.onmouseover=function(){this.className='csOptions_hover'};
				item.onmouseout=function(){this.className='csOptions'};

				lst.appendChild(item);
			};
			sels[i].parentNode.appendChild(lst);
		
			/* set the width of the items - for IE */
			if(lst.offsetWidth<dsp.offsetWidth)lst.style.width=dsp.offsetWidth-2+'px';
			var setW=getTn('DIV',lst); var W=lst.offsetWidth; 
			for(var j=0;j<setW.length;j++){ setW[j].style.width=W-2+'px';}
			lst.style.visibility='visible'; lst.style.display='none';
		};
		
		document.body.onmousedown=function(){
			
			var obj=getCn('csButton');
			
			for(var i=0;i<obj.length;i++){
				if(obj[i]!=ACTIVESELECT){
					with(obj[i].lst){
						style.display='none';
						style.zIndex=1;
						parentNode.style.zIndex=1;
					}
					obj[i].opn=false;
				}
			}
		}
	}
	
	

/* getters by rudo */
function getId(trg){
	return document.getElementById(trg);
}

function getTn(name_,parent_){
	if(typeof(parent_)=='undefined') parent_=document;
	return parent_.getElementsByTagName(name_);
}

function getCn(name_,parent_){
	if(typeof(parent_)=='undefined') parent_=document;
	var ndsArray=new Array();
	var nds=parent_.getElementsByTagName('*');
	var cnt=0;
	for(var i=0;i<nds.length;i++){
		if(nds[i].className==name_){
			ndsArray[cnt]=nds[i];
			cnt++;
		}
	}
	return ndsArray;
}	