Shadowbox.init({
	modal: true,
	overlayColor: '#2a428a',
	fadeDuration: 0.25,
	resizeDuration: 0.25,
  players: ['img','swf','flv','iframe'],
  language: 'de-DE'
});

$(document).ready(function() {
	mouseovers();
	searchbox();
	$("#gebietselect").bind("change",function() { albumjump(); });
	$("#jahrselect").bind("change",function() { albumjump(); });
	$("#katselect").bind("change",function() { albumjump(); });
	$("#vgebietselect").bind("change",function() { videojump(); });
	$("#vjahrselect").bind("change",function() { videojump(); });
	$("#vkatselect").bind("change",function() { videojump(); });
	$("a.hs_l").cluetip({splitTitle: "|"});
	$("a.hs_r").cluetip({splitTitle: "|"});
	$("ul.sf-menu").superfish({
			disableHI: true,
			animation: {opacity:'show',height:'show'}
	});
});
function pushContent(info) {
	$("div.tab").hide();
	$("div#"+info).fadeIn("normal");
}
function formcheck(form2check) {
	switch(form2check.name) {
		case "gruppenreisen": var fields2check = new Array("Name","Vorname","Strasse","PLZ","Telefon","Email","Termin","Alternativtermin","Personen","Unterkunft","Woher"); break;
		case "videothek":			var fields2check = new Array("Name","Email","Nickname","YouTubeId","Titel","Kategorie"); break;
		case "kontakt":				var fields2check = new Array("Vorname","Name","Strasse","PLZ","Ort","Email","Nachricht"); break;
		default: 							var fields2check = new Array("Vorname","Name","Strasse","PLZ","Ort","Email");
	}
	for(var i = 0; i < fields2check.length; ++i) {
		if (form2check[fields2check[i]].length) {
			if (!form2check[fields2check[i]].selectedIndex) {
				alert("Bitte das Feld '"+fields2check[i]+"' ausfüllen.");
				form2check[fields2check[i]].focus();
				return false;
			}
		}
		if (!form2check[fields2check[i]].value) {
			alert("Bitte das Feld '"+fields2check[i]+"' ausfüllen.");
			form2check[fields2check[i]].focus();
			return false;
		}
	}
	return true;
}
function albumjump() {
	var jahr = $("#jahrselect").val();
	var gebiet = $("#gebietselect").val();
	var kat = $("#katselect").val();
	self.location.href="index.php?content=album_main&jahr="+jahr+"&gebiet="+gebiet+"&kat="+kat;
}
function videojump() {
	var jahr = $("#vjahrselect").val();
	var gebiet = $("#vgebietselect").val();
	var kat = $("#vkatselect").val();
	self.location.href="index.php?content=videothek&jahr="+jahr+"&gebiet="+gebiet+"&kat="+kat;
}
function faqToggle(obj) {
	if($(obj).attr("class") == "active")
		$(obj).removeClass();
	else {
		$("div.faq > div").removeClass();
		$(obj).addClass("active");
	}
}
function mouseovers() {
	var dbl = new Array("skigebiet","ort","unterkunft","preise","specials");
	var sgl = new Array("empfehlen","druck","buchen");
	$.each(dbl,function(idx,img) {
		$("#icon_"+img).hover(function() {
			$(this).attr("src","./ikons/icon_"+img+"_o.gif");
			$("#spacer").attr("src","./ikons/icon_info_"+img+".gif");
		},function() {
			$(this).attr("src","./ikons/icon_"+img+"_n.gif");
			$("#spacer").attr("src","./ikons/icon_info_leer.gif");
		});
	});
	$.each(sgl,function(idx,img) {
		$("#icon_"+img).hover(function() {
			$(this).attr("src","./ikons/icon_"+img+"_o.gif");
		},function() {
			$(this).attr("src","./ikons/icon_"+img+"_n.gif");
		});
	});
}
function nlreg() {
	var email = $("#nl_email").val();
	$.post("nlhandler.php",{nl_email: email},function(data) {
		switch(data) {
			case "0":
				$("#nl_form").empty().append("Deine E-Mail Adresse wurde dem Verteiler hinzugef&uuml;gt. Du bekommst in K&uuml;rze eine Best&auml;tigungsmail.");
			break;
			case "1":
				$("#nl_response").empty().append("Bitte gib eine g&uuml;ltige E-Mail Adresse ein.");
				$("#nl_email").focus();
			break;
			case "2":
				$("#nl_form").empty().append("Deine E-Mail Adresse wurde aus dem Verteiler gel&ouml;scht.");
			break;
		}
	} );
}
function searchbox() {
	ok = $("#okselect").val();
	land = $("#landselect").val();
	gebiet = $("#gebietselect").val();
	$("#searchbox").empty().append('<img src="./misc/workingsb.gif" title="" />');
	$("#searchbox").load("./ajax/searchbox.php?ok="+ok+"&land="+land+"&gebiet="+gebiet);
}
function sbJump() {
	url = $("#reiseselect").val();
	self.location.href="index.php?content=reisen_details&"+url;
}