
function mkEl(n,a,c){var e=mkAt(document.createElement(n),a);
 if(def(c))if(!def(c.length))e.appendChild(c);else for(var i=0;i<c.length;)e.appendChild(c[i++]);return e;
}
function def(e){return typeof e!='undefined';}
function mkAt(e,a){for(var k in a)e.setAttribute(k,a[k]);return e;}
function getEl(i,a){return mkAt(document.getElementById(i),a)}
var Gallery = {
	init:function(){
		var g; g = document.getElementById?document.getElementById('pbcpic'):g;
		if (g){
			g.getElementsByTagName('img')[0].onclick=Gallery._show;
		}
		return false;
	},
	_show:function (e){
		Milkbox.setOptions({autoPlay:true, autoPlayDelay:5});
		return false;
	}
};
function pb(){
 var cl='Button zum Rollen nach links';var cr='Button zum Rollen nach rechts';var p1='/pics/p1.gif';
 if(!def(document.getElementById))return false;
 var pb=getEl('pb');if(!pb)return false;if(pb.className=='vertical'){pbv();return false}var p=pb.getElementsByTagName('img');
 var tr=mkEl('tr');for(var i=0;i<p.length;)tr.appendChild(mkEl('td',{'class':'pbimg'},p[i++].cloneNode(false)));
 while(p.length>0)pb.removeChild(p[0]);
 pb.appendChild(
	mkEl('table',{'id':'pbc'},
		mkEl('tr',{},
			new Array(
				mkEl('td',{'id':'pbl','class':'inactive'},mkEl('img',{'dir':'ltr','src':p1,'alt':cl,'title':cl})),
				mkEl('td',{'id':'pbm'},mkEl('div',{},mkEl('table',{'id':'pbi'},tr))),
				mkEl('td',{'id':'pbr','class':'active'},mkEl('img',{'dir':'rtl','src':p1,'alt':cr,'title':cr}))
			)
		)
	)
 );
 getEl('pbr').getElementsByTagName('img')[0].onmouseover = rotate;
 getEl('pbl').getElementsByTagName('img')[0].onmouseover = rotate;
 getEl('pbr').getElementsByTagName('img')[0].onclick = rotate;
 getEl('pbl').getElementsByTagName('img')[0].onclick = rotate;
 return true;
}
function pbv(){
 var cu='Button zum Rollen nach oben';var cd='Button zum Rollen nach unten';var p1='/pics/p1.gif';
 if(!def(document.getElementById))return false;
 var pb=getEl('pb');if(!pb)return false;var p=pb.getElementsByTagName('img');
 var tab=mkEl('table',{'id':'pbi'});for(var i=0;i<p.length;)tab.appendChild(mkEl('tr',{},mkEl('td',{'class':'pbimg'},p[i++].cloneNode(false))));
 if(typeof Array.push == 'undefined')Array.prototype.push=function(e){this[this.length]=e;};
 img=new Array();
 while(p.length>0){img.push(p[0].src.replace(/.jpg$/,pb.getAttribute('name')+'.jpg'));pb.removeChild(p[0]);}
 pb.appendChild(
	mkEl('table',{'id':'pbc','class':'vertical'},
		new Array(
			mkEl('tr',{},mkEl('td',{'id':'pbu','class':'inactive'},mkEl('img',{'dir':'up','src':p1,'alt':cu,'title':cu}))),
			mkEl('tr',{},mkEl('td',{'id':'pbm'},mkEl('div',{},tab))),
			mkEl('tr',{},mkEl('td',{'id':'pbd','class':'active'},mkEl('img',{'dir':'down','src':p1,'alt':cd,'title':cd})))		
		)
	)
 );
 var mbox=new Array(mkEl('a',{title:'','class':'mbox pic0',href:img[0],rel:'milkbox'},mkEl('img',{'src':img[0],'alt':'','title':''})));
 for(var i=1;i<img.length;i++)mbox.push(mkEl('a',{title:'','class':'mbox pic'+i,href:img[i],rel:'milkbox'}));
 pb.appendChild(mkEl('div',{'id':'pbcpic'},mbox));
 pb.appendChild(mkEl('br',{'clear':'all'}));
 getEl('pbd').getElementsByTagName('img')[0].onmouseover = vrotate;
 getEl('pbu').getElementsByTagName('img')[0].onmouseover = vrotate;
 getEl('pbd').getElementsByTagName('img')[0].onclick = vrotate;
 getEl('pbu').getElementsByTagName('img')[0].onclick = vrotate;
 Gallery.init();
 return true;
}
function style(e){return (e.currentStyle)?e.currentStyle:document.defaultView.getComputedStyle(e,"");}
function rotate(o){
 var e=o||window.event;
 var pb=e.target.parentNode;
 if(!def(pb)||pb.getAttribute('class')!='active')return false;
 getEl('pbl',{'class':'inactive'});getEl('pbr',{'class':'inactive'});
 var sti=style(getEl('pbi'));var stm=style(getEl('pbm'));
 window.setTimeout(	"pbshift("+(e.target.getAttribute('dir')=='rtl'?-1:1)+","+parseInt(sti.left)+","+(parseInt(sti.width)-parseInt(stm.width)+1)+")",25);
 return true;
}
function vrotate(o){
 var e=o||window.event;
 var pb=e.target.parentNode;
 if(!def(pb)||pb.getAttribute('class')!='active')return false;
 getEl('pbu',{'class':'inactive'});getEl('pbd',{'class':'inactive'});
 var sti=style(getEl('pbi'));var stm=style(getEl('pbm'));
 window.setTimeout(	"pbvshift("+(e.target.getAttribute('dir')=='down'?-1:1)+","+parseInt(sti.top)+","+(getEl('pbi').getElementsByTagName('tr').length*80-parseInt(stm.height)+1)+")",25);
 return true;
}
function pbshift(s,l,w){
 var p=l+4*s;getEl('pbi').style.left=p+'px';
 if(p%120!=0&&p>=-w)window.setTimeout("pbshift("+s+","+p+","+w+")",20);else
 {if(p<0)getEl('pbl',{'class':'active'});if(p>=-w)getEl('pbr',{'class':'active'});}
 return true;
}
function pbvshift(s,l,w){
 var p=l+4*s;getEl('pbi').style.top=p+'px';
 if(p%80!=0&&p>=-w)window.setTimeout("pbvshift("+s+","+p+","+w+")",25);else
 {if(p<0)getEl('pbu',{'class':'active'});if(p>=-w)getEl('pbd',{'class':'active'});}
 return true;
}
function lt(){var o=getEl('ticker');if(o){o.style.display='block';
 var t=o.innerHTML;t=t.substring(1,t.length)+t.substring (0,1);o.innerHTML=t;
 setTimeout("lt()",250);}
}
function addLoadEvent(f){var o=window.onload;window.onload=(typeof o!='function')?f:function(){o();f();}}
window.addLoadEvent(lt);
window.addLoadEvent(pb);
 
