$(document).ready(function(){

    if(document.location.hash == "#track")
    {
        $.overlay({ajax:entry_path+"/dialogs/track"});   
    }

    $("#urls_dialog_show").click(function(){
        if(is_authenticated)
        {
            $.overlay({ajax:entry_path+"/dialogs/urls"});  
        }
        else
        {
            $("#show_login_dialog").click();
        }                 
    });


    $("#description_dialog_show").click(function(){
        if(is_authenticated)
        {
             $.overlay({ajax:entry_path+"/dialogs/description"});  
        }
        else
        {
            $("#show_login_dialog").click();
        }          
    });


    $("#facts_dialog_show").click(function(){
        if(is_authenticated)
        {
            $.overlay({ajax:entry_path+"/dialogs/facts"}); 
        }
        else
        {
            $("#show_login_dialog").click();
        }        
    });				


    $("#relationships_dialog_show").click(function(){
        if(is_authenticated)
        {
            $.overlay({ajax:entry_path+"/dialogs/related-entries"}); 
        }
        else
        {
            $("#show_login_dialog").click();
        }                 
    });


    $("#review_dialog_show").click(function(){
        if(is_authenticated)
        {
            $.overlay({ajax:entry_path+"/dialogs/review"}); 
        }
        else
        {
            $("#show_login_dialog").click();
        }                   
    });		

    
    $("#media_dialog_show").click(function(){
        if(is_authenticated)
        {
            $.overlay({ajax:entry_path+"/dialogs/media"}); 
        }
        else
        {
            $("#show_login_dialog").click();
        }               
    });

    $(".players_dialog_show").click(function(){
        var content = "<h1>"+gettext("How do you determine global player numbers?")+"</h1>";
        content += "<p>"+gettext("Global player numbers are estimated using publicly available data provided by publishers as well as data gathered by our market research partners. Allthough estimated player numbers should generally reflect actual player numbers we cannot guarantee their accuracy.")+"</p>";
        content += "<h2>"+gettext("Why don't you provide estimated player numbers for some titles?")+"</h2>";
        content += "<p>"+gettext("We don't provide estimated player numbers in case we're lacking reliable data for a certain title. Please take this into consideration when interpreting rankings based on estimated player numbers as actually higher-ranked titles might be missing.")+"</p>";
        $.overlay(content);             
    });


     $("#widget_dialog_show").click(function(){

        $.overlay({ajax:entry_path+"/dialogs/widget"});  
              
    });   

});


/*function post_vote(id, direction){
    $.ajax({
        type: "POST",
        url: entry_path+"/reviews/"+id+"/"+direction+"/",
        data: null,
        dataType: 'json',
        contentType: "application/json; charset=utf-8",
        success: function(json){
            $("#review_"+id+" .post_vote").hide();
            if(json.score.score>=0){$("#review_"+id+" .votes_helpful").text(json.score.score);}
            $("#review_"+id+" .votes_total").text(json.score.num_votes);
            $("#review_"+id+" .votes").show();
            display_message("success", gettext("Thanks for your feedback!"));
        }
    });
}*/
