// JavaScript Document
$(document).ready( function() {
////	
	
	//$("img.imgholder").lazyload();
	
	function ImgLazyLoadInit(){
		//aufruf bei seitenstart
		///news
		//LazyLoad
		var img_data_original=$('#contblogmover div:first img').attr('data-original');		
		var img_src=$('#contblogmover div:first img').attr('src');
		$('#contblogmover div:first img').attr('src', img_data_original ) ;
		//
		///casting
		var imgtxt=$('#casting_imgholder div:first img').attr('alt');
		$('#casting_imglabel').html(imgtxt);
		//LazyLoad
		var img_data_original=$('#casting_imgholder div:first img').attr('data-original');		
		var img_src=$('#casting_imgholder div:first img').attr('src');
		$('#casting_imgholder div:first img').attr('src', img_data_original ) ;
		//LazyLoad blog
		var img_data_original=$('#wpblog_imgholder div:first img').attr('data-original');		
		var img_src=$('#wpblog_imgholder div:first img').attr('src');
		$('#wpblog_imgholder div:first img').attr('src', img_data_original ) ;
		///wpblog
		var imgtxt=$('#wpblog_imgholder div:first img').attr('alt');
		$('#wpblog_imglabel').html(imgtxt);
		//
		var imgtxt=$('#wpblog_imgholder div:first img').attr('rel');
		$('#blogcount').html(imgtxt);
		//
		var imgtxt=$('#wpblog_imgholder div:first > h1').html();
		$('#wpblog_h1').html(imgtxt);
		var imgtxt=$('#wpblog_imgholder div:first > h2').html();
		$('#wpblog_h2').html(imgtxt);
		var imgtxt=$('#wpblog_imgholder div:first > span').html();
		$('#wpblog_txt').html(imgtxt);
	}
	ImgLazyLoadInit();
	
	/////*html5 audioplayer*/
	//

  		
	/////
	/*Seitenstart*/
	//$("#nav_blog").css('color','#d8b81b');
	//$("#nav_home").css('color','#d8b81b');
	$("#mainmenu2_blog").animate({width: '240px'},180,'swing',function(){ 
		$(this).css('background-color','#E7C124');
	});
	
	
	siteref='';//für loginformular
	sitechange('image',true);//startseite
	
	//debug info
	$("#cont1wrap").fadeIn(0);
	
	
	
	/////hilfsfunktionen
	function readyBreite(){
		return window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);//FF Safari opera etc || (ie standard || ie quirksmode)
	};
	function readyHoehe(){
		 return window.innerHeight|| (window.document.documentElement.clientHeight || window.document.body.clientHeight);//FF Safari opera etc || (ie standard || ie quirksmode)
	};
	/////
	//claim generator
	function claimGen(aktBereich){
		var claimArray = new Array();
			claimArray['image'] = '<span>you can. </span>get it.';
			claimArray['load'] = '<span>up to you. </span>keppelload.de.';
			claimArray['view'] = '<span>just for you. </span>keppelview.de';
			claimArray['live'] = '<span>online on location. </span>keppellive.';
			claimArray['cast'] = '<span>characters you like. </span>keppelcast.de.';
			claimArray['stock'] = '<span>gesucht. gefunden. </span>keppelstock.de.';
		//
		$('#claim').html(claimArray[aktBereich]);	
			
	}
	////
	//////
	function sitechange(rel,fade){
		if(rel==null)var rel = 'image';
		if(fade==null)var fade = false;
		//alert(rel);
		var aktBereich=rel;//startseite festlegen
		var logoGroesse=72;//logohöhe in px
		//
		$('#logoimg').attr({
			src:'/img/logos/logo_'+aktBereich+'_'+logoGroesse+'.png'	
		});//logo je nach bereich laden
		////
		//hintergrundbild je nach bereich laden
		if(fade){
			$('#bgimg').fadeOut(400, function(){
			  $(this).attr({src:'/img/wallpapers/'+aktBereich+'.jpg'},{width:readyBreite()},{height:readyHoehe()}).fadeIn(1500);
			  //$("#cont1wrap").fadeOut(150);//macht im ie8 Probleme
			});
		}else{
			$('#bgimg')	.attr({src:'/img/wallpapers/'+aktBereich+'.jpg'},{width:readyBreite()},{height:readyHoehe()});
		}
		//
	////////
	//
	if(aktBereich=='image'){claimGen(aktBereich);$("#claim span").css('color','#d8b81b');
		$("#cont4wrap").fadeOut(450);
			
	};//Markiert Farbe im Hauptmenü setzen
	//
	function setLoginWindow(){
		$("#cont2wrap , #cont2awrap").fadeOut(150);
		$("#cont4wrap").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
	}
	//
	if(aktBereich=='load'){claimGen(aktBereich);$("#claim span").css('color','#79783c');setLoginWindow();};//Markiert Farbe im Hauptmenü setzen
	//
	if(aktBereich=='view'){claimGen(aktBereich);$("#claim span").css('color','#617173');setLoginWindow();};//Markiert Farbe im Hauptmenü setzen
	//
	if(aktBereich=='live'){claimGen(aktBereich);$("#claim span").css('color','#ae4635');setLoginWindow();};//Markiert Farbe im Hauptmenü setzen
	//
	if(aktBereich=='cast'){claimGen(aktBereich);$("#claim span").css('color','#c39347');setLoginWindow();};//Markiert Farbe im Hauptmenü setzen
	//
	if(aktBereich=='stock'){claimGen(aktBereich);$("#claim span").css('color','#90b457');setLoginWindow();};//Markiert Farbe im Hauptmenü setzen
	//
	//	
	};
	/////
	
////
////Login Formular
	$("#submit").click(function()
	{
			/*//remove all the class add the messagebox classes and start fading
			$("#loginInfo").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
			//check the username exists or not from ajax
			$.post("login.php",{ user_name:$('#user').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
			{
			  if(data=='yes') //if correct login detail
			  {
					$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
					{
					  //add message and change the class of the box and start fading
					  $(this).html('Logging in.....').addClass('messageboxok').fadeTo(900,1,
					  function()
					  {
						 //redirect to secure page
						 document.location='secure.php';
					  });
					});
			  }
			  else
			  {
					$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
					{
					  //add message and change the class of the box and start fading
					  $(this).html('Your login detail sucks...').addClass('messageboxerror').fadeTo(900,1);
					});
			  }
		   });*/
		   
		   
		   /*if($("#loginInfo").css('display') == 'none'){
		   		$("#loginInfo").html('<p>Login Fehlgeschlagen! <br />Falscher Benutzer oder Kennwort?</p>').fadeIn(500);
		   }else{
			   	$("#loginInfo").fadeOut(500,function(){
					$("#loginInfo").html('<p>Login Fehlgeschlagen! <br />Eindeutig Falsches Kennwort! :-( <br/>Kenwort <a style="text-decoration:underline;"  href="mailto:mail@hannokeppel.de?subject=Hilfe mein Kennwort geht nicht!">vergessen</a>?</p>').fadeIn(500);
				});
		   };*/
		   
		   //alert(siteref);
		   
		   ////
		   //zieladresse für login
		   if(siteref=='load'){
				if($("#loginInfo").css('display') == 'none'){
		   			$("#loginInfo").html('<p>Login Fehlgeschlagen! <br />Falscher Benutzer oder Kennwort?</p>').fadeIn(500);
		   		}else{
			   		$("#loginInfo").fadeOut(500,function(){
						$("#loginInfo").html('<p>Login Fehlgeschlagen! <br />Eindeutig Falsches Kennwort! :-( <br/>Kenwort <a style="text-decoration:underline;"  href="mailto:mail@hannokeppel.de?subject=Hilfe mein Kennwort geht nicht!">vergessen</a>?</p>').fadeIn(500);
					});
		   		};
			return false;//not to post the  form physically   
		   }
		   ////
		   else if(siteref=='view'){
		   	//$("#login").attr({action:'http://www.keppelclients.de/includes/sys_login.php'},{method:'post'}).submit();
			
			/*var form_url = $("#login").attr("action");
   			 alert("Before - action=" + form_url);       
    		//changing the action to google.com*/
    		$("#login").attr("action","http://www.keppelclients.de/includes/sys_login.php").submit();
    		/*alert("After - action = "+$("#login").attr("action"));
    		$("#login").submit();*/

			
			
			//return true;//to post the  form physically
		   }
		   //
		   else if(siteref=='live'){
		   	$("#login").attr({action:'http://www.keppellive.de/includes/sys_login.php'},{method:'post'}).submit();
			//return true;//to post the  form physically
		   }
		   //
		   else if(siteref=='cast'){
		   	$("#login").attr({action:'http://www.keppelcast.de/includes/sys_login.php'},{method:'post'}).submit();
			//return true;//to post the  form physically
		   }
		   //
		   else if(siteref=='stock'){
		   	$("#login").attr({action:'http://www.keppelstock.de/includes/sys_login.php'},{method:'post'}).submit();
			//return true;//to post the  form physically
		   }
		   //
		   
		   //submit the form
   			
		   
		   
		   
		   
		   //
		   
	});
////
////hauptmenü seitenübergreifend

	////hilfsfunktionen
	//.stop( [ clearQueue ], [ jumpToEnd ] )
		
	
	
	
	/*
	$(".mainmenu2_kat ").mouseenter(function(){
		$("#mainmenu2").find(".mainmenu2_kat").stop(true,false).css('background-color','#a3a4a4').animate({width: '120px'},180,'swing',function(){ 
			$(this).removeClass("mainmenu2clicked");
			$(this).find(".claim_mouseover").css('display','none');
			$(this).find(".claim_clicked").css('display','none');
			$(this).find(".title").fadeIn(150);
		});
		//
		$(this).animate({width: '340px'},180,'swing',function(){ 
		$(this).find(".claim_mouseover").fadeIn(150);
		});
		//
		if($(this).attr("id")=="mainmenu2_about_contact"){ $(this).css('background-color','#79783c') };
		if($(this).attr("id")=="mainmenu2_reference"){ $(this).css('background-color','#617173') };
		if($(this).attr("id")=="mainmenu2_casting"){ $(this).css('background-color','#ae4635') };
		if($(this).attr("id")=="mainmenu2_blog"){ $(this).css('background-color','#c39347') };
		if($(this).attr("id")=="mainmenu2_gallery"){ $(this).css('background-color','#90b457') };
		//
	});
	*/
	
	//
	$(".mainmenu2_kat").click(function(){
		//
		$("#mainmenu2 > div").animate({width: '120px'},180,'swing',function(){
			$(this).css('background-color','#a3a4a4');
			
		});
		$(this).animate({width: '240px'},180,'swing',function(){ 
			//$(this).find(".claim_mouseover").fadeIn(150);
			if($(this).attr("id")=="mainmenu2_about_contact"){ $(this).css('background-color','#E7C124') };
			if($(this).attr("id")=="mainmenu2_reference"){ $(this).css('background-color','#E7C124') };
			if($(this).attr("id")=="mainmenu2_casting"){ $(this).css('background-color','#E7C124') };
			if($(this).attr("id")=="mainmenu2_blog"){ $(this).css('background-color','#E7C124') };
			if($(this).attr("id")=="mainmenu2_gallery"){ $(this).css('background-color','#E7C124') };
			if($(this).attr("id")=="mainmenu2_360"){ $(this).css('background-color','#E7C124') };
		});
		//
		//mainmenu2 verlassen nach cklick
		//$(this).addClass("mainmenu2clicked");
		//
				
		/*
		$(this).find(".claim_clicked").fadeIn(150);
		$(this).find(".claim_mouseover").stop(true,false).css('display','none');
		$(this).find(".title").stop(true,false).css('display','none');
		*/
		//$(this).find(".title").fadeIn(150);
		//
		//rel=$(this).attr('rel');//webseitenbereich aus rel auswählen
		//seitenhintergrund, claim und logo tauschen
		//sitechange(rel,true);
		//sitechange();
		//siteref=rel;
		//
	});
	//	
	$("#mainmenu2_360").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		//$("#cont1wrap").css('display','block');
		//$("#cont1 > div").css('display','none');
		//$("#gallery").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//	
	$("#mainmenu2_gallery").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		//$("#cont1wrap").css('display','block');
		//$("#cont1 > div").css('display','none');
		//$("#gallery").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#mainmenu2_casting").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#casting").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#mainmenu2_about_contact").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#aboutkontakt").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		$("#nav_impressum").css('color','#E7C124');	
		sitechange();
	});
	//
	$("#mainmenu2_reference").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#reference").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#mainmenu2_blog").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#wpblog").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	//// 
