$(document).ready(function () {

	$(".bigContainer").css({
		width: "970px",
		height: "680px",
		margin: "auto",
	
		position: "relative"
		
	});
    resize_layout();


    $(window).resize(function () {
        resize_layout();
    });



});



function resize_layout() {
	
	//$("body").css("overflow", "hidden");
    //redimensionez meniul de sus
    var size = 0;
    $("#top-menu li").each(function () {

        size += $(this).width();
 
    });

    //alert(size);

    $("#top-menu .right").css({"width": size+"px"});


    if ($(".bigContainer").width() < size) $("#umplutura-1").hide();
                             else $("#umplutura-1").show();
    
    var maxh = $(window).height();
	
    if(maxh < $(".bigContainer").height()){maxh=$(".bigContainer").height(); $(".bigContainer").css({top:"0px"})}
     							else $(".bigContainer").css({top: ((maxh-$(".bigContainer").height())/2)+"px"})
								
    var h = $(".bigContainer").height() - $("#header").innerHeight() - $("#footer").outerHeight();

	var ooo = $(".bigContainer").offset()
	
	var top = ooo.top

    $("#content").css("scroll-x", "0px");
    $("#content").css("height", h+"px");
    $("#bg-image").css("height", h + "px");
    $("#bg-image").css("width", $("#content").width() + "px");

    $("#top-menu").css({ position: "absolute", top:  (ooo.top + 85) + "px", left: ooo.left + "px", width: $(".bigContainer").width() });
    $("#bottom-menu").css({ position: "relative", top: "-" + ($("#bottom-menu").outerHeight()) + "px" });

    var o = $("#top-menu").find('.right').offset();
    var s = $(".bigContainer").width() - size;
	
    $("#umplutura-1").css({"width": s + "px", "padding": "0px"});  
    $("#bottom-menu").css("width", $(".bigContainer").width() + "px");

    var s = 0;

    $("#bottom-menu li").each(function () {

        s += 100;

    });
    
    $(".admin_menu").each(function () {

        s += 120;

    });


    $("#login_menu").parent().parent().css("width", s+"px");

    

    if($(".show_article").html())
    {
        
        o = $("#content").offset();

        h = 480;
        
		$(".show_article").css("height", h+"px");
        var t = o.top + $("#content").height() - $(".show_article").outerHeight() - $("#bottom-menu").outerHeight() - 50;
        
		
		
        var l = $(".bigContainer").width() - $(".show_article").outerWidth() - 20 + o.left;
		
		var tt = parseInt($(".bigContainer").css("margin-top"))
		
		
		if(!tt) tt = 0;
		tt+= 130 +top;
		
		
		$(".show_article").css({ top: tt+"px",
            left: l + "px",
			position: "absolute"
        });


        $('.show_article .data').css("height", h + "px");
        $('.show_article .data').css("padding-right", "30px");

        $('.show_article .data').jScrollPane({ scrollbarWidth: 8, scrollbarMargin: 10, showArrows: false });

        
    }
    
	$(".bigContainer").show()
    
}




