$(document).ready(function(){
    $( '#buttonNotifyMe' ).click(function(){
    
        $.post( 'ajax/notifyme', { naam : $('#notificatieForm .naam').val(),
                                    type: $('#notificatieForm #type :selected').val(),
                                    vanaf: $('#notificatieForm #vanaf').val(),
                                    tot: $('#notificatieForm #tot').val(),
                                    email: $('#notificatieForm .email').val() }, function( data ){
                                        $('#notificatieForm #output').html(data);
                                    });
    });


    $( '#popuploaderNotify' ).click(function(){
        $('#notificatieForm .naam').val("Naam");
		$('#notificatieForm #type').val("Koop");
		$('#notificatieForm #vanaf').val("Vanaf prijs");
		$('#notificatieForm #tot').val("Tot prijs");
		$('#notificatieForm .email').val("E-mailadres");
		$('#notificatieForm .huur').hide();
		$('.popup').fadeIn();
        return false;        
    });
    

    $( '#popupcloser' ).click(function(){
        $('.popup').fadeOut();
    }); 


    //send to friend form
    $( '#sendMailToFriend' ).click( function(){
        $('#sendObjectMail .naam').val("Uw naam");;
		$('#sendObjectMail .email').val("E-mailadres van ontvanger");
		$('#sendObjectMail #bericht').val("");
		$('.popup2').fadeIn();
		return false;
    });
    
    $( '#sendToFriendClicker' ).click(function(){
        
        //var myUrl = 
        
        $.post( 'ajax/sendtofriend', {naam: $('#sendObjectMail .naam').val(),
                                         email: $('#sendObjectMail .email').val(),
                                         bericht: $('#sendObjectMail #bericht').val(),
                                         woningURL: document.location.href}, function( data ){
                 $('#sendObjectMail #output2').html(data);
                 $( '#sendToFriendClicker' ).attr( 'disabled', 'disabled' );
        });
    });
    
    $( '#popup2closer' ).click(function(){
        $( '.popup2' ).fadeOut();
    });
    
    
    //bezichting aanvragen
    $( '#requestPropertyView' ).click(function(){
        $('#bezichtigingRequest .naam').val("Naam");
		$('#bezichtigingRequest #bericht').val("");

		$('.popup3').fadeIn();
        return false;
    });
	
    
    // bod plaatsen
    $( '#placeBid' ).click(function(){
        //$('#bodPlaatsen .naam').val("Naam");
		$('#bodPlaatsen #bericht').val("");

		$('.popup4').fadeIn();
        return false;
    });
    
    $( '#requestPropertyViewClicker' ).click(function(){
        
        $.post( 'ajax/propertyview', {  
            naam : $('#bezichtigingRequest .naam').val(), 
            adres : $('#bezichtigingRequest #adres').val(), 
            postcode : $('#bezichtigingRequest #postcode').val(), 
            woonplaats : $('#bezichtigingRequest #woonplaats').val(), 
            telefoon : $('#bezichtigingRequest #telefoon').val(), 
            email : $('#bezichtigingRequest .email').val(), 
            bijzonderheden : $('#bezichtigingRequest #bijzonderheden').val(), 
            woningId: $('.hidemyobjectid').val()
        }, function(data){
            $('#bezichtigingRequest #output3').html(data);
            $('#requestPropertyViewClicker').attr( 'disabled', 'disabled' );
        });
    });
    
});

