$(document).ready(function(){				
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'120px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'180px'},{queue:false,duration:160});
				});
				
				$("#slider").easySlider({
				auto: true, 
				continuous: true,
				controlsShow: false
				});
				$(".contimage").hover(function() {
			$(this).animate({
				opacity:1
			},200);
		}, function() {
			$(this).animate({
				opacity:0.8
			},200);
		});
		
		$('#submitform').ajaxForm({
			target: '#error',
			success: function() {
			$('#error').fadeIn('slow');
			}
	});
	//Button formularz kontaktowy
	$('a[rel*=facebox]').facebox()
            $(".buttonf").hover(function(){
                $(".buttonf img")
                .animate({top:"-10px"}, 200).animate({top:"-4px"}, 200) // first jump
                .animate({top:"-7px"}, 100).animate({top:"-4px"}, 100) // second jump
                .animate({top:"-6px"}, 100).animate({top:"-4px"}, 100); // the last jump
            });
			
			
			
			
			
			
			//Mapy googla
			if (document.getElementById("map_canvas")) {
				   
				//javascript:void(prompt('',gApplication.getMap().getCenter())); - wspolrzedne
				//Default map center location
				var defaultLat = 49.624854;
				var defaultLon = 20.702458;				
				var markers = new Array();
				markers[0] = new Array(new GMarker(new GLatLng(49.593508, 20.732954)), "Hurtownia - Nowy Sacz", "<strong>33-300 Nowy Sącz<br />ul. Piłsudskiego 1</strong><br/>(na przeciw McDonald's)<br />tel/fax 0-18 443-60-09<br />tel.kom. 604-118-378<br /><a href='mailto:hurt.b4@neostrada.pl'>e-mail: hurt.b4@neostrada.pl</a>");
				//markers[1] = new Array(new GMarker(new GLatLng(49.624854, 20.702458)), "Sklep - Nowy Sacz", "<strong>33-300 Nowy Sacz<br />ul. Lwowska //57</strong><br/>tel/fax 0-18 443-25-07<br /><br /><a href='mailto:b4.nowysacz@neostrada.pl'>e-mail: b4.nowysacz@neostrada.pl</a>");
				 markers[1] = new Array(new GMarker(new GLatLng(49.616494, 20.697696)), "Sklep - Nowy Sacz", "<strong>33-300 Nowy Sącz<br />Plac Dąbrowskiego 4</strong><br/>Galeria „Arkadia” <br />(obok dworca PKS)<br />tel.kom.728-329-956");
                markers[2] = new Array(new GMarker(new GLatLng(49.414207, 20.956392)), "Sklep - Krynica-Zdrój", "<strong>33-380 Krynica Zdrój<br />ul. Kraszewskiego 41</strong><br/>tel/fax: 0-18 471-42-60<br />tel.kom. 604-118-287<br /><a href='mailto:b4.krynica@neostrada.pl'>e-mail: b4.krynica@neostrada.pl</a>");
                markers[3] = new Array(new GMarker(new GLatLng(49.662182,21.162345)), "Sklep - Gorlice", "<strong>38-300 Gorlice<br />ul.Biecka 10</strong><br/>Dom Towarowy „PEPS”<br />tel.kom.728-329-957");

				var map = new google.maps.Map2($("#map_canvas").get(0));//Initialise google maps
				map.setCenter(new GLatLng(defaultLat, defaultLon), 9);//Set location to the default and zoom level to 8
				//map.disableDoubleClickZoom();//Disable zooming
				 map.setUIToDefault();

				//This section works fine but does not animate on load
				
				$(markers).each(function(i,marker){
				   map.addOverlay(marker[0]);
					$("<li />")
						.html(markers[i][1])//Use list item label from array
						.click(function(){
							displayPoint(marker[0], i);
							setActive(this);//Show active state
							if ($('#map_message').is(':hidden')) {//Allow toggling of active state
								setActive();
							}
						})
						.appendTo("#map_list");
					
				    GEvent.addListener(marker[0], "click", function(){
						displayPoint(marker[0], i);
					    setActive(i);//Show active location
						if ($('#map_message').is(':hidden')) {//Allow toggling of active state
							setActive();
						}
					});
				});
				
				/*
				$.each(markers,function(i,marker){
					var delayTime = ((i * 3000) / (0.5 * markers.length));//Delay time decreases as number of markers increases
				
					setTimeout(function(){ 
						map.addOverlay(marker[0]);
						$("<li />")
							.html(markers[i][1])//Use list item label from array
							.click(function(){
								displayPoint(marker[0], i);
								setActive(this);//Show active state
							})
							.appendTo("#map_list");
					
						GEvent.addListener(marker[0], "click", function(){
							displayPoint(marker[0], i);
							setActive(i);//Show active location
						});
						
						displayPoint(marker[0], i);
						setActive(i);//Show active location
						if (i == (markers.length - 1)) {//If last item in array
							setTimeout(function(){//Remove active class and fade marker after delay
								$("#map_message").fadeOut();
								//setActive();
							}, 3500);
						}
					}, delayTime); 
				});
				*/
				$("#map_list").css("opacity","0.2").animate({opacity: 1}, 1100);//Fade in menu
				$("#map_message").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));
								
				function displayPoint(marker, index){
					if ($('#map_message').is(':hidden')) {//Allow toggling of markers
						$('#map_message').fadeIn();
					}
					else{//Remove all .active classes and hide markers
						$('#map_message').hide();
						$(".active").removeClass();
					}
					//$("#map_message").hide();//Default behaviour, doesn't allow toggling
					
					var moveEnd = GEvent.addListener(map, "moveend", function(){
						var markerOffset = map.fromLatLngToDivPixel(marker.getLatLng());
						$("#map_message")
							.html(markers[index][2])//Use information from array
							.fadeIn()
							.css({ top:markerOffset.y, left:markerOffset.x });
					GEvent.removeListener(moveEnd);
					});
					map.panTo(marker.getLatLng());
				}	
				
				function setActive(el){
					$(".active").removeClass();//Remove all .active classes
					$("#map_list").find('li').eq(el).addClass('active');//Find list element equal to index number and set active
					$(el).addClass('active');//Set active if list element clicked directly
				}
			}
	//Koniec map googla
			
			});
	
