//<![CDATA[
var resizeBg = function(){ 
	var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 
	var elem = document.getElementById('backgroundImage'); 
	if(w > h){ 
		elem.width = w; 
		elem.height = w; 
	}
	else{ 
		elem.height = h; 
		elem.width = h; 
	} 
} 
window.onresize = resizeBg; 
//]]>

function loadmovie(movid,divid,size)
{
	var url   = 'functions.php?pagina=movie&movie=' + movid + '&size=' + size;
	var divid = '#' + divid;
	$(divid).load(url);
}


$(document).ready(function(){
	$('.inputIdle').focus(function() {
				$(this).removeClass("inputIdle").addClass("input");
				if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
	   		this.select();
	   	}
    });
    $('.inputIdle').blur(function() {
		$(this).removeClass("input").addClass("inputIdle");
		if ($.trim(this.value) == ''){
	    	this.value = (this.defaultValue ? this.defaultValue : '');
		}
    });
	
});

$(document).ready(function() {
	$("#west1").dropShadow();
	$("#west2").dropShadow();
	$("#west3").dropShadow();

});

$(document).ready(function() {
	
	//if submit button is clicked
	$('#submit').click(function () {		
		
		//Get the data from all the fields
		var email = $('input[name=email]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (email.val()=='') {
			return false;
		}
		if (email.val()=='jouw@e-mailadres.nl') {
			return false;
		}
		//organize the data properly
		var data = 'email=' + email.val();
		
		//disabled all the text fields
		$('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "nieuwsbrief.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				if (html==1) {					
					//hide the form
					$('.form').fadeOut('slow');					
					
					//show the success message
					$('.done').fadeIn('slow');
					
				//if process.php returned 0/false (send mail failed)
				} else alert('Sorry, unexpected error. Please try again later.');				
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	

