function favorit(adresse,titel) {
	var adresse=window.location;
	var titel=document.title;
	var beschr = "Bär Aushub und Transport AG";
	if (document.all && !window.opera){ //IE5+
		window.external.AddFavorite(adresse,titel);}
	else if (window.opera){ //Opera
		document.write("<a href=\"" + adresse + "\" title=\"" + titel + "\" rel=\"sidebar\">" + beschr + "</a>");}
//	else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){ //Gecko
	else { //Gecko
		window.sidebar.addPanel(titel,adresse,"");}
}

 
 function kbaBig(el){
// <img src="bildname.jpg" kbaBig="left¦center¦right top¦center¦bottom">
// Grosses Bild muss Erweiterung von strBig haben: bildname_big.jpg
// **** todo: sollte auch von einer umgebenden DIV aus aufgerufen werden können ****
// **** todo: maxwidth und maxheight als Notfall-Vorgabe ****
	this.el=el;
	var obj=this;
	this.el.style.cursor='pointer';
	this.width=this.el.offsetWidth;
	this.height=this.el.offsetHeight;
	var aligns=this.el.getAttribute('kbaBig');
	aligns=aligns.split(' ');
	this.alignH=aligns[0];
	this.alignV=aligns[1];
	var elSrc=el.src;
	var arrSrc=elSrc.match(/(.*)\.(.{3})$/);
	var strBig='_big';
	var bigSrc=arrSrc[1]+strBig+'.'+arrSrc[2];
	this.big=new Image();
	this.big.src=bigSrc;
	with(this.big.style){
		top=0;left=0; //Bild oben links platzieren um keine Scrollbars zu erzeugen
		position='absolute';
		visibility='hidden';
	}
	d.body.appendChild(this.big);
	
	if(this.big.width!=0){
		obj.calcPosition.call(obj); //Opera erzeugt kein image.onload wenn Bilder bereits im Cache
	}

	this.el.onclick=function(){
//	this.el.onmouseover=function(){
		obj.calcPosition.call(obj); //Position nochmals berechnen, da inwischen ev. Scrollbars erzeugt wurden
		obj.big.style.visibility='visible';
	}
	this.big.onload=function(){ //Bildposition erst berechnen, wenn Bild geladen. Sonst wird die Grösse nicht erkannt
		obj.calcPosition.call(obj);
	}
	this.big.onmouseout=function(){
		obj.big.style.visibility='hidden';
	}
	this.big.onclick=function(){
		obj.big.style.visibility='hidden';
	}
}
kbaBig.prototype.calcPosition=function(){
	this.x=this.el.offsetLeft;
	this.y=this.el.offsetTop;
	var tmp=this.el;
	while(tmp=tmp.offsetParent){
		this.x+=tmp.offsetLeft;
		this.y+=tmp.offsetTop;
	}
	switch(this.alignH){
	case 'left':
		this.x=this.x
		break;
	case 'center':
		this.x=this.x-((this.big.width-this.width)/2);
		break;
	case 'right':
		this.x=this.x-(this.big.width-this.width);
		break;
	}
	switch(this.alignV){
	case 'top':
		this.y=this.y
		break;
	case 'center':
		this.y=this.y-((this.big.height-this.height)/2);
		break;
	case 'bottom':
		this.y=this.y-(this.big.height-this.height);
	}
	if(this.y<0){
		this.y=0;
	}
	this.big.style.left=this.x+'px';
	this.big.style.top=this.y+'px';
}
function appendKbaBig(){
	var el=d.getElementsByTagName('img');
	var i;
	for(i=0;i<el.length;i++){
		if(el[i].getAttribute('kbaBig')){
			el[i].kbaObj=new kbaBig(el[i]);
		}
	}
}
function init(){
	d=document;
	appendKbaBig();
}
window.onload=init;

