$(document).ready(function() {
    if($.browser.msie && $.browser.version=="6.0")
    {
        $('.gallery .main-photo .photo a').attr('target', '_blank');
        $('.gallery .main-photo .bottom a').attr('target', '_blank');
        $('.gallery ul.photos li a').attr('target', '_blank');
        $('.ngg-gallery-thumbnail a').attr('target', '_blank');
        
    }
    else
    {
        $('.ngg-gallery-thumbnail a').fancybox({
    		'titleShow'     : false
    	});
    	
    	$('.gallery .main-photo .photo a[rel=madohora-gallery]').fancybox({
    		'titleShow'     : false
    	});
    	$('.gallery .main-photo .bottom a').click(function() {	    
    		$(this).parent().parent().find('.photo a').trigger('click');
    		return false;	
    	});
    	$('.gallery ul.photos li a').click(function() {		
    		$('.gallery .main-photo').hide();
    		$('#main-' + $(this).attr('id')).show();
    		
    		//path = $(this).find('img').eq(0).attr('src');
    		//$('#main-photo .photo a img').attr('src', path);
    		//$('#main-photo .photo a').attr('href', $(this).attr('href'));
    		
    		location.href = "#gallerytop";
    		return false;
    	});    
    }	
});

function initialize() 
{
	if (GBrowserIsCompatible()) 
	{
		var map = new GMap2(document.getElementById("map"));
		var center = new GLatLng(49.73424381990674, 19.382972717285156);
		map.setCenter(new google.maps.LatLng(49.776387, 19.309158), 10);
		
		var customUI = map.getDefaultUI();
        // Remove MapType.G_HYBRID_MAP
        customUI.maptypes.hybrid = false;
        map.setUI(customUI);

		// add marker
		var point = new GLatLng(49.73424381990674, 19.382972717285156);
	var marker = new GMarker(point);
	map.addOverlay(marker);
	GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml('<img src="http://madohora.pl/wp-content/uploads/2010/02/logo_madohora.jpg" width="150" height="128">');});
	}
}
