$(document).ready(function() {
	images = ['/home/css/hg-reisen01.jpg',
		'/home/css/hg-reisen02.jpg',
		'/home/css/hg-reisen03.jpg',
		'/home/css/hg-reisen04.jpg',
		'/home/css/hg-reisen05.jpg',
		'/home/css/hg-reisen06.jpg',
		'/home/css/hg-reisen07.jpg',
		'/home/css/hg-reisen08.jpg',
		'/home/css/hg-reisen09.jpg',
		'/home/css/hg-reisen10.jpg',
		'/home/css/hg-reisen11.jpg',
		'/home/css/hg-reisen12.jpg',
		'/home/css/hg-reisen13.jpg',
		'/home/css/hg-reisen14.jpg',
		'/home/css/hg-reisen15.jpg',
		'/home/css/hg-reisen16.jpg',
		'/home/css/hg-reisen17.jpg'
	];
	navmain = $('#nav_main');
	navmain.prepend('<img src="/home/css/hg-reisen01.jpg" class="fadein" height="227" width="1012" border="0" id="h1" style="z-index:-2" />');
	navmain.prepend('<img src="/home/css/hg-reisen02.jpg" class="fadein" height="227" width="1012" border="0" id="h2" style="z-index:-3" />');
	navmain.css("background-image", "none");
	function change_images() {
		var num_images = images.length-1;
		var image = 0;
		var fn = {
			blend: function () {
				if (image < num_images) {
					image++;
					$('#h2').attr("src", images[image]);
					$('#h1').fadeOut(2000, function() { $('#h1').attr("src", images[image]).css("display", "inline"); });
					setTimeout(fn.blend, "12000");
				} else {
					image = 0;
				}
			}
		}
		setTimeout(fn.blend, "16000");
	}
	change_images();

	contentbox = $("div.contentbox, div.zweispaltig, div.searchresult");
	contentbox.each( function() {
		rel = $(this).attr("rel");
		if ((rel != undefined) && (rel.substr(0, 4) != "http") && (rel != "")) {
			$(this).css("cursor", "pointer").click( function() {
				window.location.href = $(this).attr("rel");
			});
		}
	});

/*
	var quickcheck = $("#quickcheck");
	if (quickcheck.length != 0) {
		function set_selected() {
			all.addClass("hide");
			$.each(check_selection, function(i, val) {
				if (selection[val] == 1) {
					all.children("td."+val).parent().removeClass("hide").show();
					$("#check_"+val).text("Ausblenden")
				} else {
					$("#check_"+val).text("Einblenden")
				}
			} );
			all.filter(".hide").hide();
		}
		if (check_selection.length != 0) {
			var all = $("#tabellereisen tr:gt(0)");
			set_selected();
			$.each(check_selection, function(i, val) {
				$("#check_"+val).bind("click", function() {
					selection[val] == 0 ? selection[val] = 1 : selection[val] = 0;
					set_selected();
				} );
			} );
			var quickcheck = $("#quickcheck")
			quickcheck.show();
		}
	}

/* kopiert den Schriftzug im Brandingbereich und versetzt diesen um 2 Pixel als Schatten zum eigentlichen Schriftzug*/

	navmain = $("#nav_main ul");
	navmain.clone().appendTo("#nav_main");
	navmain.addClass("shadow");

/* oeffnet markierte Links statt im neuen Fenster in einem IFrame */

	var ua = $.browser;
	if (!((ua.msie) && (ua.version.slice(0,1) == 6))) {
		var diashow = $('a[rel="loader_iframe"]');
		if (diashow.length != 0) {
			$("body").prepend('<div id="overlay"></div><div id="container"></div><div id="newsletter"></div>');
			diashow.click(function(e) {
				e.preventDefault();
				var url = $(this).attr("href");
				var title = $(this).attr("title");
				var height = $(window).height() - 30;
				$("#overlay").fadeIn("slow").click(function(e) {
					$(this).fadeOut("slow");
					$("#container").empty().css("display", "none");
				});
				$("#container").fadeIn("slow").prepend('<div id="loader_title">'+title+'</div><div id="loader_close">Fenster schließen</div><iframe id="loader_iframe" src="'+url+'" frameborder="0" width="960" height="'+height+'"/>');
				$("#loader_close").click(function(e) {
					$("#overlay").fadeOut("slow");
					$("#container").empty().fadeOut("slow");
				});
			});
			$(window).resize(function() {
				if ($("#loader_iframe").length == 1) {
					height = $(window).height() - 30;
					$("#loader_iframe").attr("height", height);
				}
			});
		}

		var newsletter = $('a[rel="newsletter_iframe"]');
		if (newsletter.length != 0) {
			newsletter.click(function(e) {
				e.preventDefault();
				$("#overlay").fadeIn("slow").click(function(e) {
					$(this).fadeOut("slow");
					$("#newsletter").empty().css("display", "none");
				});
				$("#newsletter").fadeIn("slow").prepend('<div id="loader_title">Newsletter bestellen / abbestellen</div><div id="loader_close">Fenster schließen</div><iframe id="loader_iframe" src="https://www.urlaubundnatur.de/newsletter-bestellen.php" frameborder="0" width="400" height="250"/>');
				$("#loader_close").click(function(e) {
					$("#overlay").fadeOut("slow");
					$("#newsletter").empty().fadeOut("slow");
				});
			});
		}

/* zeigt bei breitem Browserfenster Facebook-Plugin an */
/*		var windowwidth = $(window).width();
		if (windowwidth > 1250) {
			$("body").prepend('<div id="add_content"><iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fde-de.facebook.com%2Fpages%2FUrlaub-Natur%2F135731463109247&amp;width=200&amp;colorscheme=light&amp;show_faces=true&amp;stream=true&amp;header=true&amp;height=427" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:427px;" allowTransparency="true"></iframe></div>');
			setTimeout(function() { $("#add_content").fadeIn(2000) }, 2000 );
		}
deaktiviert aus Datenschutzgründen */
	}

	weitereinformationen = $("#weitereinformationen");
	weitereinformationen.fadeOut(1);
	$('a[rel="weitereinformationen"]').toggle(
		function(e) {
			e.preventDefault();
			weitereinformationen.fadeIn();
		},
		function(e) {
			e.preventDefault();
			weitereinformationen.fadeOut();
		}
	);

	tooltips = $("#tablealltrips, div.charakteristik");
	if (tooltips.length != 0) {
		tooltips.find("img[title]").tooltip({
			offset: [10, -6],
			effect: 'slide'
		});
	}

	$(".innercontent").each(function(){
		var currentTallest = 0;
		boxes=$(this).find(".contentbox");
		if (boxes.length > 1) {
			boxes.each(function(i){
				if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
			});
			// for ie6, set height since min-height isn't supported
			if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
			$(this).children().css({'min-height': currentTallest});
		}
	});

});


function Go_I(x) {
	if(x =="nothing") {
		return;
	} else {
		parent.location.href = '/reisen/I-'+x+'.php';
		document.forms[0].reset();
		document.forms[0].elements[0].blur();
	}
}

function Go_G(x) {
	if(x =="nothing") {
		return;
	} else {
		parent.location.href = '/reisen/G-'+x+'.php';
		document.forms[0].reset();
		document.forms[0].elements[0].blur();
	}
}

function popitnow(url, a, b) {
	fenster = window.open(url, "agb", "width=600,height=400,status=yes,scrollbars=yes,resizable=yes");
	fenster.focus();
}

