﻿$(document).ready(function() {



    if ($.browser.msie && $.browser.version == "6.0") {
        //IE6 fix voor PNG
        $("html").pngFix();
        setTimeout("DrawVlineIe()", 500);
    } else {
        if (AllowShadows == 1) {
            MakeShadow();
        }
        else {
        }
    };





    $(".wachtwoord_vergeten").click(function() {
        DoPopupWachtwoordVergeten();
    });

    $(".container_popup .btn_sluiten").click(function() {
        if (AllowHeavyAnimations == 1) {
            $(".container_popup").fadeOut(600);

            $(".container_content").animate({
                opacity: "0.99"
            }, 600);
        }
        else {
            $(".container_popup").css("display", "none");
            $(".container_content").css("display", "block");
        }
    });

    $(".passwordfield").focus(function() {
        focusfield();
    });

    $(".login").click(function() {
        //$(this).val("");
    });

    setTimeout("focususer()", 1500);

});

function DoPopupWachtwoordVergeten() {

    if ($("#upPopup table").hasClass("yellow") == true) {
        $(".container_popup").removeClass("orange");
        $("#upPopup .yellow").parent().parent().parent().parent().parent().parent().find(".container_popup").addClass("yellow");
    }
    else if ($("#upPopup table").hasClass("orange") == true) {
        $(".container_popup").removeClass("yellow");
        $("#upPopup .orange").parent().parent().parent().parent().parent().parent().find(".container_popup").addClass("orange");
    }

    $("html, body").css("overflow", "hidden");
    // Krijg de absolute position van de knop
    var positionKnop = $(".popup_lessen").offset()

    if (AllowHeavyAnimations == 1) {
        $(".container_popup .fadein").css("display", "none");
    }
    else { }


    // Container_popup klein maken
    $(".container_popup").css("width", "10px");
    $(".container_popup").css("height", "10px");
    //$(".container_popup").css(positionKnop);
    $(".container_popup").css("top", "3000px");
    $(".container_popup").css("left", "0");
    $(".container_popup").css("margin-left", "0");
    $(".container_popup").css("margin-top", "1200");

    //IE8 hack
    //$(".container_content").css('-ms-filter:','"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"');

    //alert(positionKnop.top);
    // Content gedeelte fade
    //$(".container_content").animate({ 
    //   opacity:"0.2"
    //}, 1500 );
    if (AllowSifr == 1) {
        jQuery.getScript('/javascript/Common/launchsifr.js');
    }
    else { }
    if (AllowHeavyAnimations == 1) {
        $(".container_content").fadeTo("slow", 0.2);
    }
    else {
    }

    var BodyHeight = $("body").outerHeight();
    var container_contentHeight = $(".container_popup").outerHeight();
    var top_height = (BodyHeight - 450) / 4;

    if (AllowHeavyAnimations == 1) {
        //Popup animeren
        $(".container_popup").animate({
            width: "30",
            height: "30",
            marginLeft: "-190",
            marginTop: "20",
            top: top_height,
            left: "50%"
        }, 1000);


        $(".container_popup").animate({
            width: "380",
            height: "170"
        }, 1000, function() {
            $(".container_popup .fadein").fadeIn(1000); $("html, body").css("overflow", "hidden");


            $('#popup_pane1').jScrollPane(
	        {
	            reinitialiseOnImageLoad: true,
	            tabIndex: false,
	            enableKeyboardNavigation: false
	        });


        });



    }
    else {

        $(".container_popup").css("display", "block");
        $(".container_popup").css("width", "380px");
        $(".container_popup").css("height", "170px");
        $(".container_popup").css("top", top_height);
        $(".container_popup").css("margin-top", "0px");
        $(".container_popup").css("margin-left", "-190px");
        $(".container_popup").css("left", "50%");

        setTimeout("MakeScrollPopup()", 1500);

        $(".blok_container .blok_container").css("*left", "-0px");
        $(".blok_container .blok_container").css("_left", "-0px");


    }


    // Om shadow weer terug te krijgen.
    if (AllowShadows == 1) {
        MakeShadow();
    }
    else { }

    setTimeout("doSifr()", 100);

}

function focusfield() {
    $(".passwordfield").css("display", "none");
    $(".realpasswordfield").focus();
    $(".realpasswordfield").addClass("active");
}

function focususer() {
    if ($(".login").length > 0) {
        $("#Login1_UserName").focus();
        $("#Login1_UserName").select();
        //alert("FOCUS"); 
    }

}

function inlogCheck() {

$(".wachtwoord_melding").css("display", "block");
$(".passwordfield").css("top", "118px");

}



