	function pokaz_main_menu(n)
	{
		if ($("main_menu_"+n)) $("main_menu_"+n).style.display = "block";
		$("start_"+n).className = " "; //header_menu_menuitem_here
	}

	function ukryj_main_menu(n)
	{
		if ($("main_menu_"+n)) $("main_menu_"+n).style.display = "none";
		$("start_"+n).className = "";
	}





// G-MAP INITIALIZATION

	function GMap_initialize_contact() {
	    if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map_contact"));
			map.setCenter(new GLatLng(52.25435414490518, 21.002233028411865), 14);
			var marker = new GMarker(new GLatLng(52.25435414490518, 21.002233028411865));
			map.addOverlay(marker);
			map.addControl(new GSmallMapControl());
		}
	}

	function GMap_initialize_company() {
		
	    if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map_company"));
			
			var address = document.getElementById("full_company_address").innerText;
			if (!address) address = $("#full_company_address").text();
                
            var apiKey = "ABQIAAAAsWzAjZ_NU0nWZWxPqtb9ghQV8kwYEkG8r0ScBIPK8OhjCmJw_xThlZgsgtsI-25J1ELFr-VGer331Q";    
            jQuery.getJSON("http://maps.google.com/maps/geo?q="+ address +"&key="+apiKey+"&sensor=false&output=json&callback=?", function(data, textStatus){
                if (data && data['Placemark'] && data['Placemark'].length > 0) {
                    var placemark = data['Placemark'][0];
                    var latitude = placemark['Point']['coordinates'][1]
                    var longitude = placemark['Point']['coordinates'][0]
                    map.setCenter(new GLatLng(latitude, longitude), 14);
                    var marker = new GMarker(new GLatLng(latitude, longitude));
                    map.addOverlay(marker);
                    map.addControl(new GSmallMapControl());
                }
                
            });
		}
	}


$(document).ready(function() {
    
	// INITIALIZATION
	
    jQuery(".article_gallery_wrapper").mySlider2();

//	GMap_initialize_contact();
//	GMap_initialize_company();



	var galleryOffset = 0;
	var galleryWidth = 0;
	jQuery("body").find(".paginator_entry").each(function() {
		galleryWidth += 190;
	});


/*
	jQuery("div").find(".home_pressteaser_pressnote_rightquote").each(function() {
		var quoteOffset = $(this).prev().height();
		$(this).css("top", quoteOffset-50);
	});
*/


	jQuery(".propagate_inside").bind("click", function() {
		window.location.href = $(this).children().attr("href");
    });


/*
	// pagination container width to center it
	var width = 0;
	jQuery("body").find(".paginator_entry").each(function() {
		width = width + $(this).outerWidth() + 5;
	});
	width = width + 25 + 25;
	$("#paginator_entires_wrapper").css("width", width);
	var offset = ($("#paginator_entires_wrapper").parent().width() - width) / 2;
	$("#paginator_entires_wrapper").css("left", offset);
*/




	// REGULAR jQUERY FUNCTIONS

	jQuery(".header_logo").live("click", function(){window.location.href = "TODO";});


/*
	jQuery(".header_menu_menuitem").live("mouseenter", function() {
		$(this).addClass("header_menu_menuitem_active");
		$(this).find(".header_menu_menuitem_arrow").addClass("header_menu_menuitem_arrow_active");
	});
	jQuery(".header_menu_menuitem").live("mouseleave", function() {
		$(this).removeClass("header_menu_menuitem_active");
		$(this).find(".header_menu_menuitem_arrow").removeClass("header_menu_menuitem_arrow_active");
	});
	jQuery(".header_menu_menuitem").live("click", function() {
		var currentId = $(this).attr('id');
		if (currentId == "menu_home")		{window.location.href = "TODO";};
		if (currentId == "menu_news")		{window.location.href = "TODO";};
		if (currentId == "menu_projects")	{window.location.href = "TODO";};
//		if (currentId == "menu_about")		{window.location.href = "TODO";};
		if (currentId == "menu_search")		{window.location.href = "TODO";};
		if (currentId == "menu_join")		{window.location.href = "TODO";};
		if (currentId == "menu_contact")	{window.location.href = "TODO";};
	});



	$("#home_box_docs"		).live("click", function(){window.location.href = "TODO";});
	$("#home_box_management").live("click", function(){window.location.href = "TODO";});
	$("#home_box_join"		).live("click", function(){window.location.href = "TODO";});

	$("#legislacjon").live("click", function(){window.location.href = "http://www.legislacjon.pl";});
*/


	jQuery(".input").live("focus, mouseenter", function() {
		$(this).addClass("input_active");
	});
	jQuery(".input").live("blur, mouseleave", function() {
		$(this).removeClass("input_active");
	});
	


	jQuery(".search_result_wrapper").live("focus, mouseenter", function() {
		$(this).addClass("search_result_wrapper_active");
	});
	jQuery(".search_result_wrapper").live("blur, mouseleave", function() {
		$(this).removeClass("search_result_wrapper_active");
	});

		



});








(function( jq ) {
    jq.fn.mySlider2 = function() {

        return this.each(function() {
            var $this = jQuery(this);
            
            var w =  jQuery(".article_gallery_picture_wrapper:first-child", $this).width();
            var h =  jQuery(".article_gallery_picture_wrapper:first-child", $this).height();
            var next = jQuery("#article_gallery_right", $this);
            var prev = jQuery("#article_gallery_left", $this);

            $this.data("busy", false);
                        
            next.click(function() {
                if ($this.data("busy"))
                    return;
                    
                $this.data("busy", true);
                var divs = jQuery(".article_gallery_picture_wrapper", $this);
                
                if (divs.length <= 3) 
                    return;
                    
                jQuery(divs[3]).css('width', '0px').css('opacity', 0);
                jQuery(divs[0]).animate({width: '0px', opacity: 0}, 250, function() {
                    jQuery(divs[divs.length - 1]).after(divs[0]);
                    jQuery(divs[0]).hide();
                    $this.data("busy", false);
                    jQuery(divs[3]).show().animate({width: ''+w+'px', opacity: 1}, 250);
                });
                
            });
            
            prev.click(function() {
                if ($this.data("busy"))
                    return;
                    
                $this.data("busy", true);
                var divs = jQuery(".article_gallery_picture_wrapper", $this);
                
                if (divs.length <= 3) 
                    return;

                jQuery(divs[divs.length - 1]).css('width', '0px').css('opacity', 0);
                jQuery(divs[0]).before(divs[divs.length - 1]);
                jQuery(divs[2]).animate({width: '0px', opacity: 0}, 250, function() {
                    jQuery(divs[2]).hide();
                    $this.data("busy", false);
                    jQuery(divs[divs.length - 1]).show().animate({width: ''+w+'px', opacity: 1}, 250);
                });
                
            });
        
        });
    };
})( jQuery );

