	var radioPlayer;
	function radioPlayerReady(obj) {
		//alert('the videoplayer '+obj+' has been instantiated');
		radioPlayer = document.getElementById(obj);
	};
	
	var videoPlayer;
	function videoPlayerReady(obj) {
		//alert('the videoplayer '+obj+' has been instantiated');
		videoPlayer = document.getElementById(obj);
	};
	
	var mainImagePlayer;
	function mainImagePlayerFunct(obj) {
		//alert('the videoplayer '+obj+' has been instantiated');
		mainImagePlayer = document.getElementById(obj);
	};
	

	//Jump function for keyup on donateur Worden
	function jump() {
		var num1 = $('#postcode').val().length;
		
		if(num1 == 4) {
			$('#postcode2').focus();
			$('#postcode').valid();
		}
		
	};
	
	function jump2() {
		var num2 = $('#postcode2').val().length;
		
		if(num2 == 2) {
			$('#huisnummer').focus();
			$('#postcode2').valid();
		}
	};
	
	function jump3() {
		var num1 = $('#POSTCODE_2').val().length;
		
		if(num1 == 4) {
			$('#POSTCODE_2_2').focus();
			$('#POSTCODE_2').valid();
		}
	};
	
	function jump4() {
		var num2 = $('#POSTCODE_2_2').val().length;
		
		if(num2 == 2) {
			$('#huisnummer_2').focus();
			$('#POSTCODE_2_2').valid();
		}
	};
	
	//Disable Submit Btn Function
	function disableSubmit(form){
		if ( $('#'+form).validate().form() ){
			$("#submitBtn").attr("disabled","disabled");
		}
	};
	
	// !bank nummer Function
	function updateBankNumber(inputId) {
		
		//var formBase = document.forms[formNameForCheck];
		var accountNumber = $('#'+inputId).attr('value');
		
		var url = '/3rd_party/adresXpress/elf.php?rek=' + accountNumber;
		//alert(url);
		
		if( accountNumber != "" ){
			//call php for address
			$.ajax({
				url: url, 
				success: function(data) { 
									
					$('#datafromajax').append(data); 
					//alert(data);
					if ( data == "<script>false</script>") {
						$('#banknumberError').append('<label class="error">Incorrect Banknumber.</label>');
					} else {
						$('#banknumberError').empty();
					};
					
				}
			});
	
		}
	};
	
	// check if user exists
	function checkExisting(formNameForCheck){
		var formBase = document.forms[formNameForCheck];
		var pc1 = formBase.IN_ADDRESS_POSTCODE.value;
		var pc2 = formBase.IN_ADDRESS_POSTCODE2.value;
		var huis = formBase.IN_ADDRESS_HOUSE_NO.value;
		var init = formBase.IN_PERSON_INITIALS.value;
		var sur = formBase.IN_PERSON_SURNAME_1.value;

		var path = "/3rd_party/adresXpress/checkDetails.php?pc1=" + pc1 + "&pc2=" + pc2 + "&huis=" + huis + "&init=" + init + "&sur=" + sur;
		
		
		//alert(path);
		$.ajax({
			url: path,
			success: function(data) {
				$('#datafromajax').append(data);
				//alert(data);
				if ( typeof login_check != 'undefined' && login_check != 'nee' && login_check != '' ) {
					//alert(return_check);
					$('#existsLayer').modal({
						containerCss:{width: 300, height: 280, padding: 10, backgroundColor: '#FFF', background: 'none'}
	
					});
					
				}
				//alert(login_check);
				
				$('#iUserID').val(login_check);
				//alert($('#existsLayerValue').val());
			}
		});
		
	};
	
	// !Adres Function
	
	function updateAddress(formNameForCheck){
		var formBase = document.forms[formNameForCheck];
		//var land = formBase.eval('countryId2_input').value;
		var land = $('#countryId2_input').attr('value');
		if(land=='NEDERLAND'){
			
			
			$('#straat').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
			$('#plaats').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
			
			var pc1 = formBase.IN_ADDRESS_POSTCODE.value;
			var pc2 = formBase.IN_ADDRESS_POSTCODE2.value;
			var huis = formBase.IN_ADDRESS_HOUSE_NO.value;
		
			var url = '/3rd_party/adresXpress/getAddress.php?pc1='+pc1+'&pc2='+pc2+'&huis='+huis+'&action=postcode';
			
			if(pc1!="" && pc2!="" &&  huis!=""){
				//call php for address
				$.ajax({
					url: url, 
					success: function(data) { 
						$('#straat').attr('value','');
						$('#plaats').attr('value','');
						
						$('#datafromajax').append(data); 
						//alert(data);
						$('#straat').attr('value',straat);
						$('#plaats').attr('value',stad);
						//$('#straat2').attr('value',straat);
						//$('#plaats2').attr('value',stad);
					}
				});
		
			};
		} else {
			$('#straat').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
			$('#plaats').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
		}
	};
	
	function updateAddress2(formNameForCheck){ //Only in bestel formulier used if Factuuradres IS NOT hetzelfde als bezorgadres.
		var formBase = document.forms[formNameForCheck];
		//var land = formBase.eval('countryId2_input').value;
		var land = $('#countryIdAfleveradres_input').attr('value');
		if(land=='NEDERLAND'){
			
			$('#straat2').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
			$('#plaats2').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
			
			var pc1 = formBase.IN_ADDRESS_POSTCODE_2.value;
			var pc2 = formBase.IN_ADDRESS_POSTCODE2_2.value;
			var huis = formBase.IN_ADDRESS_HOUSE_NO_2.value;
		
			var url = '/3rd_party/adresXpress/getAddress.php?pc1='+pc1+'&pc2='+pc2+'&huis='+huis+'&action=postcode';
			
			if(pc1!="" && pc2!="" &&  huis!=""){
				//call php for address
				$.ajax({
					url: url, 
					success: function(data) { 

						$('#straat2').attr('value','');
						$('#plaats2').attr('value','');
						
						$('#datafromajax').append(data); 
						//alert(data);

						$('#straat2').attr('value',straat);
						$('#plaats2').attr('value',stad);
					}
				});
		
			};
		} else {
			$('#straat2').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
			$('#plaats2').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
		}
	};
	
	function updateAddressLezing(formNameForCheck){
		var formBase = document.forms[formNameForCheck];
		//var land = formBase.eval('countryId2_input').value;
		var land = $('#countryId3_input').attr('value');
		if(land=='NEDERLAND'){
			
			$('#straatLezing').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
			$('#plaatslezing').attr('readonly','readonly').css({'color':'#000', 'background':'#CCC'});
				
			var pc1 = $('#postcodeLezing').val();
			var pc2 = $('#postcode2Lezing').val();
			var huis = $('#huisnummerLezing').val();
		
			var url = '/3rd_party/adresXpress/getAddress.php?pc1='+pc1+'&pc2='+pc2+'&huis='+huis+'&action=postcode';
			
			if(pc1!="" && pc2!="" &&  huis!=""){
				//call php for address
				$.ajax({
					url: url, 
					success: function(data) { 

						$('#straatLezing').attr('value','');
						$('#plaatslezing').attr('value','');
						
						$('#datafromajax').append(data); 
						//alert(data);

						$('#straatLezing').attr('value',straat);
						$('#plaatslezing').attr('value',stad);
					}
				});
		
			};
		} else {	
			$('#straatLezing').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
			$('#plaatslezing').attr('readonly','').css({'color':'#000', 'background':'#FFF'});
		}
	};
	
	// !Loop for Jquery Flash
		
		var cid;
		var nr;
	
		if ( window.location.href.match("/homepage/index.html") ){
			//alert('true')
			function doButton(){
				if(nr >= but_ar.length){
					nr = 0;
				} else {
					nr ++;
				};
				//alert('flash');
				var but = but_ar[nr];
				
				$(but).trigger('click');
				
				//alert(nr);
			};
			    	
		    nr = 0;
		    
		    but_ar = new Array('#button1', '#button2', '#button3', '#button4');
		    
		    
		    
		  
			cid = setInterval('doButton()', 10000);
	
		};

	// !END Loop for Jquery Flash
	
	// !Open Video Overlay Function    	
    function openVideo(videoWidth, videoHeight, containerId, videoFile){
	    
	    var id = '#'+containerId;
	     
		$(id).modal({
            close:(true),
            containerCss:{width:(videoWidth), height:(videoHeight)},
            
            onOpen: function (dialog) {
                
                $.ajax({
                    url: videoFile, 
                    success: function(data) { 
                        $(id).append(data);  
                    }
                });
                
                /*
				$('#simplemodal-overlay').click(function(){
                    $.modal.close();
                });
				*/
                dialog.overlay.fadeIn('slow', function () {
                    dialog.container.slideDown('slow', function () {
                        dialog.data.fadeIn('slow');
                    });
                });
            },
            
            onClose: function (dialog) {
                dialog.data.fadeOut('fast', function () {
                    dialog.container.slideUp('fast', function () {
                        dialog.overlay.fadeOut('fast', function () {
                            $.modal.close(); // must call this!
                            $(id).empty();
                        });
                    });
                });
            }
        });
	};
	
	// !hideVraagAllContactFrom
	function hideVraagAllContactFrom() {
		$('#lezingHidden').hide();
		$('#collecteHidden').hide();
		$('#hersenaandoeningHidden').hide();
	};
	
	function checkForValues(){
		//lezingAanvraag
		if ( $('#vraagOver_input').val() == 'Aanvraag voor lezing' ) {
			hideVraagAllContactFrom();
			$('#lezingHidden').show();
		};
		
		//collecte
		if ( $('#vraagOver_input').val() == 'Collecte' ) {
			hideVraagAllContactFrom();
			$('#collecteHidden').show();
		};
		
		//hersenaandoening
		if ( $('#vraagOver_input').val() == 'Hersenaandoening' ) {
			hideVraagAllContactFrom();
			$('#hersenaandoeningHidden').show();
		};
		
		//all other ones
		if ( $('#vraagOver_input').val() == '' || $('#vraagOver_input').val() == 'Donateurschap' || $('#vraagOver_input').val() == 'Onderzoek' || $('#vraagOver_input').val() == 'Uitgaven van de Hersenstichtng' || $('#vraagOver_input').val() == 'Algemeen/overig' ) {
			hideVraagAllContactFrom();
		};
	};
	
	// !jquery Ready Function
	$(document).ready(function() {
	
		//show campaign vide/audio

		$('#activateRadiospot').click(function() {
			$('.video, .mainVideo').css({'left':'-9999px'});
			$('.audio').css({'left':'0'});

			//alert('the videoplayer '+obj['id']+' has been instantiated');
			radioPlayer.sendEvent("PLAY");
			videoPlayer.sendEvent("STOP");
			mainImagePlayer.sendEvent("STOP");
			
			return false;
		});
		
		$('#activateTVspot').click(function(){
			$('.audio, .mainVideo').css({'left':'-9999px'});
			$('.video').css({'left':'0'});
			
			//radioPlayer.sendEvent("STOP","true");
			videoPlayer.sendEvent("PLAY");
			radioPlayer.sendEvent("STOP");
			mainImagePlayer.sendEvent("STOP");
			return false;
		});
		
		//activate 50k video
		$('#ActivateMainImage').click(function(){
			$('.audio, .video').css({'left':'-9999px'});
			$('.mainVideo').css({'left':'0'});
			
			//radioPlayer.sendEvent("STOP","true");
			videoPlayer.sendEvent("STOP");
			radioPlayer.sendEvent("STOP");
			mainImagePlayer.sendEvent("PLAY");
			return false;
		});
		
	
		$('#actieLinkSpecial').click(function() {
			window.location.href = "http://www.hersenstichting.nl/shop/hersenletsel/114/index.html";
		});
		$('.contentBlock.actieBlock + .contentBlock').css({'background-color':'#E5E7EF'}).find('.nieuwsberichten').css({'background-color':'#E5E7EF'}).find('h2').css({'color':'#3F4E95', 'font-weight':'bold','font-size':'1.15em','line-height':'1.2em'});
		//Hide Bedrag if acceptgiro is choosen
		$('#wordDonateur #acceptgiro').click(function() {
			$('.bedragCont').hide();
		});
		
		$('#wordDonateur #machtiging').click(function() {
			$('.bedragCont').show();
		});
		
		//Hide Factuuradres hetzelfde als bezorgadres for Particulier
		$('#factuuradresHetzeldeCont').hide();
		$('#radioOrganisatie').click(function() {
			$('#factuuradresHetzeldeCont').show();
		});
		$('#radioParticulier').click(function() {
			$('#factuuradresHetzeldeCont').hide();
		});
		
		
		// Stuur to Friends
		$('#formDoorsturenSubmit').click(function () {
			//alert('clicked');
			
			var email1 = $('input#email1').val();
			var email2 = $('input#email2').val();
			var naam1 = $('input#naam1').val();
			var naam2 = $('input#naam2').val();
			var bericht = $('textarea#bericht').val();
			var url = window.location.href;
			
			//alert(url);
			
			var getUrl = '/modules/tell-a-friend/tell-a-friend.php?email1='+ email1 + '&email2=' + email2 + '&naam1=' + naam1 + '&naam2=' + naam2 + '&bericht=' + bericht + '&url=' + url;
			
			// returns true or false depending form results, if true sends ajax get request and proceeds
			if ( $("#formDoorsturenForm").validate({
				rules: {
					naam1:{
						required: true
					},
					naam2:{
						required: true
					},
					email1:{
						required: true,
						email: true
					},
					email2:{
						required: true,
						email: true
					},
					bericht:{
						required: true
					}
				}
			}).form() )
			//Begin if function == true
			{
				$.ajax({ 
					type: 'GET', 
					url: getUrl, 
					success: function(data) {
			  			//$.modal.close();
			  			//alert(data);
			  			$('#formDoorsturen').empty();
			  			$('#simplemodal-container').css({'height':'150px'});
			  			$('#formDoorsturen').html("<h1 class='pink' style='text-align:center; font-size: 20px;'>Bedankt</h1> <br /> <p style='text-align:center; font-size: 14px; color: #FFF'><br/><br/>Uw bericht is verzonden!!</p>");
			  		} 
				});
				
			} else {
				//alert('else');
				$('#simplemodal-container').css({'height':'600px'});
			};
			
			
		});
	
		// Mod for Plaatjes Fix
			
			$('a.btnNaastelkaar, a.btnNaastelkaarLast').each(function () {
				if ($(this).attr('href') == '') {
					$(this).hide();
				};
			});
		
		// Subsidie Wensite fix for http://
			$('#orgWebsite').val('http://');
		
		// Fix Shitty IE6 Footer
		
			if( $.browser.msie && $.browser.version == 6 ){
				//alert( $(window).width() );
				//alert( $('#content').height() );
				
				if ( window.location.href.match("/homepage/index.html") ){
					
					$('#content').css({
						'margin-bottom':'200px'
					});
					
					$('#footer').css({
						'position': 'absolute',
						'top': ( $('#wrapper').height() ) - 20,
						'left': ( ( $(window).width() - 850) / 2 )
						});
					} else {
						$('#content').css({
							'margin-bottom':'200px'
						});
						
						//alert('hello');
						
						$('#footer').css({
							'position': 'absolute',
							'top': ($('#content').height()) + 200,
							'left': ( ( $(window).width() - 850) / 2 )
							});
					};
				};
			
	
		// #contactFormulierGood
		
			// !Validator Set Defaults
				jQuery.validator.setDefaults({ 
	
					errorPlacement: function(error, element) {
						error.appendTo( element.parent('p').next('div') );
						// element.parent('p').addClass('redBorder');
					},
					
					rules: {
						// Geboortedatum Year 
						jaar: {
							correctYear: true
						},
						// Bank Number
						IN_RELATION_PAYACCOUNT_ID: {
							required: "#machtiging:checked",
							banknumber: true
						},
						// Contact Telephone
						IN_PERSON_TELEPHONE2:{
				        	phone: true
						},
						// Donateur Telephone
						IN_PERSON_TELEPHONE:{
				        	phone: true
						},
						gebruikersnaam:{
				        	required: true,
				        	email: true
						},
						oudeWachtwoord: {
							required: true,
							minlength: 6
							//atleastonedigit: true
						},
						wachtwoordNiewe:{
							required: true,
							minlength: 6,
							atleastonedigit: true
						},
						wachtwoordNieweRepeat:{
							required: true,
							minlength: 6,
							atleastonedigit: true,
							equalTo: "#wachtwoordNiewe"
						},
						//** Word Donateur Rules **//
						betaalwijze: {
							required: true
						},
						bedrag: {
							required: true
						},
						// only if vrije bedrag is selected
						textBedrag: {
							required: "#vrijBedragRadio:checked",
							numberDE: true
						},
						gironummer:{ 
							required: true
						},
						//voorleters
						IN_PERSON_INITIALS:{
							required: true
						},
						//achternaam
						IN_PERSON_SURNAME_1:{
							required: true
						},
						//geslacht
						IN_PERSON_TITLE_ID:{
							required: true
						},
						// Particulier / Organisatie
						IN_RELATION_UDPROFILE_ID:{
							required: true
						},
						//bedrijfsnaam
						IN_RELATION_NAME_1:{
							required: "#radioOrganisatie:checked"
						},
						//postcode
						IN_ADDRESS_POSTCODE:{
							required: true,
							minlength: 4,
							maxlength: 4,
							digits: true
						},
						//postcode2
						IN_ADDRESS_POSTCODE2:{
							required: true,
							minlength: 2,
							maxlength: 2,
							lettersonly: true
						},
						//postcode Factuuradres hetzelfde als bezorgadres.
						IN_ADDRESS_POSTCODE_2:{
							required: "#factuuradresHetzelde:not(:checked)",
							minlength: 4,
							maxlength: 4,
							digits: true
						},
						//postcode2 Factuuradres hetzelfde als bezorgadres.
						IN_ADDRESS_POSTCODE2_2:{
							required: "#factuuradresHetzelde:not(:checked)",
							minlength: 2,
							maxlength: 2,
							lettersonly: true
						},
						//huisnummer
						IN_ADDRESS_HOUSE_NO:{
							required: true,
							digits: true
						},
						// Straat
						IN_ADDRESS_STREET:{
							required: true	
						},
						//Plaats
						IN_ADDRESS_CITY:{
							required: true
						},
						// Email / Username
						IN_PERSON_EMAIL:{
							required: true,
							email: true
						},
						// Email / Username Pop Up
						IN_PERSON_EMAIL_POP_UP:{
							required: true,
							email: true
						},
						
						//** Doorsturen Form **//
						naam:{
							required: true
						},
						emailOntvanger:{
							required: true,
							email: true
						},
						ontvangerNaam:{
							required: true
						},
						formDoorsturenBericht:{
							required: true
						},
						//straat
						IN_ADDRESS_STREET2:{
							required: true
						},
						//plaats
						IN_ADDRESS_CITY2:{
							required: true
						},
						//** Betalen Form **//
						
						//Betaalwijze
						AUTOPAYCODE_ID:{
							required: true
						},
						// Email popup
						IN_PERSON_EMAIL_POP_UP: {
							required: true,
							email: true
						},
						dag: {
							required: function(element) {
								if ($(element).val() != ""){
									return true;
								} else {
									return false;
								}
							},
							range: [1,31]
						},
						// Postcode1 Lezing
						IN_ADDRESS_POSTCODE3: {
							required: function(element){
								//alert($('#vraagOver_input').val() == "Aanvraag voor lezing");
								return $('#vraagOver_input').val() == "Aanvraag voor lezing";
							},
							minlength: 4,
							digits: true
						},
						// Postcode2 Lezing
						IN_ADDRESS_POSTCODE4: {
							required: function(element){
								//alert($('#vraagOver_input').val() == "Aanvraag voor lezing");
								return ($('#vraagOver_input').val() == "Aanvraag voor lezing" && $('#countryId3_input').val() == "NEDERLAND" );
							},
							minlength: 2,
							maxlength: 2,
							lettersonly: true
						},
						// Housenumber Lezing
						IN_ADDRESS_HOUSE_NO2: {
							required: function(element){
								//alert($('#vraagOver_input').val() == "Aanvraag voor lezing");
								return $('#vraagOver_input').val() == "Aanvraag voor lezing";
							},
							digits: true 
						},
						//Straat Lezing
						IN_ADDRESS_STREETNR_NEW: {
							required: function(element){
								//alert($('#vraagOver_input').val() == "Aanvraag voor lezing");
								return $('#vraagOver_input').val() == "Aanvraag voor lezing";
							}
						},
						//Plaats Lezing
						IN_ADDRESS_CITY_NEW: {
							required: function(element){
								//alert($('#vraagOver_input').val() == "Aanvraag voor lezing");
								return $('#vraagOver_input').val() == "Aanvraag voor lezing";
							}
						},
						vraagOver_input: {
							required: function(element){
								return $('#vraagOver_input').val() == "";
							}
						},
						gewensteDag: {
							
							lezingDatum: true
						},
						inputJaar: {
							
							lezingDatum: true
						},
						maandSelect_input: {
							
							lezingDatum: true
						},
						IN_ADDRESS_HOUSE_NO_2:{
							required: "#factuuradresHetzelde:not(:checked)",
							digits: true
						},
						//beroerteForm Validation
						//date of birth beroerte formulier
						dagBeroerteDOB: "required",
						tVraagHersenstichtingNederland: "required",
						rBehandelingPlaatsJadoor: {
							required: function() {	
								if($('#rVindtMomenteelBehandelingPlaatsJa').is(':checked')){
									$('.rBehandelingPlaatsJadoorSpecial').css({'margin-left':'40px'});
									//$('.rBehandelingPlaatsJadoorSpecial').appendTo("#beroerteForm");
									return true;
								} else {
									return false;
								}
							},
							minlength: 1
						}
						// Rekeningnummer
						//IN_RELATION_PAYACCOUNT_ID:{
						//	required: "#eenmaligeMachtiging:checked",
						//	banknumber: true
						//}
						//** Login Sidebar Form **//
						// Already defined above IN_PERSON_EMAIL2
					},
						
					messages: {
						rBehandelingPlaatsJadoor: {
						 required: "kies minimaal 1"
						},
						jaarHerseninfarctPlaatsgevonden: {
							number: "Een geldige datum is verplicht.",
							minlength: "Dit veld moet minstens 4 tekens bevatten.",
							maxlength: "Dit veld moet maximaal 4 tekens bevatten."
						},
						gebruikersnaam: {
							required: "Het e-mailadres is niet correct",
				    		email: "Het e-mailadres is niet correct"
						},
						betaalwijze: {
							required: "This field is required"
						},
						oudeWachtwoord: {
							required: "Er is geen wachtwoord ingevuld",
							minlength: "Het wachtwoord dient uit minimaal 6 tekens te bestaan",
							atleastonedigit: "Minimal 1 cijfer in jouw wachtwoord"
						},
						wachtwoordNiewe:{
							required: "Het nieuwe wachtwoord dient uit minimaal 6 tekens te bestaan",
							minlength: "Het nieuwe wachtwoord dient uit minimaal 6 tekens te bestaan",
							atleastonedigit: "Uw wachtwoord moet minimaal 1 cijfer bevatten."
						},
						wachtwoordNieweRepeat:{
							required: "Het nieuwe wachtwoord dient uit minimaal 6 tekens te bestaan",
							minlength: "Het nieuwe wachtwoord dient uit minimaal 6 tekens te bestaan",
							atleastonedigit: "Uw wachtwoord moet minimaal 1 cijfer bevatten.",
							equalTo: "Beide wachtwoorden moeten identiek zijn"
						},
						IN_PERSON_EMAIL:{
							required: "Het e-mailadres is niet correct",
							email: "Het e-mailadres is niet correct"
						},
						voorlichtingTenBehoeveVan: {
							maxlength: "Selecteer maximaal 1 optie."
						},
						IN_ADDRESS_POSTCODE: {
							required: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							minlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							maxlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							digits: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							lettersonly: "De postcode moet bestaan uit 4 cijfers en 2 letters"
							
						},
						IN_ADDRESS_POSTCODE2: {
							required: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							minlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							maxlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							digits: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							lettersonly: "De postcode moet bestaan uit 4 cijfers en 2 letters"
							
						},
						IN_ADDRESS_POSTCODE2_2: {
							required: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							minlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							maxlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							digits: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							lettersonly: "De postcode moet bestaan uit 4 cijfers en 2 letters"
							
						},
						IN_ADDRESS_POSTCODE3: {
							required: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							minlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							maxlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							digits: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							lettersonly: "De postcode moet bestaan uit 4 cijfers en 2 letters"
							
						},
						IN_ADDRESS_POSTCODE4: {
							required: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							minlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							maxlength: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							digits: "De postcode moet bestaan uit 4 cijfers en 2 letters",
							lettersonly: "De postcode moet bestaan uit 4 cijfers en 2 letters"
							
						}
					}

				});
			
			//string1 = "2-14-2009";
			//string2 = "14-14-2000";
			
			//beroerte form show/hide algemene vraag
			$('#rQuestionForWhoNVT').click(function() {
				$('#onlyIfBeroerte').attr('rel','hide').hide();
			});
			
			$('#rQuestionForWhoMijzelf, #rQuestionForWhoIemand').click(function() {
				$('#onlyIfBeroerte').attr('rel','shown').show();
			});
			
			$.validator.addMethod("lettersonly", function(value, element) {
		        return this.optional(element) || /^[a-z]+$/i.test(value);

			}, "De postcode moet bestaan uit 4 cijfers en 2 letters"); 
			
			$.validator.addMethod("lezingDatum", function(value) {
				
				if($('#vraagOver_input').val() == "Aanvraag voor lezing") { 	
					var monthsAr = ["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"];
					
					function getMomthNum(sMonth) {
						
						for(i=0; i < 12; i++) { 
							if(sMonth == monthsAr[i]) {
								return i;
							} 
							
						}
						return false;
					};
					
					var inputDag = $('#gewensteDag').val();
					var inputMonth = getMomthNum($('#maandSelect_input').val());
					
					var inputYear = $('#gewenstJaar').val();
					
					var dd = new Date();
					var curDay = dd.getDate();
					var curMonth = dd.getMonth();
					var curYear = dd.getFullYear();
					
					string1 = inputDag + "-" + inputMonth + "-" + inputYear;
					string2 = curDay + "-" + curMonth + "-" + curYear;
					
					
					//alert(string1);
					
					function CompareDates() { 
					   var str1  = string1;
					   var str2  = string2;
					   var dt1   = parseInt(str1.substring(0,2),10); 
					   var mon1  = parseInt(str1.substring(3,5),10);
					   var yr1   = parseInt(str1.substring(5,10),10);
					   var dt2   = parseInt(str2.substring(0,2),10); 
					   var mon2  = parseInt(str2.substring(3,5),10); 
					   var yr2   = parseInt(str2.substring(5,10),10); 
					   var date1 = new Date(yr1, mon1, dt1); 
					   //var date2 = new Date(yr2, mon2, dt2); 
					   
						var myDate=new Date();
						myDate.setFullYear(yr1,mon1,dt1);
						var today = new Date();
						
					   if(today < date1)
					   {	
					     return true; 
					   } 
					   else 
					   { 
					       return false; 
					   } 
					};
					
					// functions that checkes if date is correct					
					return CompareDates();
					
				} else {
					// dont do validation
					return true;
				}
					
					}, 
					
					"De ingevoerde datum is niet correct.");
			
			
			
			// !Add new method for password Validation
				$.validator.addMethod("atleastonedigit", function(pass) {
					if (pass == "") {
						return true;
					}
					
					return ((/[0-9]+/).test(pass));
					}, 
					
					"This field must contain at least one number");
					
			// !Add new method for Geboortedatum jaar

				var d = new Date(); // create new date variable
				var curr_year = d.getFullYear(); // Value of present year
				var currentMin6 = curr_year - 6;
				//alert(currentMin6);
				//alert(curr_year);
				
				$.validator.addMethod("correctYear", function(value) {
					if (value == "" && $("input[name='dag']").val() == "" ) {
						
						return true;
						}
					if ( $('#inputJaar').val() >= (curr_year - 6) || $('#inputJaar').val() <= 1880 || $("input[name='dag']").val() == "" ) {
						return false;
						} else {
							return true;
						}
					}, 
					
					"De ingevoerde datum is niet correct.");
					
			// !Add new method for telephone number
				$.validator.addMethod("phone", function(phone_number, element) {
					var digits = "0123456789";
					var phoneNumberDelimiters = "()- ext.";
					var validWorldPhoneChars = phoneNumberDelimiters + "+";
					var minDigitsInIPhoneNumber = 10;
					s=stripCharsInBag(phone_number,validWorldPhoneChars);
					return this.optional(element) || isInteger(s) && s.length == minDigitsInIPhoneNumber;
					}, "Er is geen correct telefoonnummer ingevoerd ");
				
					function isInteger(s)
						{ var i;
						for (i = 0; i < s.length; i++)
						{
						// Check that current character is number.
						var c = s.charAt(i);
						if (((c < "0") || (c > "9"))) return false;
						}
						// All characters are numbers.
						return true;
						}
						function stripCharsInBag(s, bag)
						{ var i;
						var returnString = "";
						// Search through string's characters one by one.
						// If character is not in bag, append to returnString.
						for (i = 0; i < s.length; i++)
						{
						// Check that current character isn't whitespace.
						var c = s.charAt(i);
						if (bag.indexOf(c) == -1) returnString += c;
						}
						return returnString;
						}
			
			// !Add new method for banknumber
				$.validator.addMethod("banknumber", function(value) {
					
					// If Gireonummer is empty no validation applied
					if ( value == "" ) {
						
						return true;
												
					} else {
						// Php file for Gironummer validation
						var url = '/3rd_party/adresXpress/elf.php?rek=' + value;
						
						var foo;
						//alert(foo);
						
						// Make ajax call to PHP File to check if Gironummer is correct
						$.ajax({
							url: url,
							async: false,
							success: function(data) { 
				
								if ( data == "<script>false</script>") {
									// Append data to #dataBanknumber DIV so i can access the varaible
									// IMPORTANT REMEMBER TO ADD A DIV WITH #dataBanknumber AS ID TO THE PAGE!!!
									//$('#dataBanknumber').empty();
									//$('#dataBanknumber').append('<script type="text/javascript">bankWorks = false;</script>');
									foo = false;
									
								} else {
									//$('#dataBanknumber').empty();
									//$('#dataBanknumber').append('<script type="text/javascript">bankWorks = true;</script>');
									foo = true;
								};
								
							}
						});	
						//alert(foo);
						if (foo) {
							return true;
						} else {
							return false;
						}
											
					}
					// Return var bankWorks wich can be false or true and depending on value it validates correctly
					//alert(bankWorks);
					//return bankWorks;
									
					// Msg for validation
				}, "U heeft geen correct rekeningnummer ingevoerd");
				
			
			
			// Form Validation
			
				
			
				// !Word Donateur From Validation
					$('#wordDonateur').validate();
				
				// !beroerteForm From Validation
					$('#beroerteForm').validate();
				
				//bestelForm validation
				$('#bestelForm').validate();
				
				// !wachtwoordVergeten From Validation
					$('#wachtwoordVergeten').validate({
						rules: {
							IN_PERSON_EMAIL:{
								required: true,
								email: true
							}
						}
					});
				
				// exitsLayerPop Validation
					$('#exitsLayerPop').validate();
					
				// !Contact Form Validation
					$('#contactFormulierGood').validate({
						rules: {
							IN_PERSON_EMAIL: {
								required: true,
								email: true
							},
							IN_PERSON_INITIALS: {
								required: true	
							},
							IN_PERSON_SURNAME_1: {
								required: true
							},
							IN_PERSON_TITLE_ID: {
								required: true
							},
							IN_RELATION_UDPROFILE_ID: {
								required: true
							},
							IN_ADDRESS_POSTCODE: {
								required: true,
								minlength: 4,
								maxlength: 4,
								digits: true
							},
							IN_ADDRESS_POSTCODE2: {
								required: true,
								minlength: 2,
								maxlength: 2,
								lettersonly: true
							},
							IN_ADDRESS_HOUSE_NO: {
								required: true,
								digits: true
							},
							IN_ADDRESS_STREET: {
								required: true
							},
							IN_ADDRESS_CITY: {
								required: true
							},
							//bedrijfsnaam
							IN_RELATION_NAME_1:{
								required: "#radioOrganisatie:checked"
							},
							opmerking_u: {
								required: true
							},
							vraagOpmerkingOver: {
								required: true
							},
							//postcode aanvraag lezing
							IN_ADDRESS_POSTCODE3: {
								required: function(element){
									return $('#vraagOver_input').val() == "Aanvraag voor lezing";
								},
								minlength: 4,
								maxlength: 4,
								digits: true
							},
							//huisnummer aanvraag lezing
							IN_ADDRESS_HOUSE_NO2: {
								required: function(element){
									return $('#vraagOver_input').val() == "Aanvraag voor lezing";
								},
								digits: true
							},
							IN_ADDRESS_POSTCODE4: {
								required: function(element){
									return $('#vraagOver_input').val() == "Aanvraag voor lezing";
								},
								minlength: 2,
								maxlength: 2,
								lettersonly: true
							},
							//straat lezing
							IN_ADDRESS_STREETNR_NEW: {
								required: function(element){
									return $('#vraagOver_input').val() == "Aanvraag voor lezing";
								}
							},
							//plaats lezing
							IN_ADDRESS_CITY_NEW: {
								required: function(element){
									return $('#vraagOver_input').val() == "Aanvraag voor lezing";
								}
							},
							gewensteDag: {
								lezingDatum: true
							},
							inputJaar: {				
								lezingDatum: true
							},
							maandSelect_input: {				
								lezingDatum: true
							},
							//postcode Factuuradres hetzelfde als bezorgadres.
							IN_ADDRESS_POSTCODE_2:{
								required: "#radioOrganisatie:checked",
								minlength: 4,
								maxlength: 4,
								digits: true
							},
							//postcode2 Factuuradres hetzelfde als bezorgadres.
							IN_ADDRESS_POSTCODE2_2:{
								required: "#radioOrganisatie:checked",
								minlength: 2,
								maxlength: 2,
								lettersonly: true
							},
							IN_ADDRESS_HOUSE_NO_2:{
								required: "#radioOrganisatie:checked",
								digits: true
							}
							
						},
						messages: {
							IN_ADDRESS_POSTCODE: {
								required: "Postcode nummer is verplicht"
							},
							IN_ADDRESS_POSTCODE2_2: {
								required: "Postcode nummer is verplicht"						
							},
							IN_ADDRESS_POSTCODE3: {
								required: "Postcode nummer is verplicht"
							}
						}
					});
					
				// !Password Aanpasen Form Validation
					$('#passwordAanpassenForm').validate({
						errorPlacement: function(error, element) {
							$('#betalenError').show();
							error.appendTo( $('#betalenError') );
						},
						errorElement: "p",
						errorClass: "errorBestellen"
					});
				
				// !Login Sidebar Form Validation
					$('#loginSidebar').validate({
						errorPlacement: function(error, element) {
							$('#betalenError').show();
							error.appendTo( $('#betalenError') );
						},
						errorElement: "p",						
						errorClass: "errorBestellen"
					});
				
				// !Betaalwijze Form Validation
					$('#Betaalwijze').validate({
						errorPlacement: function(error, element) {
							$('#betalenError').show();
							error.appendTo( $('#betalenError') );
							// element.parent('p').addClass('redBorder');
						},
						errorClass: "errorBestellen",
						errorElement: "p",
						rules: {
							AUTOPAYCODE_ID: {
								required: true
							},
							IN_RELATION_PAYACCOUNT_ID: {
								required: "#eenmaligeMachtiging:checked",
								banknumber: true
							}
						},						
						messages: {
							AUTOPAYCODE_ID: "U heeft nog geen betaalwijze gekozen",
							IN_RELATION_PAYACCOUNT_ID: "U heeft geen correct rekeningnummer ingevoerd"
						}
					});
					
				// !Subsidie Form Validation
					$('#subsidiesForm').validate({
						rules: {
							// Bedrijfs naam
							IN_RELATION_NAME_1: { required: true },
							// Soort organisatie
							soortOrganisatie: { required: true },
							//postcode
							IN_ADDRESS_POSTCODE:{
								required: true,
								minlength: 4,
								maxlength: 4,
								digits: true
							},
							//postcode2
							IN_ADDRESS_POSTCODE2:{
								required: true,
								minlength: 2,
								maxlength: 2,
								lettersonly: true
							},
							//huisnummer
							IN_ADDRESS_HOUSE_NO:{
								required: true,
								digits: true
							},
							// Straat
							IN_ADDRESS_STREET:{
								required: true	
							},
							//Plaats
							IN_ADDRESS_CITY:{
								required: true
							},
							// Contactpersoon
							orgContactPersoon: { required: true },
							// Last Name
							IN_PERSON_SURNAME_1: { required: true },
							// Email / Username
							IN_PERSON_EMAIL:{ required: true, email: true },
							// Organisatie Website
							orgWebsite: { required: true, url: true },
							// Heeft uw organisatie al eerder een aanvraag bij de Hersenstichting
							eerderAanvraag: { required: true },
							// Project Nummer if eerderAanvraag is Ja
							projectNummer: { required: "#eerderAanvraagJa:checked" },
							// Jaar aanvraag if eerderAanvraag is Ja
							jaarAanvraag: { required: "#eerderAanvraagJa:checked" },
							// eerderAanvraagToelichting
							eerderAanvraagToelichting: { required: "#eerderAanvraagJa:checked" },
							// eerderAanvraagGehonoreerd
							eerderAanvraagGehonoreerd: { required: "#eerderAanvraagJa:checked" },
							// eerderAanvraagGehonoreerdToelichting
							eerderAanvraagGehonoreerdToelichting: { required: "#eerderAanvraagJa:checked" },
							// aanvraagAndereFondsen
							aanvraagAndereFondsen: { required: true },
							// aanvraagAndereFondsenToelichting
							aanvraagAndereFondsenToelichting: { required: true },
							// aanvraagAndereGehonoreerd
							aanvraagAndereGehonoreerd: { required: true },
							// aanvraagAndereGehonoreerdBedrag
							aanvraagAndereGehonoreerdBedrag: { required: "#aanvraagAndereGehonoreerdJa:checked", numberDE: true },
							// aanvraagAndereGehonoreerdToelichting
							aanvraagAndereGehonoreerdToelichting: { required: true },
							// titelProject
							titelProject: { required: true },
							// belangrijksteDoelgroep Cehckboxes
							belangrijksteDoelgroep: { required: true },
							// belangrijksteDoelgroepAndersValue
							belangrijksteDoelgroepAndersValue: { required: "#belangrijksteDoelgroepAnders:checked" },
							// belangrijksteDoelgroepSpecificatie
							belangrijksteDoelgroepSpecificatie: { required:true },
							//maatschappelijkeParticipatie
							maatschappelijkeParticipatie: { required: true },
							// doelstellingZoConcreetMogelijk
							doelstellingZoConcreetMogelijk: { required: true },
							// hoeControleertDezeDoelstelling
							hoeControleertDezeDoelstelling: { required: true },
							// welkeWijzeZoektuPubliciteit
							welkeWijzeZoektuPubliciteit: { required: true },
							// welkePatientenOrganisatiesZijnBetrokken
							welkePatientenOrganisatiesZijnBetrokken: { required: true },
							// looptijdVanProjectStart
							looptijdVanProjectStart: { required: true, dateDE: true },
							// looptijdVanProjectStart
							looptijdVanProjectEind: { required: true, dateDE: true },
							// WelkBedragVraagtU
							WelkBedragVraagtU: { required: true, digits: true },
							// uploadGespecificeerdeBegrotingOfOffertes
							uploadGespecificeerdeBegrotingOfOffertes: { required: true },
							// financieleBijdrageVanUwOrganisatieAanProject
							financieleBijdrageVanUwOrganisatieAanProject: { required: true, digits: true },
							// wieStaatGarant
							wieStaatGarant: { required: true },
							// meegezondenBijlagen
							meegezondenBijlagen: { required: true },
							// voorlichtingTenBehoeveVan
							voorlichtingTenBehoeveVan: { required: true, maxlength: 1 }
						}
					});
					
			// !Show eerderAanvraag Ja from Subsidie Form
				$('#eerderAanvraagJa').click(function() {
					$('.eerderAanvraagHiddenJaHidden').show();
				});
			
			// !Hide eerderAanvraag Ja from Subsidie Form
				$('#eerderAanvraagNee').click(function() {
					$('.eerderAanvraagHiddenJaHidden').hide();
				});
		
			// !Show/hide IconInfo
				$('a.iconInfo').hover(function() {
					$('span.infoBox').show();
				}, function() {
					$('span.infoBox').hide();
				});
				
				$('span.infoBox').hover(function() {
					//do nothingx
				}, function() {
					$('span.infoBox').hide();
				});
			
			//Show Vrije Bedrag
				$('#vrijBedragRadio').click(function() {
					$('#vrijeBedragHidden').show();
				});
				
			//Hide Vrije Bedrag
				$('#euro3, #euro5, #euro10, #euro25').click(function() {
					$('#vrijeBedragHidden').hide();
				});
		
			// Show organisatieHidden
				$('#radioOrganisatie').click(function() {
					$('#organisatieHidden').show();
				});
			
			// Hide organisatieHidden
				$('#radioParticulier').click(function() {
					$('#organisatieHidden').hide();
				});
				
			// Show factuuradresHidden
				if ( $('#factuuradresHidden').hasClass('allowJquery') ){
					
					$('#factuuradresHetzelde').click(function() {
						$('#factuuradresHidden').toggle();
					});
					
				}
				
			
			//	Clear Text Input on click but only the First Time
			//		$('form input:text').one('click', function() {
			//			$(this).attr('value', '');
			//		});
				
			// !Checkbox Styling
				$('form input:radio, form input:checkbox').each(function(){
					$(this).css({border:'none'});
				});
			
			// !Select Element Styling
				
				if (typeof contactForm != 'undefined' && contactForm == true ){
					$('#vraagOver').selectbox();
					$('#overLezing').selectbox();
					$('#maandSelect').selectbox();
					$('#gewenstDagdeel').selectbox();
					$('#countryId').selectbox();
					$('#bentU').selectbox();
					$('#kentOns').selectbox();
					$('#maandSelectDonateur').selectbox();
					$('#maandSelect2').selectbox();
					$('#countryId2').selectbox();
					$('#countryId3').selectbox();
					$('#categorie').selectbox();
					$('#countryIdAfleveradres').selectbox();
					$('#giftVerzoeken').selectbox();
					$('#tussenvoegsel').selectbox();
					
				};
				
				if ( typeof niewesbrief != 'undefined' && niewesbrief == true ) {
					$('#giftVerzoeken').selectbox();
				};
				
				if (typeof wordDonateur != 'undefined' && wordDonateur == true ){
					$('#anderBedrag').selectbox();
					$('#maandSelect2').selectbox();
					$('#countryId2').selectbox();					
					$('#categorie').selectbox();
					$('#tussenvoegsel').selectbox();
					
					if( $('#radioOrganisatie').is(':checked') ){
						$('#radioOrganisatie').trigger('click');
					};
				};
				
				if (typeof beroerteForm != 'undefined' && beroerteForm == true ){
					$('#maandSelect2').selectbox();
					$('#iemandAndersDrop').selectbox();
					$('#countryId2').selectbox();					
					$('#categorie').selectbox();
					$('#leeftijdscategorie').selectbox();
					$('#tussenvoegsel').selectbox();
				};
				
				if (typeof subsidiesForm != 'undefined' && subsidiesForm == true ){
					$('#rechtsVorm').selectbox();
				};
				
				if (typeof hersenaandoeningZoeken != 'undefined' && hersenaandoeningZoeken == true ){
					// Add Select Option Styling
						$('#hersenaandoeningZoekenSelect').selectbox();
					
					// Check value of Option and redirect to correct url
						$('#hersenaandoeningZoekenSelect_container li').click(function() {
							//alert($(this).attr('id') );
							window.location.href = $(this).attr('id');
						});
				};
				
				if (typeof onderzoekenZoekenSelect != 'undefined' && onderzoekenZoekenSelect == true ){
					// Add Select Option Styling
						$('#onderzoekenZoekenSelect').selectbox();
						$('#onderzoekenZoekenSelect_container li').click(function() {
							//alert( $(this).attr('id') );
							$('#postValue').attr('value', '');
							$('#postValue').attr('value', $(this).attr('id') );
							document.getElementById('FaqCat').submit();						
						});
				};
				
				if (typeof faq != 'undefined' && faq == true ){
					// Add Select Option Styling
						$('#faqSelect').selectbox();
						$('#faqSelect_container li').click(function() {
							//alert( $(this).attr('id') );
							$('#postValue').attr('value', '');
							$('#postValue').attr('value', $(this).attr('id') );
							document.getElementById('FaqCat').submit();						
						});
				};
	
		// Check for Content Block
			$('div.contentBlock:first').removeClass('contentBlock').addClass('contentBlockFirst');
			
		// Anchor styling inside paragraph
		
			$('p a:contains(Lees meer)').addClass('aInsideP');
			$('p a:contains(lees meer)').addClass('aInsideP');
			$('p a.lightBlue:contains(Lees meer)').removeClass('aInsideP');
			$('p a.lightBlue:contains(lees meer)').removeClass('aInsideP');	
			
			// remove pijltje inside ankeiler
			$('p.button a.openVideo').removeClass('aInsideP');
					    
	    // Activate and Reactivate menu's depending on mouseover status
	    	
	    			
	    	
	        // Variables
	        	mainActiveId = $('.mainMenu a.active').parent('li.mainMenu').attr('id');
	        	id = ('#' + mainActiveId);
	        	//alert(mainActiveId);
	        	subMenuParentUl = $('#menu ul li.subMenu').parent('ul') ;
	        	
	        	
	        // Activate Submenu	but not on pHome        	
	        	if( window.location.href.match("/homepage/index.html") ){
	        		$(id).find('a.active').next('ul').removeClass('over');
	        	} else{
	        		$(id).find('a.active').next('ul').addClass('over');
	        	};
	        		        	
	        // Main menu hover
	        	$('#menu ul li.mainMenu')
	            //Mouse On
	            .hover( function(){
	                if( $(this).children('a').is('.active') == true ){
	                    $('li.mainMenu').find('a.active').next('ul').addClass('over');
	                } else{ 
	                    $('li.mainMenu ul.over').removeClass('over');
	                    $(this).children('ul').addClass('over');
	                    $(id).children('a').removeClass('active');
	                };        
	            }, 
	            // Mouse Out
	            function(){
	                $(id).children('a').addClass('active');
	                $(this).children('ul').removeClass('over');
	                $(id).children('ul').addClass('over');
	            });
	            
	            $(subMenuParentUl)
	            //Mouse On
	            .hover( function(){
	               if( $(this).parents('li.mainMenu').children('a').is('.active') == true ) {
	                    return null;
	                }else {
	                    $(this).parents('li.mainMenu').children('a').addClass('active');
	                };
	            }, 
	            // Mouse Out
	            function(){
	                $(this).parents('li.mainMenu').children('a').removeClass('active');
	            });
	            	    
	    // !JQUERY FLASH
	    
	        $('#photo1, #photo2, #photo3, #photo4').hide();
	        
	        function removeAllButtons(){
	            $('#button1, #button2, #button3, #button4').removeClass('over');
	        };
	        
	        function hideAllText(){
	            $('#text1, #text2, #text3, #text4').hide();
	        };
	        
	    	$('#button1').click(function(){
	    	   removeAllButtons();
	    	   hideAllText();
	    	   $(this).toggleClass('over');
	    	   $('#photo2, #photo3, #photo4').fadeOut('slow');
	    	   $('#photo1').fadeIn('slow');
	    	   $('#text1').fadeIn('fast');
	    	   return false;
	    	});
	    	
	    	$('#button2').click(function(event){
	    		event.stopPropagation();
	    	   removeAllButtons();
	           hideAllText();
	    	   $(this).toggleClass('over');
	           $('#photo1, #photo3, #photo4').fadeOut('slow');
	    	   $('#photo2').fadeIn('slow');
	    	   $('#text2').fadeIn('fast');
	    	   return false;
	    	});
	    	
	    	$('#button3').click(function(event){
	    		event.stopPropagation();
	    	   removeAllButtons();
	    	   hideAllText();
	    	   $(this).toggleClass('over');
	    	   $('#photo1, #photo2, #photo4').fadeOut('slow');
	    	   $('#photo3').fadeIn('slow');
	    	   $('#text3').fadeIn('fast');
	    	   return false;
	    	});
	    	
	    	$('#button4').click(function(event){
	    		event.stopPropagation();
	            removeAllButtons();
	            hideAllText();
	            $(this).toggleClass('over');
	            $('#photo1, #photo2, #photo3').fadeOut('slow');
	            $('#photo4').fadeIn('slow');
	            $('#text4').fadeIn('fast');
	            return false;
	    	});
		
		// Jquery Flash Start on first Button
		   $('#button1').trigger('click');
		
		// Cancel Slide after Click
	        $('#buttons').hover(function (){
	            clearInterval(cid);
	            /* alert('hello'); */
	        });
	        
		// !General Table Styling
			
			if ( $('table').hasClass('bestellen') ) {
				return null;
			} else{
				$('table td').css('border','1px solid #b52A85')
			$('table tr:even').css('background','#E7E3E2');
			$('table tr:odd').css('background','#FFF');
			$('table tr:first p').css({
				'background':'#b52A85',
				'color':'#FFF',
				'font-weight':'bold',
				'text-align':'center'
			});
			
			$('table').attr('border','1');
			$('table').css({
				'border':'1px solid #b52A85',
				'font-size':'14px'
			});
			
			// First TR Styling
				$('table tr:first').css({
					'background':'#b52A85',
					'color':'#FFF',
					'font-weight':'bold',
					'text-align':'center'
				});
				$('table tr:first td').css({
					'border-right':'1px solid #FFF',
					'border-bottom':'1px solid #FFF'
				});
				$('table tr:first td:last').css({
					'border-right':'1px solid #b52A85'
				});
			};
		
		// !SIMPLE MODAL Overlays
		     
	       // !donatuerWorden Login Modal 
	        $('#IN_PERSON_EMAIL').blur(function() {
	        	
	        	var url = '/3rd_party/adresXpress/checkMail.php?email='
	        	var inputValue = $(this).val();
	        	
	        	
				var did = false;
	        	//alert(inputValue);
	        	var finalUrl = url+inputValue;
	        	//alert(finalUrl);
	        	$.ajax({
					url: finalUrl, 
					success: function(data) {
						
						$('#datafromajax').append(data);
						//alert(data);
	        			if ( typeof return_check != 'undefined' && return_check == 'multiple' ) {
							//alert(return_check);
							did = true;
							$('#mulipleOverlay').modal({
								containerCss:{width: 300, height: 280, padding: 10, backgroundColor: '#FFF', background: 'none'},
								onOpen: function (dialog) {
	        						dialog.overlay.fadeIn('slow', function () {
									    dialog.container.slideDown('slow', function () {
									      dialog.data.slideDown('slow');
									    });
									  });
									  
	        					},
								onClose: function (dialog) {
									$('#IN_PERSON_EMAIL').val('');
									$.modal.close();
								}
	        					

							});
						}
						
						if ( typeof return_check != 'undefined' && return_check != 'nee' && return_check != '' ) {
							did = true;
							var emailAdres = $('#IN_PERSON_EMAIL').val();
							//alert(emailAdres);
							$('#loginOverlay').modal({
								close: (false),
	        					containerCss:{width: 300, height: 280, padding: 10, backgroundColor: '#FFF', background: 'none'},
	        					onOpen: function (dialog) {
	        						dialog.overlay.fadeIn('slow', function () {
									    dialog.container.slideDown('slow', function () {
									      dialog.data.slideDown('slow');
									    });
									  });
									  
	        					},	        
	        					onClose: function (dialog) {
	        						//nothing yet!
	        					}
							});
							$('#IN_PERSON_EMAIL_POP_UP_LOGIN').val('');
							$('#IN_PERSON_EMAIL_POP_UP_LOGIN').val(emailAdres);
							//alert();
								
						}
						
						if ( typeof return_check != 'undefined' && return_check == '2343243' ) {
							//alert(return_check);
							did = true;
							$('#loginOverlay').modal({
	        					containerCss:{width: 300, height: 280, padding: 10, backgroundColor: '#FFF', background: 'none'}

							});
						}
						if(did==false) {
							return false;
						};
					}
				});
				
	        	//alert('changed');
	        	
	        });
	        
	        // !Login Popup Validation
				$('#loginPopUp').validate({
					errorPlacement: function(error, element) {
						$('#betalenError').show();
						error.appendTo( $('#betalenError') );
					},
					errorElement: "p",						
					errorClass: "errorBestellen",
					submitHandler: function() { 
						//alert("Submitted!") 
						var email = $('#IN_PERSON_EMAIL_POP_UP_LOGIN').val();
						var password = $('#oudeWachtwoord').val();
						var path = "/3rd_party/adresXpress/doLogin.php?email=" + email + "&password=" + password;
						//alert(path);
						$.ajax({
							type: "POST",
							url: path, 
							success: function(data) {
								$('#datafromajaxPopUp').append(data);
								
								if ( typeof login_check != 'undefined' && login_check == 'ja' ) {
									//alert('ja but have to still submit form and close modal');
									window.location.reload(); // Refresh page
								} else {
									//alert('nee and still need to add a msg saying Incorrect e-mail adres of wachtwoord');
									$('#betalenError').empty().show().append('<span style="color: #FF0000">Het e-mailadres of wachtwoord is niet correct</span>');
								};
							}
						});
					}
				});
				
			
	        
	        $('#stuurDoor').click(function (e) {
	        		e.preventDefault();
	        		
	        		$('#formDoorsturen').modal({
	                    close:(true),
	                    containerCss:{width:(470), height:(470)},
	                    onOpen: function (dialog) {
	                        $('#simplemodal-overlay').click(function(){
	                            $.modal.close();
	                        });
	                        
	                        dialog.overlay.fadeIn('fast', function () {
	                            dialog.container.slideDown('slow', function () {
	                                dialog.data.fadeIn('slow', function() {
	                                	//$(dialog.data).height());
	                                	
	                                });
	                                
	                            });
	                          
	                        });

	                         //formDoorsturen
								//$('#formDoorsturenForm').validate();
								
	                    },
	                    onClose: function (dialog) {
	                    
	                        dialog.data.fadeOut('fast', function () {
	                            dialog.container.slideUp('fast', function () {
	                                dialog.overlay.fadeOut('fast', function () {
	                                    $.modal.close(); // must call this!
	                            });
	                        });
	                    });
	                    
	                }
	        	});	
	        });

		// !Increase Font Size Function
	    	$("a.increaseFont").click(function(){
	    		var currentFontSize = $('#main').css('font-size');
	    		var currentFontSizeNum = parseFloat(currentFontSize, 11);
	    		if(currentFontSizeNum<=15){
	    			var newFontSize = currentFontSizeNum+2;
	    			$('#main').css('font-size', newFontSize);
	    		return false;
	    		}
	    		else{
	    		
	    			$('#main').css('font-size', 11);	
	    		}
	    	});
		
		// !CLEAR SEARCH FIELD AFTER CLICK
	    	$('#seacrhTop').click(function() {
	    		$('#seacrhTop').attr("value","");
	    	});
		
		// !FAQ Questions Animation
			
			// showMe
				$('#showMe').toggle();
				$('#showMe').parent().find('.list').toggleClass('listDown');
		
			//Hide all Questions info
	    		//<p class="subInfo" $('.subInfo').hide();
	    		$('.listItem').find('.topBorder').addClass('hidden');
			
			//Open FAQ Question info
	    		$('.listItem h3').click(function(){
	    			if ( $(this).parent().find('.list').hasClass('listDown') ) {
	    				$(this).parent().find('.list').removeClass('listDown');
	    				$(this).siblings('.subInfo').hide('slow');
	    				$(this).siblings('.topBorder').addClass('hidden');
	    			} else {
	    				$(this).parent().siblings('.open').each(function () {
	    					$(this).removeClass('open');
	    					$(this).children().find('.list').removeClass('listDown');
	    					$(this).children('.subInfo').hide('slow');
	    					$(this).children('.topBorder').addClass('hidden');
	    				});
	    				
	    				
		    			$(this).parent().addClass('open');
		    			$(this).parent().find('.list').addClass('listDown');
		    			$(this).siblings(".subInfo").show("slow");
		    			$(this).siblings(".topBorder").removeClass("hidden");
		    		};
	    		});
	    		
	    // Shop Block Slide
	    
	    	$('.shopBlock').each(function(intIndex) {
	    		 
	    		 $(this).attr('id', intIndex);
	    		 
	    	});
	    	
	    	$('.shopBlock:first').fadeIn();   	
	    
		//Erase any clearfix div next to p's inside forms just i case i forgot one.
		$('form #errorBox + .clearfix').remove();
		$('#wordDonateur p.bedragCont').css({'margin-bottom':'-10px'}); // fix for ie7 :'(
		// !run validation on each form
		$('form.validate').each(function() {
			var $this = $(this);
			$this.validate();
		});
	}); // !END DOCUMENT READY FUNCTION
	