function preparePage() {

    // IDENTIFY BROWSER
    if ((navigator.userAgent.indexOf("Mac") != -1) && (navigator.userAgent.indexOf("Safari") != -1)) {
        document.write('<link href="/assets/stylesheets/style_safari_mac.css" media="screen" rel="stylesheet" type="text/css" />');
    }

    // PREPARING "EXPLORE TOUR BY THEMES"
    $('input[name=tour_theme_radio]').removeAttr('checked');
    $('input[name=tour_theme_radio]').change(function() {
        $('#tourThemes:hidden').show('blind');
        closeTourTheme();
    });
    $('#tourThemesCloseLink').hide();
    $('#tourThemesList>div.themesList').hide();


    // APPLYING CUFON
    //<![CDATA[
    Cufon.replace(".welcome_message", {
        fontFamily: "Gotham Medium", color:'#363636'
    });
    Cufon.replace("#menu>ul>li>a>span", {
        fontFamily: "Gotham Medium", fontSize:"10px"
    });
    Cufon.replace(".submenu>li>a>span", {
        fontFamily: "Gotham Medium", fontSize:"10px"
    });
    Cufon.replace(".text_01", {
        hover: true,
        hoverables: { span: true },
        fontFamily: "Gotham Medium"
    });
    Cufon.replace(".text_02", {
        hover: true,
        hoverables: { span: true },
        fontFamily: "Gotham Medium"
    });
    Cufon.replace(".callcenter_info, .callcenter_info2",{
        fontFamily: "Gotham Condensed", fontSize:'26', color:'#fff'
    });
    Cufon.replace(".callcenter_phone", {
        fontFamily: "Gotham Condensed", fontSize:'18', color:'#898989', lineHeight:'25px'
    });
    Cufon.replace(".section_title,.section_title2", {
        fontFamily: "Gotham Condensed", color:'#ffffff'
    });
    Cufon.replace(".section_subtitle", {
        fontFamily: "Gotham Condensed", color:'#000000'
    });
    Cufon.now();
    //]]

    $("#tours_attractions_current, #discount_passes_current, #gifts_current, #dining_cruises_current, #boat_charters_current").css('color','#ffffff');
    $("#tours_attractions, #discount_passes, #gifts, #dining_cruises, #boat_charters").css('color','#000000');
    $(".section_title, .section_title2, .section_subtitle").show();

    Cufon.refresh();

    // CREATING SCROLLABLE BANNER & SCROLLABLE GALLERY
    $(".scrollable_area").scrollable({
        circular: true,
        keyboard: false
    });


    // CREATING SCROLLABLE BANNER LINKS
    $(".previous_banner_link").click(function() {
        $("#scrollable_banners_messages").data("scrollable").prev();
    });
    $(".next_banner_link").click(function() {
        $("#scrollable_banners_messages").data("scrollable").next();
    });

    $(document).ready(function() {
        $('.banner_message').click(function() {
            document.location = $(this).find('a').attr('href');
        });
    });        

    // CREATING SCROLLABLE GALLERY LINKS
    $(".previous_image_link").click(function() {
        $("#scrollable_gallery_pics").data("scrollable").prev();
    });
    $(".next_image_link").click(function() {
        $("#scrollable_gallery_pics").data("scrollable").next();
    });

    // ADDING EFFECTS TO BANNER & GALLERY LINKS
    $(".previous_banner_link, .previous_image_link, .next_banner_link, .next_image_link").hide();
    $(".previous_banner_link, .previous_image_link").mouseover(function() {
        $(".previous_banner_link, .previous_image_link").css({
            opacity: 1
        });
    }).mouseout(function() {
        $(".previous_banner_link, .previous_image_link").css({
            opacity: .5
        });
    });
    $(".next_banner_link, .next_image_link").mouseover(function() {
        $(".next_banner_link, .next_image_link").css({
            opacity: 1
        });
    }).mouseout(function() {
        $(".next_banner_link, .next_image_link").css({
            opacity: .5
        });
    });
    $(".previous_banner_div, .previous_image_div").mouseenter(function() {
        $(".previous_banner_link, .previous_image_link").css({
            opacity: .5
        }).show();
    }).mouseleave(function() {
        $(".previous_banner_link, .previous_image_link").hide();
    });
    $(".next_banner_div, .next_image_div").mouseenter(function() {
        $(".next_banner_link, .next_image_link").css({
            opacity: .5
        }).show();
    }).mouseleave(function() {
        $(".next_banner_link, .next_image_link").hide();
    });


    // PREPARING BUY TICKETS CALENDAR
    $(".buy_tickets").hide();
    $("#date_textfield").datePicker();
    $("#date_textfield").change(function() {
        if(this.value == "") {
            $(".buy_tickets").fadeOut();
        } else {
            $(".buy_tickets").fadeIn();
        }
    });


    // APPLYING STAMP PAGES BALLOON EFFECT
    $("#balloon_stamp").hide();
    $("#stamp_pages").mouseover(function() {
        $("#balloon_stamp").show();
    });
    $("#stamp_pages").mouseout(function() {
        $("#balloon_stamp").hide();
    });


    // CREATING SOUVENIRS IMAGE ZOOM

    $(".image_small").click(function() {
        $($(this).attr("rel")).show();
        return false;
    });
    $(".image_large").bgiframe();
    $(".image_large").click(function() {
        $(this).hide();
        return false;
    });

    $('#request-information-form').submit(function() {
        if( $( '#first_name' ).val() == '' ){
            alert( 'First Name is required.' );
            return false;
        }
        if( $( '#last_name' ).val() == '' ){
            alert( 'Last Name is required.' );
            return false;
        }
        if( $( '#city' ).val() == '' ){
            alert( 'City is required.' );
            return false;
        }
        if( $( '#zip' ).val() == '' ){
            alert( 'Zip is required.' );
            return false;
        }
        if( $( '#phone' ).val() == '' ){
            alert( 'Phone is required.' );
            return false;
        }
        if( $( '#email' ).val() == '' ){
            alert( 'Email is required.' );
            return false;
        }
        return true;
    });    
}

function show_tour_by_theme() {
    var selected_radio = $('input[name=tour_theme_radio]').index($('input[name=tour_theme_radio]:checked'));
    var theme_list = $('#tourThemesList>div.themesList:eq(' + selected_radio + ')');
    $('#tourThemesCloseLink:hidden').fadeIn();
    if (theme_list.is(":hidden")) {
        theme_list.fadeIn();
    }
}

function closeTourTheme() {
    $('#tourThemesCloseLink:visible').fadeOut();
    $('#tourThemesList>div.themesList:visible').fadeOut();
}

function makeWindowed(p_div) {
    var is_ie6 =
    document.all &&
    (navigator.userAgent.toLowerCase().indexOf("msie 6.") != -1);
    if (is_ie6)
    {
        var html =
        "<iframe style=\"position: absolute; display: block; " +
        "z-index: -1; width: 100%; height: 100%; top: 0; left: 0;" +
        "filter: mask(); background-color: blue; \"></iframe>";
        if (p_div) p_div.innerHTML += html;
        // force refresh of div
        var olddisplay = p_div.style.display;
        //p_div.style.display = 'none';
        p_div.style.display = olddisplay;
        p_div.show('block');
    }
}

