$(document).ready(function(){ 
    $("#home-options > ul").tabs();
    //showSurvey();
    //showVideo();
    $('#whattodo').change(function(e){
        return changeWhatToDo(this);
    });
});

function showVideo(){
    if (!$.cookie("video")) {
        $('#video').jqm({
            overlay:80,
            toTop: true,
            onShow: function(h) {
                /* callback executed when a trigger click. Show notice */
                h.w.slideDown();
            }
        });
        $('#video').jqmShow();
//        $.cookie("video", true,{
//            expires: 90
//        });
    }
}

function showSurvey(){
    if (!$.cookie("survey")) {
        $('#survey').jqm({
            modal:true,
            overlay:80,
            toTop: true,
            onShow: function(h) {
                /* callback executed when a trigger click. Show notice */
                h.w.slideDown();
            }
        });
        $('#survey').jqmShow();
    }
}

function setUpCookie(){
    $.cookie("survey", true,{
        expires: 90
    });
    $('#survey').jqmHide();
}

function changeWhatToDo(element){

    var selectedValue = $(element).val();

    $('#property_status option').each(function(){
        $(this).text($(this).text().replace(' - Reviewed', ''));
    });

    if (selectedValue == 'reviewed') {
        $('#property_status option').each(function(){
            $(this).text($(this).text() + ' - Reviewed');
        });
    }
}
