determine whether content is of type Page or a Post and display accordingly

The wordpress way solution is

 // put this in header.php
var ajax_url ="<?php echo admin_url('admin-ajax.php');?>"

// in js file
$('a:not([href^="#"])[href]').click(function(e) {
    e.preventDefault();
    var $this = $(this);
    var lnk = $this.attr('href');

    var jqxhr = $.post(ajax_url, {'action':'list_content', url: lnk});
    jqxhr.done(function(data) {
        if(data === 'post') {
            $.prettyPhoto.open(lnk + '?iframe=true&width=80%&height=80%');
        }
    });
});

// functions.php
add_action('wp_ajax_nopriv_list_content', 'list_content');
add_action('wp_ajax_list_content', 'list_content');

function list_content() {

    $url = $_POST['url'];

    $postid = url_to_postid($url);
    echo(get_post_type($postid));
    die();
}