jQuery.easing.def = "easeOutQuart";
mapVar = false;


$(document).ready(function() {
  	resizeImagebox($(document).width(), false);
});

$(window).resize(function() {
  	resizeImagebox($(document).width(), true);
});

function resizeImagebox(BrowserWidth, animate) {
	newWidth = 720;
	newContactWidth = 480;
	newContactBorder = 0;
	newHeadBorder = 0;	
	newStartWidth = 640;

	if (BrowserWidth > 1040) { newWidth = 800;	newContactWidth = 560; newContactBorder = 0;  newHeadBorder = 80 }
	if (BrowserWidth > 1120) { newWidth = 880;	newContactWidth = 560; newContactBorder = 80; newHeadBorder = 80}		
	if (BrowserWidth > 1360) { 	newStartWidth = 1040; }		
	if (BrowserWidth > 1680) { 	newStartWidth = 1360; }		



	if (animate == true) {
	$("#imageContainer").animate({width: newWidth}, { duration: 500 });
	$("#content.startseite").animate({width: newStartWidth}, { duration: 500 });
	$("#fotoImage.tabContainer").animate({width: newWidth}, { duration: 500 });
	$("#reiseImage.tabContainer").animate({width: newWidth}, { duration: 500 });
	$("#mapContainer").animate({width: newWidth}, { duration: 500 });
	$("#head").animate({borderWidth: newHeadBorder}, { duration: 500});
	$("#body.contact").animate({borderWidth: newContactBorder, paddingRight: newContactWidth}, { duration: 500 });
	$("#body.presse").animate({paddingRight: newContactWidth-80}, { duration: 500 });
	} else {
	$("#imageContainer").width(newWidth);
	$("#content.startseite").width(newStartWidth);
	$("#fotoImage.tabContainer").width(newWidth);
	$("#reiseImage.tabContainer").width(newWidth);
	$("#mapContainer").width(newWidth);
	$("#body.contact").animate({borderWidth: newContactBorder, paddingRight: newContactWidth}, { duration: 0 });
	$("#body.presse").animate({paddingRight: newContactWidth-80}, { duration: 0});

	$("#head").animate({borderWidth: newHeadBorder}, { duration: 0 });
	}
	
}
	

function switchImageMap(berichtId) {
	mapVar = !mapVar;
	
	if (mapVar == true) {
		$("#imageContainer").css("visibility", "hidden");
		$("#mapContainer").css("visibility", "visible");
		$("#LinkImageMap").css("background-image","url(../gfx/gotoImage.gif)");
	} else {
		$("#imageContainer").css("visibility", "visible");
		$("#mapContainer").css("visibility", "hidden");
		$("#LinkImageMap").css("background-image","url(../gfx/gotoMap.gif)");
	}
}

playPauseVar = true;
function playPause(stop) {
	if (playPauseVar == true){
	playPauseVar = false;
	} else {
	playPauseVar = true;
	}
	
	if (stop == true) playPauseVar = false;
	
	if (playPauseVar == false){
    	$('#images').cycle('pause'); 

	} else {
    	$('#images').cycle('resume', true); 

	}
	

}

function onAfter() {
    $('#description').html(this.alt);
}


$(function() {
    $('#images').before('<div id="imageNav" class="nav">').cycle({
        fx:     'fade',
        speed:  2000,
        timeout: 5000,
        pager:  '#imageNav',
		pause:   1,
		after:   onAfter,
        before: function() { if (window.console) console.log(this.src); }
   	 
    });
});

