var options = { path: '/', expires: 10 };
$(document).ready(function() {
	$("#vogelmap area").hover(function () {
		showMap(this);
	}, function () {
		hideMap(this);
	});
	
		$("a.flowplayer").each(function(i) {
			if(i == 0) {
				f = flowplayer(this.id, "/flash/flowplayer.commercial-3.1.5.swf", { 
		    	key: '#@f97ab60a5a27b452bd7',
		    	clip:  { 
			       		autoPlay: false
			       	}
		   		});
		   		f.load();
		   		if($(this).attr("autoplay") == "true") {
		   			f.play();
		   		}
		   	} else {
				flowplayer("a.flowplayer", "/flash/flowplayer.commercial-3.1.5.swf", {
					key: '#@f97ab60a5a27b452bd7',
					clip:  {
						autoPlay: false
					}
				});
		   	}
	   	})
   	
        

	if($("#map").length > 0) {
		load();
		if($.cookies.get("mapslider") ==  1) {
	   		$("#map").hide();
	   		
	   		$("#do_hide_map").hide();
	   		$("#do_view_map").show();
	   		
	   	}
   	}
   	
	$("#do_hide_map").click(function() {
   		if($("#map").is(":visible")) {
   			$("#map").slideUp(1000);
   			$.cookies.set("mapslider", 1);
   			$(this).hide();
   			$("#do_view_map").show();
   		}
   		return false;
   	});
   	$("#do_view_map").click(function() {
   		if($("#map").is(":visible")) {
   		} else {
   			$("#map").slideDown(1000);
   			$.cookies.set("mapslider", 0);
   			$(this).hide();
   			$("#do_hide_map").show();
   		}
   		return false;
   	});
   	
   	
});
	
var banners, bnum, bmax, bprev, tmpbnum;
$(document).ready(function() {
	banners = Array();
	bmax = Array();
	bnum = Array();
	bprev = Array()
	tmpbnum = Array()
	
	
	
	$("div.scrollable").scrollable({size: 3}).circular();
	$(".items img").click(function() {
		// calclulate large image's URL based on the thumbnail URL (flickr specific)
		var url = "/gfx/image.phtml?width=280&image=" + $(this).attr("rel");
		var bigurl = "/gfx/image.phtml?width=600&image=" + $(this).attr("rel");
		var newtitle = $(this).attr("title");
		// get handle to element that wraps the image and make it semitransparent
		var wrap = $("#image_wrap").fadeTo("medium", 0.5);
		// the large image from flickr
		var img = new Image();
		// call this function after it's loaded
		img.onload = function() {
			// make wrapper fully visible
			wrap.fadeTo("fast", 1);
	
			// change the image
			wrap.find("img").attr("src", url);
			$("#image_wrap").attr("href", bigurl);
			$("#image_wrap").attr("title", newtitle);
			
		};
		// begin loading the image from flickr
		
		img.src = url;
		// when page loads simulate a "click" on the first image
	});
	
	$("div.scrollable2").scrollable({prevPage:".prevPage2",nextPage:".nextPage2"}).circular();
	$(".items2 img").click(function() {
		var url = "/gfx/image.phtml?width=660&image=" + $(this).attr("rel");
		
		var newtitle = $(this).attr("title");
		// get handle to element that wraps the image and make it semitransparent
		var wrap = $("#image_wrap2").fadeTo("medium", 0.5);
		// the large image from flickr
		var img = new Image();
		// call this function after it's loaded
		img.onload = function() {
			// make wrapper fully visible
			wrap.fadeTo("fast", 1);
	
			// change the image
			wrap.find("img").attr("src", url);
			//$("#image_wrap2").attr("href", bigurl);
			$("#onder2").text(newtitle);
			
		};
		// begin loading the image from flickr
		
		img.src = url;
		// when page loads simulate a "click" on the first image
	});
	
	
	
	checkBanner(1);
	checkBanner(2);
	checkBanner(3);
});
function checkBanner(num) {
	banners[num] = Array();
	nn = "#imagelist" + num + " div";
	bmax[num] = $(nn).length;
	if(bmax[num] > 1) {
		$(nn).each(function(i) {
			banners[num][i] = this;
			$(this).fadeTo(1, 0);
			$(this).hide();
			if(i == 0) {
				$(this).fadeTo(1, 1);
				$(this).show();
			}
		});
		bnum[num] = 0;
		t = setTimeout("dobBanner(" + num + ");", num * 2500);
	}
}
function dobBanner(num) {
	tmpbnum[num] = bnum[num];
	nn = "#imagelist" + num + " div";
	
	$(nn).eq(tmpbnum[num]).fadeTo(1000, 0, function() {
		$(this).hide();
	});
	bprev[num] = bnum[num];
	bnum[num]++;
	if(bnum[num] >= bmax[num]) {
		bnum[num] = 0;
	}
	$(nn).eq(bnum[num]).show();
	$(nn).eq(bnum[num]).fadeTo(1000, 1, function() {	
		setTimeout("dobBanner(" + num + ");", 5000);
	});
}
