// -*- coding:utf-8 -*-

function displayVideo(href)
{
    tb_init('a.thickbox-video');//pass where to apply thickbox
    
    flowplayer("player", "/media/js/flowplayer/flowplayer-3.1.2.swf", { 
	    clip:  
	    { 
		autoPlay: false, 
		    autoBuffering: true 
		    } 
	}); 

};

function displayImage(href)
{
    
    $("#gallery-target").hide();
    $("#gallery-target").html('<a href="'+href+'" class="thickbox"><img src="'+href+'" /></a>');

    tb_init('a.thickbox');//pass where to apply thickbox


    $("#gallery-target").show(250);

};






$(document).ready(function(){

	//$('#gallery-target').click(function (e) {
	//	e.preventDefault();
	//	$('#gallery-modal').modal();
	//});

	$("#gallery-paginator a").click(function(e) {
		e.preventDefault();
		image = $(this).attr("href");
		displayImage(image);
		return false;
	    });


	
	$("a.thickbox-video").click(function(e) {
		e.preventDefault();
		href = $(this).attr("href");
		displayVideo(href);
		return false;
	    });





	$(window).load(function() {
		if($("#gallery-paginator #image0").get(0)){
			image = $("#gallery-paginator #image0").attr("href");
			displayImage(image);
			return false;
		}	

	    });

	if($("#content-menu").get(0)){
	    $("#content-text-outer").css("height", "252px")
	}



    $("#language-chooser ul li").click(function (event) { 
	    event.preventDefault();
	    
	    to_href = $(this).find("a").attr("href");
	    if (to_href)
		{
		    window.location.href = to_href;
		    return false;
		}	
		
	    event.stopPropagation();
       
    });


	$('#content-text').jScrollPane();



    });

