﻿var clicked = false;
//jQuery.fn.extend({
//    AjaxReady : function(fn){
//        if (fn) {
//            return jQuery.event.add(this[0], "AjaxReady", fn, null);
//        } else {
//            var ret = jQuery.event.trigger("AjaxReady", null, this[0], false, null);
//            if (ret === undefined)
//                ret = true;
//            return ret;
//        }
//    }
//});


//$(document).AjaxReady(function(){
//    $(".infoBar").hide();
//    call();
//});

//function pageLoad(){
//    call();
//}


$(document).ready(function(){
    
    $(".infoBar").hide();
        

    if(clicked){
        $(".questionBox").css({'left':'0'});
        if($("#ctl00_middleContent_hiddenLanguage").val() == "FR"){
            $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/fr/liste-des-demandes-closed.png");
            $("#hiddenShow").value = "true";
        }else{
            $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/nl/liste-des-demandes-closed.png");
            $("#hiddenShow").value = "true";
        }
    }
    
    $(".infoBar").unbind();
    $(".infoBar").click(function(){
        $(".infoBar").hide();
        return false;
    });
    
    $(".demandListButton").unbind();
    $(".demandListButton").click(function(){
        $(".infoBar").hide();
        if(!clicked)
            $(".questionBox").animate( { left:0}, 1000, null, function(){
                clicked = true;
                if($("#ctl00_middleContent_hiddenLanguage").val() == "FR"){
                    $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/fr/liste-des-demandes-open.png");
                }else{
                    $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/nl/liste-des-demandes-open.png");
                }
            });
        else
            $(".questionBox").animate( { left:-675}, 1000, null, function(){
                clicked = false;
                if($("#ctl00_middleContent_hiddenLanguage").val() == "FR"){
                    $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/fr/liste-des-demandes-closed.png");
                }else{
                    $(".questionBox > a > img").attr("src","/site_images/dossiers/elections2010/nl/liste-des-demandes-closed.png");
                }
            });
        
        return false;
    });
    
    $("#Q2").hide();
    $("#Q3").hide();
    $("#q2btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
    $("#q3btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
    
    $("#q1btn").click(function(){
        $("#Q1").show();
        $("#Q2").hide();
        $("#Q3").hide();
        
        $("#q1btn").css({'border-bottom':'none','cursor':'default'});
        $("#q2btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        $("#q3btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        return false;
    });
    $("#q2btn").click(function(){
        $("#Q1").hide();
        $("#Q2").show();
        $("#Q3").hide();
        
        $("#q1btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        $("#q2btn").css({'border-bottom':'none','cursor':'default'});
        $("#q3btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        return false;
    });
    $("#q3btn").click(function(){
        $("#Q1").hide();
        $("#Q2").hide();
        $("#Q3").show();
        
        $("#q1btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        $("#q2btn").css({'border-bottom':'1px solid #000000','cursor':'pointer'});
        $("#q3btn").css({'border-bottom':'none','cursor':'default'});
        return false;
    });
});