////seitennavigation////
	//nav status auf inaktiv setzen
	//$(".navintern > a").css('color','#999');
	//
	$("#nav_client_login").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#client_login").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		$("#mainmenu2 > div").animate({width: '120px'},180,'swing',function(){
			$(this).css('background-color','#a3a4a4');	
		});
		sitechange();
	});
	//
	//
	/*
	$("#nav_home").click(function(){
		$("#cont1wrap").fadeOut(150);
		$("#cont2wrap").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#nav_gallery").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		//$("#cont1wrap").css('display','block');
		//$("#cont1 > div").css('display','none');
		//$("#gallery").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#nav_casting").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#casting").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#nav_casting1").click(function(){ //Link aus Cont3
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#casting").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$("#nav_casting").css('color','#E7C124');
		sitechange();
	});
	*/
	//
	$("#nav_impressum").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#aboutkontakt").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		$("#mainmenu2 > div").animate({width: '120px'},180,'swing',function(){
			$(this).css('background-color','#a3a4a4');	
		});
		$("#mainmenu2_about_contact").animate({width: '240px'},180,'swing',function(){ 
			$(this).css('background-color','#E7C124');
		});
		sitechange();
	});
	//
	/*$("#nav_about_contact").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#aboutkontakt").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#nav_reference").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#reference").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	*/
	$("#nav_nutzungsbedingungen").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#nutzungsbedingungen").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	/*$("#nav_blog").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#wpblog").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	//
	$("#nav_blog1").click(function(){
		newsDetailOff();
		$("#cont2wrap").fadeIn(450);
		$("#cont1wrap").css('display','block');
		$("#cont1 > div").css('display','none');
		$("#wpblog").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$(this).css('color','#E7C124');
		sitechange();
	});
	*/
	//

	////News
