var flag=0;
var flag2=0;
var maxDiv="476";
function schliessen(){galContainer.innerHTML=""
}function galerie(B){var A="";
if(B.indexOf("_gross")>0){A='style="width: 474px;" '
}if((B.indexOf("_medium")>0)||(B.indexOf("_gross")>0)){varTmp=B.substring(B.lastIndexOf("/")+1,B.length).substring(0,B.substring(B.lastIndexOf("/")+1,B.length).lastIndexOf("_"))
}else{varTmp=B.substring(B.lastIndexOf("/")+1,B.length).substring(0,B.substring(B.lastIndexOf("/")+1,B.length).lastIndexOf("."))
}galContainer=document.getElementById("galerieContainer");
galContainer.innerHTML='<a href="#" onclick="schliessen(); return false;" title="Bild schliessen/Close image"><img id="newImage" '+A+'src="'+B+'" /></a><p>'+bildText[varTmp]+"</p>";
window.scrollBy(0,50)
}function fTimer(){if(load_img.complete){window.clearInterval(timerid);
flag2=1;
var A=document.getElementById("ajaxloader");
container.removeChild(A);
BildGross()
}}function Vergroessern(){img=document.getElementById("bildInText");
container=document.getElementById("bildbox");
link=document.getElementById("bildLink");
text=document.getElementById("langText");
if(flag==0){bildklein=img.src;
breite=img.width;
hoehe=img.height;
originalText=text.innerHTML;
bildTitle=link.title;
flag++
}load_img=new Image();
load_img.src=link.href;
if(flag2==0){var A=document.createElement("img");
A.src="http://www.rhein-kreis-neuss.de/includes/images/ajax-loader.gif";
A.className="ajaxloader";
A.id="ajaxloader";
container.appendChild(A);
timerid=setInterval("fTimer()",200)
}else{BildGross()
}}function BildGross(){var A=link.href.substring(link.href.lastIndexOf("/")+1,link.href.length);
if(img.src.indexOf("_medium.")==-1&&img.src.indexOf("_gross.")==-1){gBreite=load_img.width;
gHoehe=load_img.height;
if(gBreite==0){if(img.width>img.height){gBreite="476";
gHoehe="317"
}else{gBreite="317";
gHoehe="476"
}}else{if(gBreite>maxDiv){if(gBreite>gHoehe){gBreite="476";
gHoehe="317"
}else{gBreite="317";
gHoehe="476"
}}}link.title=grossTitle;
img.src=link.href;
img.style.width=gBreite+"px";
img.style.height=gHoehe+"px";
container.style.width=maxDiv+"px";
container.style.maxWidth=maxDiv+"px";
if(langText==""){text.innerHTML=originalText+copyright
}else{text.innerHTML=langText+copyright
}}else{img.src=bildklein;
img.style.width=breite+"px";
img.style.height=hoehe+"px";
container.style.width=img.width+"px";
container.style.maxWidth=img.width+"px";
text.innerHTML=originalText;
link.title=bildTitle;
originalText="";
flag=0
}};

this.tooltip = function(){	
		xOffset = 10;
		yOffset = 20;		
	$("a.tooltip").hover(function(e){	
		varWert = $(this).attr("class").substring(0,$(this).attr("class").indexOf(" "));
		this.t = $("span[id='" + varWert + "']").text(); 
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	tooltip();
});