$(document).ready(function() {

	$("ul.sf-menu").superfish();
	$("a.external").live("click", function(){window.open(this.href);return false;});
	$(".cornerr li a").corner("br tr 8px");
	$(".item").corner("8px");
	$('#InhoudBB').markItUp(mySettings);
	
	$('.editOpdracht').editable("editpage.php", {
        indicator : 'Saving...',
        type: "textarea",
        rows: "2",
        cols: "58",
        style: "display:inline",
        onblur : "submit",
        tooltip   : "Klik om aan te passen...",
        submitdata : function(value, settings) {
        	var vdat = $(this).attr('lang');
        	return {veld: vdat };
        }
    });
	
	
	 function show() {
		 var menu = $(this);
		 menu.children(".actions").slideDown();
	 }
 
	 function hide() { 
		 var menu = $(this);
		 menu.children(".actions").slideUp();
	 }

	 $(".hover-menu").hoverIntent({
		 sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
		 interval: 50,   // number = milliseconds for onMouseOver polling interval
		 over: show,     // function = onMouseOver callback (required)
		 timeout: 300,   // number = milliseconds delay before onMouseOut
		 out: hide       // function = onMouseOut callback (required)
	 });

		  
		var aantal = $(".image").length;
		if (aantal == 0){
			var aantal = $(".imagelist").length;
			 if (aantal ==0){}
			 else {
				var hoogte = aantal/6*120;
			    $(".item").animate( { height: hoogte + "px"}, 1000 );
			 }
		}
		else {
			var hoogte = aantal/3*250;
	    	$(".item").animate( { height: hoogte + "px"}, 1000 );
		}
		
	
 $("#Soort").change(function () {
 			  if ($("#Soort option:selected").text() == "Foto Item"){
	              $("#mapShow").show();
	              $("#FotoURLShow").hide();
              }
              else if ($("#Soort option:selected").text() == "Voorstelling"){
	                  $("#FotoURLShow").show();
		              $("#mapShow").hide();
		              $("#Map").val("");
	          }
	          else {
	              $("#mapShow").hide();
	              $("#Map").val("");
	              $("#FotoURLShow").hide();
              }
         
        });
        
 
	           $('#slide').cycle({
			    fx:     'shuffle',
			    timeout: 5000,
			    pause:	1
			  });


	$("h2.show").live("click", function(){
	var id = $(this).parent().children("a:first").attr('id');
	
		$("div.pic").children("p").fadeOut(500);
		$("div.pic").children("ul").fadeOut(500);
		$(this).parent().children("p").fadeIn(1000);
		$(this).parent().children("ul").fadeIn(1000);
		$("a."+id).zoomimage({centered:true, border: 10});
		
	});


});
