jQuery(document).ready(function() {

	$('#agencies-shortcut li').click(function() {
		$(this).children('.city').toggle();
	}); //,function() {
	//	$(this).children('.city').slideUp(40);
	//});
	
	$('.slide').mouseover(function() {
		$('.offerlist').show();
		
	});
	$('.slide').mouseout(function() {
		if(!$('.offerlist').data('over'))
		{
			$('.offerlist').hide();
		}
	});
	$('.offerlist').mouseover(function() {
		$('.offerlist').show();
		$('.offerlist').data('over',true);
	});
	$('.offerlist').mouseout(function() {
			$('.offerlist').hide();
			$('.offerlist').data('over',false);
	});
	
	
	
	$('.num').click(
		function(){
			$('.promo').hide().eq($('.num').index(this)).show();
		}
	);
	
});

$(document).ready(
	function(){
		
		
		$('.bsMapView').each(
			function()
			{
				$('#bs-'+$(this).attr('rel')).dialog({ 
					autoOpen: false, 
					show: 'fold', 
					height: 300,
					width: 400, 
					resizable: false, 
					hide: 'blind',
					open: function(){
						if(GBrowserIsCompatible()) 	// sprawdzamy, czy przeglądarka jest kompatybilna
									{
											if(GBrowserIsCompatible()) 	
											{
												var mapa = new GMap2(this);
												mapa.setCenter(new GLatLng($(this).data('lat'),$(this).data('lng')),14);
											}
											var marker = new GMarker(new GLatLng($(this).data('lat'),$(this).data('lng')));
											mapa.addOverlay(marker);
									}
					}
					});
			}
		);
				
		$('.stopsView').each(
			function()
			{
				$('#busStops-'+$(this).attr('rel')).attr('title',$(this).attr('title'));
				$('#busStops-'+$(this).attr('rel')).dialog({ autoOpen: false,resizable: false, show: 'fold', hide: 'blind', width: 600});
			}
		);
		
		
		
		$('.stopsView').click(
			function()
			{
				$('#busStops-'+$(this).attr('rel')).dialog('open');
			}
		);
		
		$('.bsMapView').click(
			function()
			{
				$('#bs-'+$(this).attr('rel')).dialog('open');
			}
		);
	}
);

function slidePhoto()
{
	if($('#offer-photos').css('height')=='60px')
	{
		$('#offer-photos #op-toggle a').html('Schowaj zdjęcia');
		$('#offer-photos div:not(#op-toggle)').show('fast');
		$('#offer-photos').animate({height: 299, marginLeft: 45, width: 651});
		$('.right').animate({marginTop: -440});
	}
	else
	{
		$('#offer-photos div:not(#op-toggle)').hide('fast');
		$('#offer-photos #op-toggle a').html('Pokaż zdjęcia');
		$('#offer-photos').animate({height: 60, marginLeft: 35, width: 661});
		$('.right').animate({marginTop: -200});
	}
}

