//Global Vars
var image_act = 1;
var images_total = 0;
var image_folder = "images/";
var image_prefix = "Bild_";
var image_type = "jpg";

$(function() {
	 $(".slidetabs").tabs(".images ul > li", {

		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: "slow",

		// start from the beginning after the last tab
		rotate: true

		// use the slideshow plugin. It accepts its own configuration
	}).slideshow();
	
	images_total = $('.images img').size();
	if(images_total <= 1)
    {
        $(".navi-buttons").css("display", "none");
        $(".image-count").css("display", "none");
    }


	act_image();
});

function act_image(action)
{

	
	if(action == 'backward')
	{
		image_act--;	
	}
	else if(action == 'forward')
	{
		image_act++;
	}
	
	
	if(image_act > images_total)
	{
		image_act=1;
	}
	
	if(image_act <= 0)
	{
		image_act=images_total;
	}
		
	//$('.image-count').html(image_act + " / " + images_total);
	$('.currentImage').html(image_act);
	$('.maxImage').html(images_total);
}

function click_enlarge(url)
{

//var image_url = image_folder + image_prefix + image_act + "." + image_type;
//var image_title = 'Bild ' + image_act + ' von ' + images_total + ' ';

//var win = window.open(image_url,"","width=800,height=600,resizeable=yes,top=2,left=2");
//win.focus();	

window.location=url;

}
