﻿//usingFlash variable is injected by the code

$(document).ready(function() {
    $("#members_switch a").click(function() {
        $("div#members_wrapper").slideDown(400);
        $("div#members_wrapper").css({
            'position': 'absolute',
            'top': '0',
            'left': '0'
        });

        if (usingFlash) {
            $("#feature object").css("visibility", "hidden");
        }
        var bodyHeight = $("form:first").height();
        $("form:first").append("<div id='fader'></div>");
        $("#fader").css("height", bodyHeight + "px");
        $("#fader").css("opacity", "0");
        $("#fader").fadeTo(100, 0.8, function() { initialized = true; });
        $("#fader").bind("click", function(e) {
            if (usingFlash) {
                $("#feature object").css("visibility", "visible");
            }
            $("div#members_wrapper").slideUp(400);
            $("#fader").fadeTo(100, 0, function() { $("#fader").remove(); initialized = false; });
            $(".DESVALErrorText").css("display", "none");
            $(".error_msg").css("display", "none");
        });
	
	var $inputHack = $('#members_login .txtbox');

	if($inputHack.length !== 0)
		$inputHack.focus();
	

    });


    $("#btn-close").click(function() {
        if (usingFlash) {
            $("#feature object").css("visibility", "visible");
        }
        $("div#members_wrapper").slideUp(400);
        $("#fader").fadeTo(100, 0, function() { $("#fader").remove(); initialized = false; }).remove();
        $(".DESVALErrorText").css("display", "none");
        $(".error_msg").css("display", "none");
    });
});