//NewsDetailOFF
	function newsDetailOff(){
		$("#cont2awrap").fadeOut(200);
	}
//Details ON/OFF
	//imlink ausgeführt $('cont2wrap').toggle();
	$("#news_detail").click(function(){
		//Menü auf home setzen
		$("#cont1wrap").fadeOut(150);
		//$("#aboutkontakt").fadeIn(450);
		$(".nav_intern").css('color','#999999');
		$(".nav_main").css('color','#ffffff');
		$("#nav_home").css('color','#E7C124');
		//box anzeigen
		$("#cont2awrap").toggle("slow");
		
		//mainmenu2 verlassen nach cklick
		$("#mainmenu2").find(".mainmenu2_kat").removeClass('mainmenu2clicked');
		//
		sitechange();
		
	});
	
/////
	
	//
//// 
}); 
//////

////hintergrund zoomen
//background-image:url(../img/denmark_6.jpg); background-repeat:no-repeat; background-position:0px 100px;
var width_div=0;
var height_div=0;
var width_img=0;
var height_img=0;
var breite =0;
var imgs =
[
'/img/wallpapers/image.jpg'
];
randimg = function()
{
var idx = Math.floor(Math.random()*imgs.length);
var width_browser = Breite();//aktuelle Fensterbreite
var height_browser = Hoehe();//aktuelle Fensterhöhe
//alert('text'+hoehe);
//document.getElementById("bg").style.backgroundImage = 'url(<?php echo IMG_URL ?>_.gif)';//bg aus css entfernen
//

/*document.getElementById("bgimg").src = imgs[idx];//img laden*///macht jetzt sitechange();
document.getElementById("bgimg").style.top = "0px"//top offset setzen
width_div=document.getElementById("bgimg").style.width;//containerweite
height_div=document.getElementById("bgimg").style.height;//containerhöhe
width_img=document.getElementById("bgimg").style.width;//bildbreite
height_img=document.getElementById("bgimg").style.height;//bildhöhe

imgsize();
//document.getElementById("bgimg").style.backgroundImage ="url('" + imgs[idx] + "')";
return true;
}

