jQuery.fn.loadmain = function() {
	 $(this).bind("click", function(){
			$.get($(this).attr("lnk"), { solo: "true" },function(data){$("#id5").html(data);$(".list",$("#id5")).ajaxify();$("div.main").bilder();$("div.main").globlinx();});
			$.get($(this).attr("lnk"), { solo:"true", page: "GET /menue[template='/templates/topline.xslt']" },function(data){$("h2",$("#id4")).html(data);});
});};
jQuery.fn.ajaxify = function() {
	if($("#id0").html()==""){
		$("a", $(this)).each(function(){
			$(this).attr({lnk: $(this).attr("href")}).attr({href:"#main"}).loadmain();
                        
		});
		flashdetect();
	}
};
jQuery.fn.bilder2 = function() {
	$("img",$(this)).each(function(){
		$(this).css({cursor:"pointer"});
	});
};
jQuery.fn.bilder1 = function() {
	$("img",$(this)).each(function(){
		$(this).css({cursor:"pointer"});
		$(this).lightBox();
	});
};
jQuery.fn.globlinx = function() {
	$("a",$(this)).each(function(){
		if($(this).attr("href")!= null){
			var tmp = $(this).attr("href");
			tmp2 = tmp.split("ttp://");if(tmp2.length ==2 ){if(tmp2[0]=="h"){
			tmp4=tmp2[1];tmp3 = tmp4.split("paya");
			if(tmp3[0]!="pa")$(this).attr({target:"_blank"}).addClass("glob");}}
	}});
};
function flashdetect(){
	$('.media').each(function(){
		$(this).html("").flash({
			src: $(this).attr("href"),
			width: $(this).css("width"),
			height: $(this).css("height")
		});
		$(this).removeClass("media");
		$(this).addClass("flashbox");
	});
}
$("document").ready(function(){
$("#id3 p.link a span").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
		$('div.item').find(":first").each(function(){
			if(this.nodeName == "P")
				$(this).css({float:'left'});
		});


		var ort =  document.URL;
		ort = ort.split("/");		
		if( ort[ort.length-2]=="aktuelles"){
			if($("#id3 .termin").length>0)
{
			$('div.item h1' ).prepend("<strong>» "+$("#id3 .termin").html()+"</strong>&nbsp;");
}
else
{
$('div.item h1' ).prepend("<strong>»</strong>&nbsp;");

}
		}
		else{
			$('div.item h1' ).prepend("<strong>»</strong>&nbsp;");
		}	
				



		if( document.URL== "http://www.verkehrsakademie-muensterland.de/vam/de/klassen/uebersicht.html"){
			$("#id1 > a.media" ).replaceWith('<img src="/vam/web/babel/media/fahrschule_top.jpg"  style="width:1004;height:227px;" />');
		}
		//$("#id6").append("<span>"+document.URL+":</span>");
		flashdetect();
     		$('#menu1').superfish({pathClass:  'activ' });		
		if( document.URL== "http://www.verkehrsakademie-muensterland.de/vam/de/akademie/bildergalerie.html"){
			$("#id3 img").lightBox();
			 $("#id3").bilder2();
		}
		else
		{
			
			 $("#id3").bilder1();
		}

});
