if (top.location != location)
	top.location.href = document.location.href;

function toggle(id){
	obj = document.getElementById(id);
	if (obj.style.display == 'none')
		obj.style.display = '';
	else
		obj.style.display = 'none';
}

jQuery.fn.extend({
  check: function() {
	 return this.each(function() { this.checked = true; });
   },
   uncheck: function() {
	 return this.each(function() { this.checked = false; });
   }
});


$(document).ready(function(){

	// inloggen.. vervangt button door image
	$('#submitImage').css({ display: 'block', cursor: 'pointer'});
	$('#submitButton').css({ display: 'none' });
	
	$("#inputRemember").css({ background: 'url(/images/inloggen_remember.gif) 0 20px', padding: '0 0 0 17px' }); 
	$('#inputCookie').css({ display: 'none' });	

	$('#submitImage').click( function(){ document.forms['inloggen'].submit(); } );

	$("#inputRemember").toggle( function(){ 
		$("#inputRemember").css({ background: 'url(/images/inloggen_remember.gif) 0 0' }); 
		$("#inputCookie").check();
	} , function(){ 
		$("#inputRemember").css({ background: 'url(/images/inloggen_remember.gif) 0 20px' }); 
		$("#inputCookie").uncheck();		
	} ) 

	// maak de velden leeg op een onfocus als hij nog op "Gebruikersnaam" of "Wachtwoord" staat.. Bij wachtwoord de atribute text op password zetten
	$('#inputUsername').focus( function() { if($('#inputUsername').val() == "Gebruikersnaam") { $('#inputUsername').val('');  } } );
	$('#inputPassword').focus( function() { if($('#inputPassword').val() == "Wachtwoord") {     $('#inputPassword').val('');  } } );


})

function radiopop(URL) {
venster = window.open(URL, 'popupvenster', 'width=258, height=220, resizable=no, menubar=no, scrollbars=no, status=no, toolbar=no');
}

// dit is een stukje javascript van erik
function closeMessage(){
	document.getElementById("message_container").style.display  = "none";
}
function closeError(){
	document.getElementById("error_container").style.display  = "none";
}
function getImageWidth() {
	return document.getElementById("image").offsetWidth;
}

function imageLoaded() {
	document.getElementById("image").onload=null;	
	
	document.getElementById("image_content").style.width  = getImageWidth()+"px";	
	document.getElementById("message").style.width  = getImageWidth()+"px";
	
//	var outerBox = document.getElementById("error_w");
//	var innerBox = document.getElementById("error_w2");

	var outerBox = document.getElementById("image_w");
	var innerBox = document.getElementById("image_w2");

	var initialHeight = outerBox.offsetHeight;
	var documentHeight = document.body.offsetHeight;
	var windowHeight = document.body.clientHeight;
	var minimumHeight = (documentHeight > windowHeight) ? documentHeight : windowHeight;
	if(initialHeight < minimumHeight) {
		outerBox.style.height = minimumHeight;
		innerBox.style.height = minimumHeight;
	}
}

function openImage(imageUrl/*,imageNumber*/){

	document.getElementById("image_content").style.width  = "640px";	
	document.getElementById("message").style.width  = "640px";

	document.getElementById("image_container").style.display  	= "";
	document.getElementById("image").onload = imageLoaded;
	document.getElementById("image").src  = imageUrl;
}

function closeImage(){
	document.getElementById("image_container").style.display  = "none";
	document.getElementById("image").src  = "/image/spacer.gif";
	document.getElementById("image_content").style.width  = "640px";	
	document.getElementById("message").style.width  = "640px";	
}
