$(document).ready(function(){


/*
if($("#content_wrap").height() < (document.documentElement.clientHeight - 230))
$("#content_wrap").height(document.documentElement.clientHeight-230);
*/


var pix = new Array();



//carousel handlers
$(".jcarousel-item").each(
function(){
	
	
	 var index = parseInt($(this).attr("jcarouselindex"));
	 pix[index] = $(this).children("img").attr("rel");
	
	 $(this).click(function(){
	 	$(".img_holder").html("").css("background","url(http://www.dubet.com/images/loading.gif) no-repeat center").css("height","200px");
	 var src = $(this).children("img").attr("rel");
	 var desc = $(this).children("img").attr("alt");
	 //var title = $(this).children("img").attr("title");
	 var title = $(".project_name").text();
	 
	 var index2 = parseInt($(this).attr("jcarouselindex"));
	 var pre="",post="";
	 for(var i= 1;i<index2;i++)
	 {	//alert("i:"+i+"\n src:"+pix[i]);
	 	pre+="<a href='"+pix[i].replace("&w=450&h=380","")+"' rel='lytebox[main]'></a>";
	 }
	 for(var j=(index2+1);j<pix.length;j++)
	 {	//alert("j:"+j+"\n src:"+pix[j]);
	 	post+="<a href='"+pix[j].replace("&w=450&h=380","")+"' rel='lytebox[main]'></a>";
	 }
		 
	 
	 if(typeof(desc)=='undefined')
	 	desc='-';
	 //alert(src);
	 $(".img_holder").html("<div id='pic_hider' style='display:none;'>"+pre+"<a href='"+src.replace("&w=450&h=380","")+"' rel='lytebox[main]'><img border='0' src='"+src+"' onload='show_img()' /></a>"+post+"</div>");
	 $(".desc_holder").html("<strong>"+title+"</strong><br />"+desc);
	 initLytebox();
	 })
	 
}
);

if(pix.length<=4)
{
	$(".jcarousel-prev").hide();
	$(".jcarousel-next").hide(); 
}


$(".menu_link_wrap").each(
function(){
	
	$(this).hover(
			function() {
				$(this).children("#subnavmenu").slideDown(100);
			},
			function() {
				$(this).children("#subnavmenu").slideUp(100);
			}
	)
	
}
);


$(".contact_me_link").toggle(
			
				function() {$("#contact_me").slideDown(500);},
				function() {$("#contact_me").slideUp(300);}
		
		
);





});
function formulierTestContactMe(formulierVeld, taal)
	{
		switch(taal)
		{
			case 1:
			var veldBeschrijving = Array("Contactpersoon", "E-Mail");
			var alertBoodschap = "Gelieve volgende velden in te vullen:\n";
			break;
			case 2:
			var veldBeschrijving = Array("Contact", "E-Mail");
			var alertBoodschap = "Please fill in the following fields:\n";
			break;
			case 3:
			var veldBeschrijving = Array("Name", "E-Mail");
			var alertBoodschap = "Mit * gekennzeichnete Felder sind Pflichtfelder:\n";
			break;
		}		
		
		var verplichtVeld = Array("Contactpersoon", "Email");
		var Boodschap = alertBoodschap.length;
		
		for (var i = 0; i < verplichtVeld.length; i++)
		{
			var obj = formulierVeld.elements[verplichtVeld[i]];
			if (obj)
			{
				switch(obj.type)
				{
					case "select-one":
						if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "")
						{
							alertBoodschap += "-" + veldBeschrijving[i] + "\n";
						}
						break;
					case "select-multiple":
						if (obj.selectedIndex == -1)
						{
							alertBoodschap += " - " + veldBeschrijving[i] + "\n";
						}
						break;
					case "text":
					case "textarea":
						if (obj.value == "" || obj.value == null)
						{
							alertBoodschap += " - " + veldBeschrijving[i] + "\n";
						}
						break;
					default:
						if (obj.value == "" || obj.value == null)
						{
							alertBoodschap += " - " + veldBeschrijving[i] + "\n";
						}
				}
			}
		}
		if (alertBoodschap.length == Boodschap)
		{
			return true;
		}
		else
		{
			alert(alertBoodschap);
			return false;
		}
	}

