﻿$(document).ready(function(){

  jQuery.fn.exists = function(){return ($(this).length > 0);}

  $("#slider").easySlider({
	auto: true,
	continuous: true,
	pause: 5000,
	numeric: true
  });  
  
  $(".alltweets").html('<div style="padding: 20px; text-align: center;">Bezig met laden van Twitter berichten...</div>');		
    var hashcode = $('#hashcode').val();
	var aantal = $('#tweetssum').val()
    $.ajax({ type: 'GET',url: '/ajax/GetTweets.php?q='+hashcode+'&sum='+aantal,cache: false,success: function(html){
	  $(".alltweets").hide()				
	  $(".alltweets").html(html);
	  $(".alltweets").show();				
    }
  }); 
  
$('.loading,.melding1,.melding2').hide();		

$('.contactform').submit(function(){
	$(".loading").show();
	$(".verstuurbutton input").hide();    
	
	var dataString = $(this).serialize();
	$.ajax({ type: 'POST',url: '/ajax/ContactFormulier.php',data: dataString,cache: false,success: function(html){
			
			if(html == 'OK') { 	
				$('.contactform').hide();
				$('.melding1').hide();  
				$('.melding2').fadeIn();  
			}
			else { 
				$('.melding1').fadeIn(); 
				$('.melding2').hide();  
				$(".verstuurbutton input").show();
			}	        
			
			$('.melding').fadeIn();        
			$(".loading").hide();			
			
	}});
	return false;
});  

 });
