$(document).ready(function(){
	//Fix h2/h3/h4 super-size first character:
	if($("h2").length > 0){
		$removeDiv = $("div.csc-header h2").parent().parent();
		$("div.csc-header h2").appendTo($('#superCharHeaderContainer'));
		$removeDiv.remove();
	}
	if($("h3").length > 0){
		$removeDiv = $("div.csc-header h3").parent().parent();
		$("div.csc-header h3").appendTo($('#superCharHeaderContainer'));
		$removeDiv.remove();
	}
	if($("h4").length > 0){
		$removeDiv = $("div.csc-header h4").parent().parent();
		$("div.csc-header h4").appendTo($('#superCharHeaderContainer'));
		$removeDiv.remove();
	}

	//Handle language selection rollover en offerte buttons:
	$("#nlBut").mouseenter(function(){
		$(this).attr("src","fileadmin/template/images/nl_lang_rolloover.png");
	}).mouseleave(function(){
		$(this).attr("src","fileadmin/template/images/nl_lang.png");
	});

	$("#enBut").mouseenter(function(){
		$(this).attr("src","fileadmin/template/images/en_lang_rolloover.png");
	}).mouseleave(function(){
		$(this).attr("src","fileadmin/template/images/en_lang.png");
	});

	$("#offerteButton").mouseenter(function(){
		$(this).attr("src","fileadmin/template/images/vrijblijvende_offerte_rollover.png");
	}).mouseleave(function(){
		$(this).attr("src","fileadmin/template/images/vrijblijvende_offerte.png");
	});

	//Fix .csc-textpic-text height:
	$("div.csc-textpic-text").height($("div.csc-textpic-text").height()-28);

	//Update #offerteDivLink href aan de hand van huidige taal..:
	$currentLang = getLanguageFromUrl();
	$("#offerteDivLink").attr("href", "/?id=7&L="+$currentLang);

	//Update #logoDivLink href aan de hand van huidige taal..:
	$("#logoDivLink").attr("href", "/?id=2&L="+$currentLang);
	
	//Update #algvwlink href aan de hand van huidige taal...:
	$("#algvwlink").attr("href", "/?id=9&L="+$currentLang);
});

function getLanguageFromUrl(){
	$urlString = window.location.href;
	//Search for "/en":
	if($urlString.indexOf("/en") > 0 || $urlString.indexOf("L=1") > 0 ){
		//lang is english:
		$langVal = "1";
	}
	else{
		//lang is dutch:
		$langVal = "0";
	}
	return $langVal;
}
