$(document).ready(function() {
    if (tb_detectMacXFF()) {
        $("#intro").addClass("introMacFFBGHack");
    } else {
        $("#intro").addClass("introBG");
    }
    $("#intro").add("#intro_space").css("display", "block");
    $("#intro").add("#intro_space").click(tb_remove);
    $("#intro_space div").each(

    function(intIndex) {
        var l = Math.floor(Math.random() * ($(window).width() - $("img", this).width()));
        var t = Math.floor(Math.random() * ($(window).height() - $("img", this).height()));
        $(this).css("left", l);
        $(this).css("top", t);
		
        $("img", this).fadeIn('slow', function() {});
		$(this).draggable({ zIndex: 2700 });
		
		$("img", this).mousedown(function() {
            //var z = $(this).css('z-index');
            $(this).css("z-index", 999);
			//alert( $(this).css('z-index'));
            
        });
		//$(this).topZIndex( { } );
		//$(this).draggable( "option", "zIndex", 2700 );
		//var zIndex = $(this).draggable( "option", "zIndex" );		
        //		
        /*
		$("img", this).mousedown(function() {
            //var z = $(this).css('z-index');
            $("img", this).topZIndex();
            
        });
		*/
        $(".logo").css("left", "50%");
        $(".logo").css("top", 150);
		$(".logo").css("margin-left", -310);
		$(".logo").css("background-color", "transparent");
		$("img", ".logo").css("border", "none");
		$("img", ".logo").css("outline", "none");
    });
});

function tb_detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox') != -1) {
        return true;
    }
}

function tb_remove() {
    //$("#intro").fadeOut("fast",function(){$('#intro_space,#intro').trigger("unload").unbind().remove();});
    $("#intro").add("#intro_space").fadeOut("fast");
    if (typeof document.body.style.maxHeight == "undefined") { //if IE 6
        $("body", "html").css({
            height: "auto",
            width: "auto"
        });
        $("html").css("overflow", "");
    }
    document.onkeydown = "";
    document.onkeyup = "";
    return false;
}
