var pl_select;
function U(au,aw,ap,ai,aj,ah,Z,ac,D,G){
	av=this;
	this.ax=au;
	this.f=aw;
	this.O=ap;
	this.A=ai;
	this.P=aj;
	this.J=ah;
	this.w=Z;
	this.R=ac;
	this.L=D;
	this.o=G;
	this.n=false;
	this.r=document.getElementById(this.f);
	this.Q=false;
	this.at=function(){
		this.r.style.display="none";
		B=document.getElementById(this.f+'_box');
		B.innerHTML+='<input readonly="readonly" id="'+this.f+'_text" name="'+this.f+'_text" type="text" value="" class="'+this.J+'" />';
		B.innerHTML+='<img id="'+this.f+'_arrow" class="'+this.P+'" src="'+this.A+'" title="Click to Select" /><div id="'+this.f+'_optionDiv" class="'+this.w+'" ></div>';
		this.r=document.getElementById(this.f);
		};


	this.F=function(){
		C=this.r.options;
		v='';
		for(j=0;j<C.length;j++){
			if(C[j].selected==true){
				v+=C[j].innerHTML+',';
			}
		}
		if(v==''){
		  if(pl_select)
		  {
		    this.t.value='Bitte auswählen';
      }
      else
      {
        this.t.value='    Alle';
      }			
		}else{
			this.t.value=v;
		}
		};
		this.K=function(){
			ar=document.body.offsetTop;
			ab=document.body.offsetLeft;
			if(this.n==false){
				this.n=true;
				this.d.style.top=aa(this.t)+this.t.offsetHeight+'px';
				this.d.style.left=Y(this.B)+ab+'px';
				this.d.style.display='block';
				this.F();
			}else{
				this.al();
			}
		};
				
		this.al=function(){
			this.n=false;
			this.d.style.top= -2000+'px';
			this.d.style.left= -2000+'px';
			this.d.style.display='none';
			};
			this.T=function(){
				C=this.r.options;
				this.d=document.getElementById(this.f+'_optionDiv');
				this.d.style.width=this.t.scrollWidth+this.l.width+'px';
				v='<iframe id="'+this.f+'_frame_in" style="width:100px;height:'+C.length*20+'px;z-index:-1;position:absolute;" frameborder="0" src=""></iframe><table id="'+this.f+'_table" cellpadding="0" cellspacing="0" border="0" width="100%" >';
				for(j=0;j<C.length;j++){
					if(C[j].selected==true){
						v+='<tr class="row"><td id="'+this.f+'_td_'+j+'" nowrap class="'+this.o+'"><input type="checkbox" id="'+this.f+'_zahmaci_'+j+'" checked>'+C[j].innerHTML+'</td></tr>';
					}else{
						v+='<tr class="row"><td id="'+this.f+'_td_'+j+'" nowrap class="'+this.R+'"><input type="checkbox" id="'+this.f+'_zahmaci_'+j+'">'+C[j].innerHTML+'</td></tr>';
					}
			}

			v+='</table>';
			this.d.innerHTML=v;
			this.d.style.display='block';
			this.I=document.getElementById(this.f+'_table');
			if(this.I.scrollWidth>parseInt(this.d.style.width)){
				this.d.style.width=this.I.scrollWidth+'px';
			}
			this.d.style.height=this.I.scrollHeight+'px';
			as=this;
			};

			
			this.X=function(j){
				if(this.r.options[j].selected==true){

					if(this.r.options[j].value=='zahmaci'){
						for(var z=0;z<this.r.length;z++){
							this.r.options[z].selected=false;
							document.getElementById(this.f+'_zahmaci_'+z).checked=false;
							this.e[z].className=ac;
						}
					}

					this.r.options[j].selected=false;
					document.getElementById(this.f+'_zahmaci_'+j).checked=false;//alert(j+" --- ");
				}else{
					if(this.r.options[j].value=='zahmaci'){
						for(var z=0;z<this.r.length;z++){
							this.r.options[z].selected=true;
							document.getElementById(this.f+'_zahmaci_'+z).checked=true;
							this.e[z].className=G;
						}
					}
					this.r.options[j].selected=true;
					document.getElementById(this.f+'_zahmaci_'+j).checked=true;
				}
			this.F();
			};
			this.H=function(index,ao){
				if(this.r.options[index].selected==true){
					this.e[index].className=G;

				}else{
					if(ao=="selected"){
						this.e[index].className=D;
					}else if(ao=="hover"){
						this.e[index].className=D;
					}else{
						this.e[index].className=ac;
					}
				}
				this.e[index].refresh;
				}
			};
			
			function af(g){
				c[g].l.onclick=function(){
				c[g].K();
				};
				c[g].l.onmouseover=function(){
					c[g].l.src=c[g].O;
				};
				
				c[g].l.onmouseout=function(){
					c[g].l.src=c[g].A;
				};
				c[g].B.onclick=function(ay){
					c[g].Q=true;
				};

				for(k=0;k<c[g].r.options.length;k++){
					c[g].e[k]=document.getElementById(c[g].f+'_td_'+k);
				
				eval('c['+g+'].e['+k+'].onclick = function(){ c['+g+'].X( '+k+' ); c['+g+'].H( '+k+',\'selected\' ); }');
				eval('c['+g+'].e[ '+k+'].onmouseover = function(){  c['+g+'].H('+k+', \'hover\' ); }');
				eval('c['+g+'].e[ '+k+'].onmouseout = function(){  c['+g+'].H( '+k+', \'normal\' ); }');
				
				}
				
				};
				
				function aa(am){
					V=am;ag=am.offsetTop;
					while(V.offsetParent!=null){
						V=V.offsetParent;
						ag+=V.offsetTop;
						}
					return ag;
				};
				
				function Y(an){
					M=an;ad=an.offsetLeft;
					while(M.offsetParent!=null&&M.offsetParent.tagName!='BODY'){
						M=M.offsetParent;ad+=M.offsetLeft;
					}
					return ad;
				};
				
				function az(){};
				c=Array();
				function Init(ak,O,A,P,J,w,R,L,o){
					c[c.length]=new U(c.length,ak,O,A,P,J,w,R,L,o);
					c[c.length-1].at();
					c[c.length-1].B=document.getElementById(c[c.length-1].f+'_box');
					c[c.length-1].t=document.getElementById(c[c.length-1].f+'_text');
					c[c.length-1].l=document.getElementById(c[c.length-1].f+'_arrow');
					c[c.length-1].d=document.getElementById(c[c.length-1].f+'_optionDiv');
					c[c.length-1].e=new Array();
					c[c.length-1].F();
					c[c.length-1].T();
					af(c.length-1);
				};
					
				function aq(){
					for(m=0;m<c.length;m++){
						if(c[m].Q==false){
							c[m].al();
						}
					c[m].Q=false;
					}
				};
				
				function ae(){
					for(m=0;m<c.length;m++){
						if(c[m].n==true){
							c[m].al();
							c[m].K();
						}
					}
				};
				function hz(obj){

					alert(obj);
				}
document.onclick=aq;
window.onresize=ae; 

