$(document).ready(function() {
						   
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-4)){
			var toLoad = hash+'.php #content';
			$('#content').load(toLoad)
		}											
	});
	
	//$('#myIframe').ready(function(){alert('alive');});
	
	$('#nav li a').click(function(){
								  
		var toLoad = $(this).attr('href');//+' #content';
		var posplit = toLoad.split('_');
		
		$('#myIframe')[0].src = posplit[0];
		
		setTimeout("$('#myIframe').css('height', '"+posplit[1]+"px');", 500);
			setTimeout("$('#ramka').css('height', '"+posplit[1]+"px');", 500);
		
		//$('#myIframe').css('height', posplit[1]+'px');
		//$('#myIframe')[0].css('height',$('#myIframe')[0].contents().height()+'px');
		//$('#myIframe').each(function(index,rama){
		//	$(this).css('height',$(this).contents().height()+'px');
		//});
		
		
		//$('#content').hide('fast',loadContent);
		//$('#load').remove();
		//$('#content').append('<span id="load">ŁADOWANIE...</span>');
		//$('#load').fadeIn('normal');
		//window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-4);
		//function loadContent() {
		//	$('#content').load(toLoad,'',showNewContent())
		//}
		//function showNewContent() {
		//	$('#content').show('normal',hideLoader());
		//}
		//	function hideLoader() {
		//	$('#load').fadeOut('normal');
		//}
		return false;
		
	});

});