function Breite()
{
return window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);//FF Safari opera etc || (ie standard || ie quirksmode)
}
function Hoehe() 
{
return window.innerHeight|| (window.document.documentElement.clientHeight || window.document.body.clientHeight);//FF Safari opera etc || (ie standard || ie quirksmode)
}


imgsize = function()
{
	//
	if (width_img != Breite() && height_img != Hoehe())
	{
	width_browser=Breite(); 
	height_browser=Hoehe(); 
	if (width_browser*0.625 <= height_browser)
	{
		document.getElementById("bgimg").style.height = height_browser+"px";
		document.getElementById("bgimg").style.width = height_browser*1.6 +"px";
	}
	if (height_browser*1.6 <= width_browser)
	{
		document.getElementById("bgimg").style.width = width_browser+"px";
		document.getElementById("bgimg").style.height = width_browser*0.625 +"px";
	}
	height_img=document.getElementById("bgimg").style.height;
	width_img=document.getElementById("bgimg").style.width;
	
	//return true;
	}
	
	
}
window.onload = randimg;
window.onresize= imgsize;
////



////News

//blogcontroller 
	//eintrag weiterschalten
	function prevBlogEntry()
	{
    //Herausfaden
  	$('#contblogmover div:first').fadeOut("slow",
    	//callback
        function()
        {
        //auf null scrollen
		$('#contblogmover').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div ans Ende verschieben
        $(this).remove().appendTo("#contblogmover");
        //LazyLoad
        var img_data_original=$('#contblogmover div:first img').attr('data-original');		
        var img_src=$('#contblogmover div:first img').attr('src');
        $('#contblogmover div:first img').attr('src', img_data_original ) ;
        //
        //Erstes div hereinfaden
        $('#contblogmover div:first').fadeIn("slow");
        //Navigation aktualisieren
		//$('#nextBlogId').html( $('#contblogmover div.label:second') )
		});
	//
	$('#contblogmoverp div:first').fadeOut("slow",
    	//callback
        function()
        {
        //auf null scrollen
		$('#contblogmoverp').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div ans Ende verschieben
        $(this).remove().appendTo("#contblogmoverp");
        //Erstes div hereinfaden
        $('#contblogmoverp div:first').fadeIn("slow");
        //Navigation aktualisieren
		//$('#nextBlogId').html( $('#contblogmover div.label:second') )
		});	
	}
	/////
	//eintrag zurückschalten
	function nextBlogEntry()
	{
    //Herausfaden
  	$('#contblogmover div:first').fadeOut("slow",
    	//callback
        function()
        {
		//auf null scrollen
		$('#contblogmover').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div an den Anfang verschieben
        $('#contblogmover div:last').remove().prependTo("#contblogmover");
        //LazyLoad
        var img_data_original=$('#contblogmover div:first img').attr('data-original');		
        var img_src=$('#contblogmover div:first img').attr('src');
        $('#contblogmover div:first img').attr('src', img_data_original ) ;
        //
        //Erstes div hereinfaden
        $('#contblogmover div:first').fadeIn("slow");
		//Navigation aktualisieren
		//$('#prevBlogId').html( $('#contblogmover div.label:last').html() );
        });
	//
	$('#contblogmoverp div:first').fadeOut("slow",
    	//callback
        function()
        {
		//auf null scrollen
		$('#contblogmoverp').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div an den Anfang verschieben
        $('#contblogmoverp div:last').remove().prependTo("#contblogmoverp");
        //Erstes div hereinfaden
        $('#contblogmoverp div:first').fadeIn("slow");
		//Navigation aktualisieren
		//$('#prevBlogId').html( $('#contblogmover div.label:last').html() );
        });
	}
	/////
	//eintrag scrollen
	//
	function scrollUpBlogEntry()
	{
		if( $('#contblogmover').position().top < 0 ){ 
			//$('#contblogmover').css({"position": "absolute" ,"top": ( $('#contblogmover').position().top + 50 ) + "px"});
			$('#contblogmover').css({"position": "absolute"}).animate({"top": "+=100px"}, 400,'swing');
		}
	}
	//
	function scrollDownBlogEntry()
	{
	//bloghöhe - artikelhöhe = scrollanschlag
		var maxMove = parseInt( $('#contblog').css("height") ) - parseInt( $('#contblogmover div:first').css("height") );
		//alert($('#contblogmover div:first').css("height"));
		if($('#contblogmover div:first').css("height") == 'auto'){
			$('#contblogmover').css({"position": "absolute"}).animate({"top": "-=100px"}, 400,'swing');
		}else if( $('#contblogmover').position().top >= maxMove ){ 
			//$('#contblogmover').css({"position": "absolute" ,"top": ( $('#contblogmover').position().top - 50 ) + "px"});
			$('#contblogmover').css({"position": "absolute"}).animate({"top": "-=100px"}, 400,'swing');

		//alert($('#contblogmover').position().top);
		}
	}
