// JavaScript Document
function Cufon_replace() {
	Cufon.replace('.lnk', 'journal');
	Cufon.replace('.personen', 'journal');
	Cufon.replace('.slaapkamers', 'journal');
	Cufon.replace('.print', 'journal');
}
$(document).ready(function() {

	$("#taalkeuze select").selectbox();
	$("span:contains('Nederlands')").addClass("nl");
	$("span:contains('Deutsch')").addClass("de");
	
	$("#taalkeuze .jquery-selectbox-item").click(function() { 
		$("span").removeClass("nl");
		$("span").removeClass("de");
		$("span:contains('Nederlands')").addClass("nl");
		$("span:contains('Deutsch')").addClass("de");
		
		var lang = $(this).text();
		var code = "nl";
		if 			(lang == "Nederlands") 	{ code = "nl"; }
	  	else if 	(lang == "Deutsch") 	{ code = "de"; }
		else if 	(lang == "English")		{ code = "en"; }
		window.location = "http://www.geuldal.com/"+code;
		return false;
	});	
	
// --- Tabbed content ajax ----------------------------------------------------------------------------------
	$(".nolink").unbind('onmouseover').unbind('onmouseout');
	$(".nolink").live("click",function() { 
		return false;
	});
	$(".tabs-detail li a").live("click", function() {
		$('.content').load('ajax/detail.php?url='+$(this).attr("href"));
		$("#tabs li a").removeClass("active");
		$(this).addClass("active");
		return false;
	});
	//$(".tabs-omgeving li a").live("click", function() {
	//	$('.content').load('ajax/omgeving.php?url='+$(this).attr("href"));
	//	$('#headerimage').load('ajax/replace_header_omgeving.php?url='+$(this).attr("href"));
	//	$('.foto-container').load('ajax/replace_images_omgeving.php?url='+$(this).attr("href"), function() { $("a[rel='gallery']").colorbox(); });
	//	$("#tabs li a").removeClass("active");
	//	$(".sign-wrapper h1").html("Omgeving - "+$(this).html());
	//	$(this).addClass("active");
	//	return false;
	//});	
	//$(".tabs-teksten li a").live("click", function() {
	//	$('.content').load('ajax/tekst.php?url='+$(this).attr("href"));
	//	$('#headerimage').load('ajax/replace_header_tekst.php?url='+$(this).attr("href"));
	//	$('.foto-container').load('ajax/replace_images_tekst.php?url='+$(this).attr("href"), function() { $("a[rel='gallery']").colorbox(); });
	//	$(".sign-wrapper h1").load('ajax/replace_titel_tekst.php?url='+$(this).attr("href"));
	//	$("#tabs li a").removeClass("active");
	//	$(this).addClass("active");
	//	return false;
	//});	

	$('#headerimage').cycle('fade');

	$(".lijst-blok a.leesmeer").live("click", function() {
		$(".lijst-blok a.leesmeer").show();
		$(".lijst-blok a.leesmeer").parent().find(".kort").show();
		$(".lijst-blok a.leesmeer").parent().find(".lang").hide();
		$(this).parent().find(".kort").hide();
		$(this).parent().find(".lang").show();
		$(this).hide();
		return false;
	});

// --- Colorbox ----------------------------------------------------------------------------------

	$("a[rel='gallery']").colorbox({width:"654px", height:"469px"});	
	$("a[rel='youtube']").colorbox({width:"425px", height:"344px", iframe:true});
	$("#tellafriend").colorbox({width:"425px", height:"344px", iframe:true});

// ---- Image scroller --------------------------------------------------------------------------------------
  
    $(".paging .prev").hide();
   
    var aantal = $(".scrollwrap ul").size();
	var active = 1;
	if (aantal<2) { $(".paging .next").hide(); }

	$(".scrollwrap ul").each(function(i) {
		var index = parseInt(i);
		var aantal = 305 * i;
		$(this).css("left",aantal+"px");
    });
	
	$(".paging .next").click(function() { 
		$(".scrollwrap ul").animate({"left": "-=305px"}, 300);								  
		active = active+1;
		if (active==aantal) { $(this).hide(); } else { $(this).show(); }
		if (active==1) 		{ $(".paging .prev").hide(); } else { $(".paging .prev").show(); }
		return false;
	});
	$(".paging .prev").click(function() { 
		$(".scrollwrap ul").animate({"left": "+=305px"}, 300);								  
		active = active-1;
		if (active==aantal) { $(".paging .next").hide(); } else { $(".paging .next").show(); }
		if (active==1) 		{ $(this).hide(); } else { $(this).show(); }
		return false;
	});	


// ---- Filters ------------------------------------------------------------------------------------------------

	$("#filter-submit").click(function() { 
		$("#filters-form").submit();
		return false;
	});
	
});

