$(document).ready(function(){
	// ie workaround, cause otherwise the background ends to soon
	if ($.browser.msie && parseInt($.browser.version) <= 6)
	$('#spacer').css('height', $('body').height());
});

function changeLankotex() {
	window.location.href = '/lankotex/'+$('#cat').val()+'/';
}

function checkEmail() {
	// just use a reg.ex. to determine if value is correct
	var reg = new RegExp("^[0-9a-zA-Z\-\_\.]+@[0-9a-zA-Z\-]+[\.]{1}[0-9a-zA-Z\-]+[\.]?[0-9a-zA-Z]+$");

	if(reg.test($('#emailadres').val())){
		$('#subscribe .content').load('/inc/email.ajax.php', {'emailadres': $('#emailadres').val()});
	} else {
		window.alert('Het ingevoerde emailadres is onjuist.');
	}
	return false;
}

function showPopup(image){
	if ($('#bg').length == 0) {
		$("#content").before('<div id="bg"></div><a href="#" onClick="hidePopup(); return false;" id="close"></a><div id="popup"></div>');
	}
	
	$('#bg').height($('body').height());
	$('input, select').hide();
	
	$('#popup').html('<img src="'+image+'" width=\"450\" height=\"450\" alt="">');
	
	// center popup
	$('#popup').css('left', ($(document).width()/2-$('#popup').width()/2) + 'px');
	$('#popup').css('top', "50px");

	$('#close').css('left', ($(document).width()/2-$('#popup').width()/2+10) + 'px');
	$('#close').css('top', "60px");


	$('#bg').show().fadeTo(0, 0.8);
	$('#popup').show();
	$('#close').show();

	$('#bg').click(hidePopup);
	// $('#popup').click(hidePopup);
}

function hidePopup() {
	$('input, select').show();

	$('#bg').hide();
	$('#popup').hide();
	$('#close').hide();
}

$(document).ready(function() {
	// $("#all").click(function() {
	// 	var checked_status = this.checked;
	// 	$(".all").each(function() {
	// 		this.checked = checked_status;
	// 	});
	// 	$('#form_mat').submit();
	// });
});
