var pag = 1;
var total_pages = 0;
var temp = "";



function mycarousel_initCallback(carousel) {
    jQuery('a.car_con').bind('click', function() {
		var pagi = jQuery.jcarousel.intval(jQuery(this).attr("pag"));
		pag = ((pagi - 1)/3) + 1;
        carousel.scroll(pagi);
		  });



	$('.jcarousel-next').click(function() {
	if (pag > 0 && pag <total_pages)
	 {
		pag++;
		
		}
	});	


$('.jcarousel-prev').click(function() {
	if (pag > 1 && pag <=total_pages) {
		pag--;
		
		}	
});

};
var menu_obj = null;
var sub_menu_obj = null;

function checkHover()
{
	if(sub_menu_obj==null)
		$(".menu_holder").slideUp(200);
		
}
function checkHover2()
{
	if(menu_obj==null)
		$(".menu_holder").slideUp(200);
		
}

$(document).ready(function(){
	
$("#newsletter_email").click(function(){if($(this).val() == "E-mailadres...")
{$(this).val("");$(this).css("color","#000");}});
$("#newsletter_email").blur(function(){if($(this).val().length == 0)
{$(this).val("E-mailadres...");$(this).css("color","#B4BDC6");}});

$("#newsletter_name").click(function(){if($(this).val() == "Naam...")
{$(this).val("");$(this).css("color","#000");}});
$("#newsletter_name").blur(function(){if($(this).val().length == 0)
{$(this).val("Naam...");$(this).css("color","#B4BDC6");}});


var lh = $("#menu").height();
var mh = $("#display").height();
var rh = $("#right_side").height();

if ($.browser.msie) {
	if(parseInt($.browser.version) == 7)
	  $("#menu").width(218);
	}

var maxh = lh;
if(lh > mh)
{
	if(lh > rh)
		maxh = lh;
	else
		maxh = rh;	
}
else
{
	if(mh > rh)
		maxh = mh;
	else
		maxh = rh;	
}

$("#menu").height(maxh);

if(maxh > mh)
$("#display").height(maxh);

$("#right_side").height(maxh);

$("#menu_holder > a").each(function(){
	
	if($(this).next("div").length)
	{
		var menu = $(this).next("div");
		var off = $(this).position();		
		var newleft = parseInt(off.left);
		//alert(newleft);
		menu.css("left",newleft+"px");
		
		$(this).hover(
				function(){
						$("#menu_holder div").not(menu).hide();
							menu.show();}
				,function(){/*menu.slideUp("fast",end_animation(menu));*/}
		);
		
		menu.hover(
				function(){/*menu.slideDown("fast",end_animation(menu));*/}
				,function(){menu.hide();}
		);
		
	}
	else
	{
		$(this).hover(	function(){	$("#menu_holder div").hide();}
				,function(){}
		);
	}
	
	$("a").each(
			function() {
		$(this).focus(function(){$(this).blur()});
			}
	);
	
});


$("#search_term_small").click(function(){
	if($(this).val() == "Zoeken...")
	{
		$(this).val("");
		$(this).css("color","#000");
	}
});

$("#search_term_small").blur(function(){
	if($(this).val().length == 0)
	{
		$(this).val("Zoeken...");
		$(this).css("color","#ccc");
	}
});

$("textarea").each(function() {

$(this).click(function(){
	
	if($(this).attr("clicked") != "yes")
	{
		var old_val = $(this).val();
		$(this).val("");
		if(old_val.length)
		{
			$(this).after("<p style='color:#143F4F;display:none'>"+old_val+"</p>");		
			$(this).next("p").slideDown("slow");			
		}
		$(this).attr("clicked","yes");
	}

});
});

$(window).resize(function() {SetOverflow()});

});

function SetOverflow()
{
	winWidth=document.all?document.body.clientWidth:window.innerWidth;
	
	
	if(winWidth < 960)
	{
		$("body").css("overflow-x","scroll");
	
	}
	else
		{$("body").css("overflow-x","hidden");
		
		}
}

function end_animation(elem)
{
	elem.queue("fx",[]);
	elem.stop();
}



function verify_search()
{
	var search_term = $("#search_term").val();
	if(search_term.length < 3 || search_term=='Voer hier uw zoekterm in...' || search_term=='Zoeken...')
	{
		alert("Uw zoekopdracht dient uit tenminste drie karakters te bestaan!");
		return false;
	}
	var cbpa = $("#searchinpagina:checked").length;
	var cbne = $("#searchinnews:checked").length;
	var cbpr = $("#searchinprojects:checked").length;
	if(cbpa==0 && cbne==0 && cbpr==0)
	{
		alert("You must select at least one search area!");
		return false;
	}
	return true;
	
	
}

function verify_search2()
{
	var search_term = $("#search_term_small").val();
	if(search_term.length < 3 || search_term=='Voer hier uw zoekterm in...' || search_term=='Zoeken...')
	{
		alert("Uw zoekopdracht dient uit tenminste drie karakters te bestaan!");
		return false;
	}
	
	return true;	
}

function change_submit()
{
	$(document).ready(function(){
	var x = null;
	$("input").each(
	function(){
	if($(this).attr("name") == "submit_form")
	x = $(this);
	}
	);
	
	x.css("width","114px")
	.css("height","30px")
	.val("").css("border","none").css("float","left")
	.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_up.jpg') no-repeat 0 0");
	
	x.hover(
		function(){x.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_over.jpg') no-repeat 0 0")}
		,function(){x.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_up.jpg') no-repeat 0 0")}
			);
	
	
	x.parent("td").attr("align","left");		
	x.after("<a href='#'><img border='0' id='contact_telefon_img' src='http://www.vdict.nl/burodeburen/quest/images/buttons/button_telefonisch_contact_up.jpg' /></a>")
	$("#contact_telefon_img").hover(
			function(){$(this).attr("src","http://www.vdict.nl/burodeburen/quest/images/buttons/button_telefonisch_contact.jpg")}
			,function(){$(this).attr("src","http://www.vdict.nl/burodeburen/quest/images/buttons/button_telefonisch_contact_up.jpg")}
	);
	
	});
}

function change_submit2()
{
	$(document).ready(function(){
	var x = null;
	$("input").each(
	function(){
	if($(this).attr("name") == "submit_form")
	x = $(this);
	}
	);
	
	x.css("width","114px")
	.css("height","30px")
	.val("").css("border","none")
	.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_up.jpg') no-repeat 0 0");
	
	x.hover(
		function(){x.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_over.jpg') no-repeat 0 0")}
		,function(){x.css("background","url('http://www.vdict.nl/burodeburen/quest/images/buttons/button_verstuur_up.jpg') no-repeat 0 0")}
			);
	
	
	});
}