////

////Casting

//castingcontroller 
	//eintrag weiterschalten
	function prevCastEntry()
	{
    //Herausfaden
  	$('#casting_imgholder div:first').fadeOut("slow",
    	//callback
        function()
        {
        //auf null scrollen
		$('#casting_imgholder').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div ans Ende verschieben
        $(this).remove().appendTo("#casting_imgholder");
        //Erstes div Bildtitel auswerten
        var imgtxt=$('#casting_imgholder div:first img').attr('alt');
		$('#casting_imglabel').html(imgtxt);
		//LazyLoad
		var img_data_original=$('#casting_imgholder div:first img').attr('data-original');		
		var img_src=$('#casting_imgholder div:first img').attr('src');
		$('#casting_imgholder div:first img').attr('src', img_data_original);
		//Erstes div hereinfaden
		$('#casting_imgholder div:first').fadeIn("slow");
        //Navigation aktualisieren
		//$('#nextBlogId').html( $('#casting_imgholder div.label:second') )
		});
	}
	//
	/////
	//eintrag zurückschalten
	function nextCastEntry()
	{
    //Herausfaden
  	$('#casting_imgholder div:first').fadeOut("slow",
    	//callback
        function()
        {
		//auf null scrollen
		$('#casting_imgholder').css({"position": "absolute" ,"top": "0px"});
		//aktuelles div an den Anfang verschieben
        $('#casting_imgholder div:last').remove().prependTo("#casting_imgholder");
        //Erstes div Bildtitel auswerten
        var imgtxt=$('#casting_imgholder div:first img').attr('alt');
		$('#casting_imglabel').html(imgtxt);
		//LazyLoad
		var img_data_original=$('#casting_imgholder div:first img').attr('data-original');		
		var img_src=$('#casting_imgholder div:first img').attr('src');
		$('#casting_imgholder div:first img').attr('src', img_data_original ) ;
		//Erstes div hereinfaden
        $('#casting_imgholder div:first').fadeIn("slow");
		//Navigation aktualisieren
		//$('#prevBlogId').html( $('#casting_imgholder div.label:last').html() );
        });
	//
	
	}
