function CreateBookmarkLink(title,url) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
 
function fixBoxWideHeight(rem){
	$('div.boxWide').each(function(){var _h = parseInt($(this).height());var _n_h = _h - rem;$(this).find('div.ie_m').height(_n_h);});
	$('div.ie_b').attr("style","bottom:0;");

	}

var IplaObject = {
	
	construct: function(){
	
		/*menu hover*/
		$('#menu ul li').hover(function(){$(this).addClass('hov_t')},function(){$(this).removeClass('hov_t')});

		IplaObject.fixIEHeight('div.boxWide',211);		
		if(window.sidenoresize!=1)
			IplaObject.fixIEHeight('#sidebar .sideBox',217);
	},
	
	/* Funkcja dostosowywujaca wysokosc boxu
	 * @param className - nazwa klasy 
	 * @param remHeight - wysokosc do odjecia od 
	 */ 	
	fixIEHeight : function(path, remHeight){
		
		$(path).each(function(){
			var _h = parseInt($(this).height());
			var _n_h = _h - remHeight;
			$(this).find('div.ie_m').height(_n_h);
			
			$(this).find('div.ie_b').attr("style","bottom:0;");
			
			}
		);		
	},
	
	contactClick : function(){
		$('div.boxWide div.ie_m').height(65);
		$('#zoom_in').click(function(){
		$('#map').attr('src','/templates/ipla/gfx/map-big.jpg');
		$('#map').attr('height','639');
		$('#zoom_in').hide();
		$('div.boxWide div.ie_m').height(468);
		$('#zoom_out').show();
		});
		$('#zoom_out').click(function(){
		$('#map').attr('src','/templates/ipla/gfx/map-small.jpg');	
		$('#map').attr('height','236');		
		$('#zoom_out').hide();
		$('div.boxWide div.ie_m').height(65);
		$('#zoom_in').show();	
		});
	},
	
	newsList : function(){
		 $('div.newsList > div.item > h2').click(function(){
		 	$(this).toggleClass('sel');
			
			if($(this).hasClass('sel')){
				window.location.hash = $(this).attr('id');	
			}else{
				window.location.hash = '';
			}
			
			$(this).parent().find('div.container').toggleClass('hide');
						
			IplaObject.fixIEHeight('#newsList',211);
			
			$('#newsList div.ie_b').attr("style","bottom:0;");
			$('#newsList div.footerPager').attr('style','bottom:20px;'); ;});	
		
	},
	checkNewsClick : function(){
		var newsHash = window.location.hash;
		if(newsHash)
		{
			$(newsHash).click();
			list_nr = parseInt($(newsHash).parent().parent().attr('id').split('_')[1]);
			if(list_nr > 0){
				IplaObject.toggleView(list_nr);
				
				if($('#h_'+list_nr).parent().hasClass('subsection')){
					IplaObject.toggleView($('#h_'+list_nr).parent().attr('id').split('_')[1]);
					
					
				}
				
			}
			
			
			
			/* pętla until*/
			
			
			
					
		}	
	},
	
	toggleView : function(id){
		
		$('#list_'+id).toggle();
		IplaObject.fixIEHeight('#newsList',211);
		
		/*
		if($('#h_'+id+' span').html()=='[+]'){
			$('#h_'+id+' span').html('[-]'); 
		}else{
			$('#h_'+id+' span').html('[+]'); 			
		}*/
		
		if($('#h_'+id+' span').hasClass('hasplus')){
			$('#h_'+id+' span').removeClass('hasplus');
			$('#h_'+id+' span').html('<img src="/templates/ipla/gfx/ico-minus.gif" alt="zwiń" />'); 
		}else{
			$('#h_'+id+' span').addClass('hasplus');
			$('#h_'+id+' span').html('<img src="/templates/ipla/gfx/ico-plus.gif" alt="rozwiń" />'); 			
		}
		

		
	}
}	

$(document).ready(function(){
	IplaObject.construct();
});
