$(document).ready( function() {
	//IE
	 if($.browser.msie) { $( function() { 
		$('input[@type=submit]').addClass('submit');
		$('#nav li').hover(
			function() { $(this).toggleClass('hover');},
			function() { $(this).toggleClass('hover');}
		);
		$('#breadcrumbs li:first, #nav li:first').addClass('first-child');
	 })};
	 
	//LAST
	$('#right .meer:last').addClass('last');
	
	//TABLES
	$('table').not('.not').each(function(){
		$('tbody tr', $(this))
			.mouseover(function() { $(this).addClass('hover'); })
			.mouseout(function() { $(this).removeClass('hover'); });
	})
	
	$('table tbody tr:even').addClass('odd');

	//Search field
	$('#search').one('focus',function(){
		$(this).attr('value','');
	});
	
	//Nav corners & moving bar underneath
	$('#nav').append('<i></i><i class="tr"></i><i class="bl"></i><i class="br"></i>');
	$('#nav > li').each(function(){
		var xLeft = $(this).offset();
		var xWindow = $(document).width();
		$(this).append('<b></b>').children('b').css('width', eval((972-xWindow)/2+xLeft.left+$(this).width()-8));
	});
	
	//Right titles js fix
	$('#right h2').css('padding',0).contents().wrap('<span style="padding: 0 10px"></span>');

	//Font Resizer
	font_resizer();

	
} );
  
function font_resizer() {
	//Font resizer. This one is specifically adapted for using 3 inline font-sizez. 
	//This only works with relative-unit font-sizes, by setting a different font-size on the body. 
	var f_size = '75%';
	var size = new Array();
	var size = [f_size,'68.75%','75%','81.25%'];
	
	if (!$.cookie('font_size')) $.cookie('font_size',size[2]);
	size[0] = $.cookie('font_size');
		
	$('body').css("font-size", size[0]);	
		
	//Add a click event to the resize links and set the cookie	
	$('#top p:first a').each(function(i){
		$(this).click(function(){
			$.cookie('font_size',size[i+1], 356);
			$('body').css("font-size", size[i+1]);
		});
	});
}

function checkit(form) 
{ 
    var error = false;
    if(document.getElementById("firstname_val").value==''){
	document.getElementById("firstname").style.backgroundColor = '#990000';
	document.getElementById("firstname").style.color = '#ffffff';
	var error = true;
    }
    if(document.getElementById("lastname_val").value==''){
        document.getElementById("lastname").style.backgroundColor = '#990000';
	document.getElementById("lastname").style.color = '#ffffff';
	var error = true;
    }
    if(document.getElementById("position_val").value==''){
        document.getElementById("position").style.backgroundColor = '#990000';
	document.getElementById("position").style.color = '#ffffff';
	var error = true;
    }
    if(document.getElementById("email_val").value==''){
        document.getElementById("email").style.backgroundColor = '#990000';
        document.getElementById("email").style.color = '#ffffff';
        var error = true;
    }
				
    
    if(error == true){
        alert ('U heeft sommige velden niet ingevoerd!');
	return false;
    }else{
	return true;
    }
    
    /*
    alert(document.getElementById("firstname_val").value);
    var i = 0, el; 
    var error = false;
    
    while ((el = form.elements[i++])) 
    { 
        if (el.tagName.toLowerCase() == 'input' && el.type == 'text' && /^\s*$/.test(el.value)) 
            break; 

        //-- eventueel afhandeling van andere elementen/types 
    } 

    if (!el.value) 
    { 
        //-- error, cancel submit 
        el.style.backgroundColor = '#990000'; 
	el.style.color = '#ffffff';
	var error = true;
    } 
    
    if(error == true){
	alert ('U heeft sommige velden niet ingevoerd!');
	return false;
    }
    
    
    //-- submit 
    return true; 
    */
}

function printthispage() 
{ 
    var body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><base href="http://www2.virgielreunist.nl/" /><link rel="stylesheet" type="text/css" href="typo3temp/stylesheet_7c8a3c485d.css" /><link rel="stylesheet" type="text/css" href="fileadmin/styles/styles_print.css" /><title>Virgiel Reünist&nbsp;-&nbsp;Aanmeldformulier&nbsp;-&nbsp;Print uw gegevens</title></head><body onload="window.print();"><div id="content" class="tx-srfeuserregister-pi1 col"><img src="/fileadmin/images/reunisten_logo.gif"><p class="bodytext">';
	var bodyend = '</p><table cellpadding="15px" cellspacing="15px" border="0"><tr><td>Datum:<br /><br />________</td><td>Plaats:<br /><br />________</td><td>Handtekening:<br /><br />________</td></tr></table></div><script type="text/javascript" language="JavaScript">document.getElementById(\'buttonsPreview\').style.display="none";document.getElementById(\'unimportant\').style.display="none";window.status="Sanctus Virgilius";</script></body></html>';
	var content = document.getElementById('printpreviewdiv').innerHTML;
	var a = window.open('','printPage','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
	
	a.document.write(body+content+bodyend);
	a.document.close();
}


function pageprinted()
{
	if (confirm("Let op! Druk op 'OK' als u de pagina reeds geprint en per post verstuurd heeft. Druk anders 'Annuleren/Cancel' om dit als nog te kunnen doen.")) {
   		return true;
  	} else {
		return false;
	}
}