////wp Blog
//wpBlogcontroller 
//window.onload = WpblogInit;
	function ImgLazyLoadInit(){
		//aufruf bei seitenstart
		///news
		//LazyLoad
		var img_data_original=$('#contblogmover div:first img').attr('data-original');		
		var img_src=$('#contblogmover div:first img').attr('src');
		$('#contblogmover div:first img').attr('src', img_data_original ) ;
		//
		///casting
		var imgtxt=$('#casting_imgholder div:first img').attr('alt');
		$('#casting_imglabel').html(imgtxt);
		//LazyLoad
		var img_data_original=$('#casting_imgholder div:first img').attr('data-original');		
		var img_src=$('#casting_imgholder div:first img').attr('src');
		$('#casting_imgholder div:first img').attr('src', img_data_original ) ;
		//LazyLoad blog
		var img_data_original=$('#wpblog_imgholder div:first img').attr('data-original');		
		var img_src=$('#wpblog_imgholder div:first img').attr('src');
		$('#wpblog_imgholder div:first img').attr('src', img_data_original ) ;
		///wpblog
		var imgtxt=$('#wpblog_imgholder div:first img').attr('alt');
		$('#wpblog_imglabel').html(imgtxt);
		//
		var imgtxt=$('#wpblog_imgholder div:first img').attr('rel');
		$('#blogcount').html(imgtxt);
		//
		var imgtxt=$('#wpblog_imgholder div:first > h1').html();
		$('#wpblog_h1').html(imgtxt);
		var imgtxt=$('#wpblog_imgholder div:first > h2').html();
		$('#wpblog_h2').html(imgtxt);
		var imgtxt=$('#wpblog_imgholder div:first > span').html();
		$('#wpblog_txt').html(imgtxt);
	}
	//eintrag weiterschalten
	function prevWpblogEntry()
	{
    //Herausfaden
    	$('#wpblog_imgholder div:first').fadeOut("slow",
    	//callback
        function()
        {
    	//auf null scrollen
    	$('#wpblog_imgholder').css({"position": "absolute" ,"top": "0px"});
    	//aktuelles div an den Anfang verschieben
        $('#wpblog_imgholder div:last').remove().prependTo("#wpblog_imgholder");
        //Erstes div Bildtitel auswerten
        //LazyLoad
        var img_data_original=$('#wpblog_imgholder div:first img').attr('data-original');		
        var img_src=$('#wpblog_imgholder div:first img').attr('src');
        $('#wpblog_imgholder div:first img').attr('src', img_data_original ) ;
        //
        var imgtxt=$('#wpblog_imgholder div:first img').attr('alt');
    	$('#wpblog_imglabel').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first img').attr('rel');
    	$('#blogcount').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > h1').html();
    	$('#wpblog_h1').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > h2').html();
    	$('#wpblog_h2').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > span').html();
    	$('#wpblog_txt').html(imgtxt);
    	//Erstes div hereinfaden
        $('#wpblog_imgholder div:first').fadeIn("slow");
    	//Navigation aktualisieren
    	//$('#prevBlogId').html( $('#casting_imgholder div.label:last').html() );
        });
    //
	}
	//
	/////
	//eintrag zurückschalten
	function nextWpblogtEntry()
	{
    //Herausfaden
    	$('#wpblog_imgholder div:first').fadeOut("slow",
    	//callback
        function()
        {
        //auf null scrollen
    	$('#wpblog_imgholder').css({"position": "absolute" ,"top": "0px"});
    	//aktuelles div ans Ende verschieben
        $(this).remove().appendTo("#wpblog_imgholder");
        //Erstes div Bildtitel auswerten
        //LazyLoad
        var img_data_original=$('#wpblog_imgholder div:first img').attr('data-original');		
        var img_src=$('#wpblog_imgholder div:first img').attr('src');
        $('#wpblog_imgholder div:first img').attr('src', img_data_original ) ;
        //
        var imgtxt=$('#wpblog_imgholder div:first img').attr('alt');
    	$('#wpblog_imglabel').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first img').attr('rel');
    	$('#blogcount').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > h1').html();
    	$('#wpblog_h1').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > h2').html();
    	$('#wpblog_h2').html(imgtxt);
    	//
    	var imgtxt=$('#wpblog_imgholder div:first > span').html();
    	$('#wpblog_txt').html(imgtxt);
    	//Erstes div hereinfaden
    	$('#wpblog_imgholder div:first').fadeIn("slow");
        //Navigation aktualisieren
    	//$('#nextBlogId').html( $('#casting_imgholder div.label:second') )
    	});
    ////
	
	}
	

