function initialize() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("maps"));
		map.setCenter(new GLatLng(51.4415, 5.4800 ), 15);
		var latlng = new GLatLng(51.4415,5.4800);
        map.addOverlay(new GMarker(latlng));
	}
}

$(document).ready(docFunctions);

function docFunctions() {
	if($('#maps').length>0) initialize();
	
	//GET URL
	function getHost() {
		var a = document.URL.split("//");
		a = (a[1] ? a[1] : a[0]).split("/"); 
		//alert(a.join("\n"));
		currentPage = a[1];
	}
	getHost();
	
	$("input#submit").mouseover(function(){
		$(this).attr('src','layouts/rendev/images/versturen_on.png');
	});
	
	$("input#submit").mouseout(function(){
		$(this).attr('src','layouts/rendev/images/versturen_off.png');
	});
	
	$("#cat li, #sub li, .sub2 li").each(function(){
		$(this).hover(
		  function () {
			if(!$(this).hasClass('active')) $(this).css('background-image','url(layouts/rendev/images/arrow_sub_roll.png)');
		  }, 
		  function () {
			if(!$(this).hasClass('active')) $(this).css('background-image','none');
		  }
		);
		
		if($(this).hasClass('active')) {
			$(this).children('a').children('span').css('font-weight', 'bold');
			$(this).css('background-image','url(layouts/rendev/images/arrow_sub.png)');
		}
	});
	
	//VIDEO POPUP
	$(".lightbox").click(function() {
		$.fancybox({
				//'padding'		: 0,
				'href'			: this.href,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});
	
		return false;
	});	
	
	//VIDEO POPUP
	$("#watchvideo").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: true,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 640,
				'height'		: 360,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});
	
	$(".watchvideo").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: true,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 640,
				'height'		: 360,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					 'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});

	$('.sub2').easyListSplitter({ 
		colNumber: 2,
		perCol: 6
	});
	
	$(".jobRight a").each(function() {
		$(this).hide();
	});
	
	$(".jobContainer").each(function() {
		if($(this).hasClass('notactive')) {
			$(this).children(".jobLeft").children('h1').css('text-decoration', 'line-through');
			$(this).children(".jobLeft").children('h2').css('text-decoration', 'line-through');
			$(this).children(".jobLeft").children("H1").css('color','#a1a1a1');
			$(this).children(".jobLeft").children("H2").css('color','#a1a1a1');
		}
	});
	
	$(".jobContainer").hover(
	  function () {
		if(!$(this).hasClass('notactive')) {
			$(this).children(".jobLeft").children("H1").css('color','#505050');
			$(this).children(".jobLeft").children("H2").css('color','#505050');
		}
		$(this).css('background-image','url(layouts/rendev/images/vac_verloop.png)');
		$(this).children(".jobRight").children(".btn_sol").show();
		$(this).children(".jobRight").children(".btn_info").show();
		
	  }, 
	  function () {
		if(!$(this).hasClass('notactive')) {
			$(this).children(".jobLeft").children("H1").css('color','#009DDC');
			$(this).children(".jobLeft").children("H2").css('color','#009DDC');
		}
		
		$(this).css('background-image','none');
		$(this).children(".jobRight").children(".btn_sol").hide();
		$(this).children(".jobRight").children(".btn_info").hide();
	  }
	);
};

function submitContactForm(){
	continueForm=true;
	errorText='';
	$('.not_empty').each(function(){
		if($(this).val()==""){
			errorText+="- "+$(this).attr("id")+" is niet gevuld"+'\n';
			continueForm=false;
		}
	});
	
	if(continueForm==true){
		$("#form_4").submit();
	}
	else {
		alert(errorText);	
	}
}

function changeJob(jobid) {
	elid = $('#selectJob option:selected');
	document.location.href = elid.attr('url');
}
