$(document).ready(function(){
	$('div.item').hover(function() {
		$('div.slider-img',this).css('display','block');
	},function() {
		$('div.slider-img',this).css('display','none');
	});
	
	//$(".pressebild img[rel]").overlay({effect: 'apple'});
	$('a.lightbox').lightBox({
		imageLoading: '/fileadmin/templates/js/jquery-lightbox-0.5/images/lightbox-ico-loading.gif',
		imageBtnClose: '/fileadmin/templates/js/jquery-lightbox-0.5/images/lightbox-btn-close.gif',
		imageBtnPrev: '/fileadmin/templates/js/jquery-lightbox-0.5/images/lightbox-btn-prev.gif',
		imageBtnNext: '/fileadmin/templates/js/jquery-lightbox-0.5/images/lightbox-btn-next.gif'
	});
	
	//n21-flvtext:mouseover -> hand cursor IE fix:
	$("div#flvtext_container img#previewImage").hover(
      function () {
	    $(this).addClass("handCursor");
	  },
	  function () {
	    $(this).removeClass("handCursor");
	  }
	 );

});





/*
$(function() {
	
$f("a.player", "/fileadmin/flowplayer-3.1.5.swf", {
	
	// perform custom stuff before default click action
	onBeforeClick: function() {
		
		// unload previously loaded player
		$f().unload();
		
		// get wrapper element as jQuery object
		var wrap = $(this.getParent());
		alert(wrap);
		// hide nested play button
		wrap.find("img").fadeOut();
		
		// start growing animation
		wrap.animate({width:424, height:238}, 500, function() {
		
			// when animation finishes we will load our player
			$f(this).load();
			
		});	
		
		// disable default click behaviour (player loading)
		return false; 
	}, 

	// unload action resumes to original state		
	onUnload: function() {
		$(this.getParent()).animate({width:424, height:120}, 500, function()  {
				
			// make play button visible again
			$(this).find("img").fadeIn();		
		});				
	}, 
	
	// when playback finishes perform our custom unload action
	onFinish: function() {
		this.unload();	
	}
	
});

});
*/


function showJWVideo(){
	//1. Grafik ausfahren...
	$('#flvtext_content').animate({
		height: 'toggle'
		,top:'+=135'
		}, 100, function() {
			// ..dann Grafik verstecken und Video anzeigen:
			$('div#flvtext_container img#previewImage').hide();
			$('div#flvtext_container div#playIcon').hide();
			
			$('div#flvtext_container p#flvtext_preview').show();
			$('#flvtext_preview_wrapper').show();
			//autoplay flashvars param was set in the template file
		}
	);
}


var player = null;
function playerReady(thePlayer) {
	player = document.getElementById(thePlayer.id);
	addListeners();
}
		
function addListeners() {
	if (player) { 
		player.addModelListener("STATE", "stateListener");
	} else {
		setTimeout("addListeners()",100);
	}
}
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
	if(obj) {
		
		currentState = obj.newstate; 
	previousState = obj.oldstate; 
	
	
	//alert("DEBUG:\ncurrentState: "+ currentState+"\npreviousState: "+previousState);
	

	var tmp = document.getElementById("stat");
	if (tmp) { 
		tmp.innerHTML = "current state: " + currentState + 
		"<br>previous state: " + previousState; 
	}

	/*if (currentState == "PLAYING") {
		$('#flvtext_content').slideUp(); 
	

		$('#flvtext_content').animate({
			height: 'toggle'
			,top:'+=135'
			}, 100, function() {
    		// Animation complete.
  		});
  		//$('#flvtext_content').slideDown();		
		
	}*/
	if (currentState == "COMPLETED"){
		$('#flvtext_content').animate({
				height: 'toggle'
				,top:'-=135'
			}
			, 100, function() {
				// Animation complete.
				$('div#flvtext_container p#flvtext_preview').hide();
				('#flvtext_preview_wrapper').hide();
				$('div#flvtext_container img#previewImage').show();
				$('div#flvtext_container div#playIcon').show();
  		});			
	}
	/* BACKUP:
	 if (currentState == "COMPLETED" || currentState == "PAUSED") {
		$('#flvtext_content').animate({
				height: 'toggle'
				,top:'-=135'
			}
			, 100, function() {
    		// Animation complete.
  		});				
		//alert("PAUSE ODER FERTIG?");
		$('#flvtext_content').slideDown(); 
	}*/
		
	}
	
	 
}

