function goback() {
    history.go(-1);
}  
$(document).ready(function() {
         
    $('.toggle-plaats').each(function(){
    
        $(this).data('label', $(this).html());
    });
    
    if ($("a[rel^='prettyPhoto']").length>0) {
    	$("a[rel^='prettyPhoto']").prettyPhoto({
            theme: 'light_rounded',
        });
    }
   
    $('.toggle-plaats').toggle(function() {
        $(this).parent().find('.hidden').css('display','block');
        $(this).html('Sluiten');
    }, function() {
        $(this).parent().find('.hidden').css('display','none');
        $(this).html($(this).data('label'));
    });


    $('.rotator').cycle({ 
    fx:    'fade', 
    speed:  500,
    timeout: 2000 
    });
    
    jQuery('input[title!=""]').hint();
    
    $('.input-submit').click(function(){
        submitNieuwsbrief();
    });

    addNieuwsbrief();
    
});

function addNieuwsbrief(){

    jQuery.ajax({
            type: "GET",
            url: "/redesign.ajax.php",
            data: {action: "addNieuwsbrief"},
            success: function(msg){
                $('.content-nieuwbrief').html(msg);
                
                $('input[title!=""]').hint();
                $('.input-submit').click(function(){
                submitNieuwsbrief();
                });                
            }
    });
}

function submitNieuwsbrief(){
        
    jQuery.ajax({
                type: "GET",
                url: "/redesign.ajax.php",
                data: {
                action : "nieuwsbriefInschrijven",
                email : $('.input-email').val(),
                aanhef : $('.input-aanheg').val(),
                voornaam : $('.input-voornaam').val(),
                tussenvoegsel : $('.input-tussen').val(),
                achternaam : $('.input-achternaam').val(),
                postcode : $('.input-postcode').val()  
           },
           success: function(msg){
             $('.content-nieuwbrief').html(msg);
             jQuery('input[title!=""]').hint();
                $('.input-submit').click(function(){
                submitNieuwsbrief();
                });
           }
    });
}
