$(document).ready(function(){	$('.thickbox.toplink').click(function(){		setTimeout(function(){						$('html,body').animate({							scrollLeft: '+=' + (($('body').width() - $('#TB_title').width()) / 2) + 'px'						}, 'fast');						setTimeout(function(){							$('html,body').animate({								scrollTop: '+=' + $('#TB_title').offset().top + 'px'							}, 'fast');						}, 100);		}, 100);			});	$('select.wide').ieSelectStyle({		width : '30%',		applyStyle : false	});	$('input[name="voornaam"]').blur(function(){		$('.uitnodiging_default:eq(0)').html('Beste '+$(this).val()+',')	});	$("#uitnodigenSubmit").click(function(){		text1 = $('textarea.text_uitn').prev('.uitnodiging_default.first').html();		$('input[name=berichtkop]').val(text1);		text2 = $('textarea.text_uitn').next('.uitnodiging_default.last').html();		$('input[name=link]').val(text2);	});	//input file opmaken	$("input[type=file]").each(function(){		$(this).before('<div class="inputfile-wrapper"></div>');		$(this).prev().append('<div class="inputfile"><div class="inputfile-text"></div></div>');		$(this).appendTo($(this).prev());	});	$("input[type=file]").change(function(){		$(this).prev().children("div.inputfile-text").text($(this).val());	});    $.mask.definitions['1']='[10]';    $.mask.definitions['2']='[210]';    $.mask.definitions['3']='[3210]';    $("input#datum, #geboortedatum").mask("39-19-2999");    /* Links met rel external openen in nieuw venster*/    $("a[rel='external']").attr('target','_blank');    /* Opmaak tabellen Backroom*/    $(".deelnemer:even").addClass("even_deeln");	$("#content table tr th:first-child").addClass("first_th");	$("#content table tr td:first-child").addClass("first_td");	$("#content table tr th:last-child").addClass("last_th");	$("#content table tr td:last-child").addClass("last_td");	$("#content table tr:has(th)").addClass("tr_th");     	$("#content table").each(function(){		$(this).find("tr:odd").addClass("oneven");	});	$("#talentdetails div:odd").addClass("odd");	$('#talentdetails .talentdetail:first').addClass('first_detail');	$("#content table:not(.norollover)").find("tr:not(.tr_th)").hover(function(){		$("tr").removeClass("trhover");		$(this).addClass("trhover");	},function(){		$(this).removeClass("trhover");	});	$('input[name="factuur_tav"]').click(function() {		if($(this).val() == "Bovenstaande gegevens") {			$('#factuur_tav_extra').hide();			$('#factuur_tav_extra input').removeClass("required text");		} else {			$('#factuur_tav_extra').show();			$('#factuur_tav_extra input').addClass("required text");		}	});		$('.arrow .forw').click(function(){		if($('#competenties_select option').length < 3){			if($('#competenties').find('option:selected').length <= 3){				$('#competenties').find('option:selected').each(function(){					var val = $(this).text();					$('#competenties_select').append('<option selected="selected">' + val + '</option>');					$(this).remove();					$('.arrow .back').removeClass('inactive');					if($('#competenties_select option').length == 3){						$('.arrow .forw').addClass('inactive');					}				});			}else{				$('body').prepend('<div class="error">U mag maar 3 competenties selecteren<input type="button" value="OK" /></div>');				$('.error').css({					'z-index' : '2000',					'background-color' : '#FEF8E4',					'border' : '2px solid #525252',					'display' : 'block'				});				$('.error input').click(function(){					$(this).parent('.error').fadeOut('normal').remove();				});				$('*').keydown(function(){					$('.error input').focus();				});			}		}else{			$('body').prepend('<div class="error">U heeft al het maximum van 3 competenties geselecteerd.<input type="button" value="OK" /></div>');			$('.error').css({				'z-index' : '2000',				'background-color' : '#FEF8E4',				'border' : '2px solid #525252',				'display' : 'block'			});			$('.error input').click(function(){				$(this).parent('.error').fadeOut('normal').remove();			});			$('*').keydown(function(){				$('.error input').focus();			});					}	});	if($('#competenties_select option').length == 0){		$('.arrow .back').addClass('inactive');	}    $('.arrow .back').click(function(){		$('#competenties_select').find('option:selected').each(function(){			var val = $(this).text();			$('#competenties').append('<option>' + val + '</option>');            $(this).remove();			if($('#competenties_select option').length == 0){				$('.arrow .back').addClass('inactive');			}			if($('#competenties_select option').length < 3){				$('.arrow .forw').removeClass('inactive');			}		});	});	$('.submit').click(function(){		$('#competenties_select option').attr('selected','selected');	});	$('.submit').keypress(function(){		$('#competenties_select option').attr('selected','selected');	});    /*Klikbaar maken div's backroom*/    /*Mail in inbox linken*/    $('tr a').click(function(event) {        event.stopPropagation();    })    $("tr .divlink").parents("tr").click(function(){        window.location = $(this).find(".divlink").attr('href');    });	$(".divlink").parent("p").parent("div").click(function(){        window.location = $(this).find(".divlink").attr('href');    });	$("#laatste .divlink").parents(".item").click(function(){        window.location = $(this).find(".divlink").attr('href');    });            $('.opac').css('opacity','0.2');    if($('.twitter').length > 0){        var textTwitter = $('.twitter').html();        textTwitter = replaceURLWithHTMLLinks(textTwitter);        $('.twitter').html(textTwitter);    }        $('.zoeken.unset').click(function(){        var locatie = window.location.href;        $.ajax({			type: 'POST',			url: '/includes/zoekcriteria.php',			data: {criteria:'unset'},			complete: function() {				window.location = locatie;			}		});        return false;    });        $('.wide').change(function(){        var locatie = window.location.href;        var params = {};        params['add_'+$(this).attr('name')] = $(this).val();        params['criteria'] = 'add';		$.ajax({			type: 'POST',			url: '/includes/zoekcriteria.php',			data: params,			complete: function() {				window.location = locatie;			}		});    });        $('.criteria .delete').click(function(){        var locatie = window.location.href;        var name = 'delete_'+$(this).attr('rel');        var params = {};        params[name] = $(this).parent('.criteria').attr('title');        params['criteria'] = 'delete';		$.ajax({			type: 'POST',			url: '/includes/zoekcriteria.php',			data: params,			complete: function() {				window.location = locatie;			}		});        return false;    });	    successMessage();    errorMessage();});function confirmBackground(){    var box = document.createElement('div');    box.id = 'ajaxBg';    document.body.appendChild(box);}function myConfirm(tekst, obj){    confirmBackground();    hrefs = ((eval("obj"))?obj.href:'#');    var box = document.createElement('div');    box.className = 'confirm';    box.id = 'confirm';    document.body.appendChild(box);    document.getElementById('confirm').innerHTML = "<div class=\"confirm_title\">Waarschuwing</div><p>"+tekst+"</p><div class=\"confirm_buttons\"><input type=\"button\" value=\"Annuleren\" onclick=\"myConfirmDelete()\" /><input type=\"button\" onclick=\"window.location='"+hrefs+"'\" value=\"Akkoord\" /></div>";    return false;}function myConfirmDelete(){    myBgDelete();    document.body.removeChild(document.getElementById('confirm'));}function myBgDelete(){    document.body.removeChild(document.getElementById('ajaxBg'));}jQuery.fn.center = function () {    this.css("position","fixed");    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");    return this;}function successMessage() {    if($('.success').length){        confirmBackground();        //$('.success').center();        $('.success').css({            'z-index' : '2000',            'background-color' : '#FEF8E4',            'border' : '2px solid #525252',            'display' : 'block'        });        /*setTimeout(function(){            $('.success').fadeOut("normal", myBgDelete);        }, 2500);*/        $('.success').append('<input type="button" value="Ok" onclick="$(\'.success\').fadeOut(\'normal\', myBgDelete);" />');    }}function errorMessage() {    if($('.error').length){        confirmBackground();        //$('.error').center();        $('.error').css({            'z-index' : '2000',            'background-color' : '#FEF8E4',            'border' : '2px solid #525252',            'display' : 'block'        });        /*setTimeout(function(){            $('.error').fadeOut("normal", myBgDelete);        }, 3000);*/        $('.error').append('<input type="button" value="Ok" onclick="$(\'.error\').fadeOut(\'normal\', myBgDelete);" />');    }}function replaceURLWithHTMLLinks(text) {    var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;    return text.replace(exp,"<a target='_blank' href='$1'>$1</a>"); }
