
/* do wyszukiwarki */

	var selector = [];
	function Selector(id, value)
	{
		this.id=id;
		this.value=value;
	}
	

$(document).ready(function(){ 
		
/* do youtube */	


		$('div.post a[href*="http://www.youtube"]').each(function(i){
			$(this).css('display','none');
			$(this).after('<div class="yt' + i + '"></div>');
			$('div.yt'+i).youTubeEmbed( 
				{
					video : $(this).attr('href'),
					width : 485
				}
			);
		});


	/* do wyszukiwarki */
	
		
	var elements = $('.search').get();
		
	for(var i = 0; i < elements.length; i++)
		selector[i] = new Selector($(elements[i]).attr('id'), $(elements[i]).val());

	jQuery.each(selector, function() {
		var s = this;
		$('#' + s.id).focus(function () {
			if($(this).val() == s.value)
				$(this).val('');
			$(this).blur(function() {
				if($(this).val() == '')
					$(this).val(s.value);
			});
		});
	});
	
		
		$("a[rel=galeria]").fancybox({
		
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'		
		/* 'titlePosition' 	: 'inside', 
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return 'Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title ; 
		}*/
	 });  
	


		
		/* $("a.mymap").click(function(){
									$("#mapka").toggle('slow', function(){$(mapaStart())});
									// $("#right").toggle('slow').delay(800).toggle('slow'); 
								}) ; */
				
		$(document).pngFix(); 
		
  /*$("a[@href^='http']").attr('target','_blank');
  
  $('a[rel="external"]').click(function(){ // When a link with rel="external"is clicked ...
			window.open( $(this).attr('href') ); // ... open a new window using the link's href attribute ...
 
			return false; // ... and prevent the default browser functionality (opening the link in the same window).
		}) */
/* dodanie ikonki mowiacej o linku zewnetrznym 
  $('#tresc2 a').filter(function() {
								return this.hostname && this.hostname !== location.hostname;
								}).after(' <img src="/images/external.png" style="display: inline; border:0; padding:0; margin:0;" alt="external link" title="Link zostanie otwarty w innym oknie" />');
*/
  $('#maincontent a')
					.filter(function() {
							return this.hostname && this.hostname !== location.hostname;
							})
					.click(function(){ // When a link with rel="external"is clicked ...
									window.open( $(this).attr('href') ); // ... open a new window using the link's href attribute ...
									return false; // ... and prevent the default browser functionality (opening the link in the same window).
									});	 

/* $('a[href^="http://"]')
  .attr({
    target: "_blank", 
    title: "Opens in a new window"
  })
  .append(' [^]');   */


/* Firefox 2 i wyżej
if ($.browser.mozilla && $.browser.version >= "1.8" ){
 
}
 
// Safari
if( $.browser.safari ){
 
}
 
 Google Chrome
if( $.browser.chrome){
 
}
 
 Opera
if( $.browser.opera){
 
}
 
 IE6 i starsze
if ($.browser.msie && $.browser.version < = 6 ){
 
} 
*/

// IE7/IE8
if ($.browser.msie  && $.browser.version >= 6 && $.browser.version < 8){

	if(!$.cookie("_brw"))
	{
		alert('Używasz bardzo starej przeglądarki IE' + $.browser.version +', lub masz włączony "Widok zgodności ze starymi przeglądarkami". Wyłącz widok zgodności, uaktualnij przeglądarkę za darmo przez Windows Update lub sciagnij jedną ze sprawdzonych: Firefox, Chrome, Safari');
		$.cookie("_brw", $.browser.version, { expires: 1 });
	}
} 
if ($.browser.msie  && $.browser.version == 6){

		alert('Używasz bardzo starej przeglądarki IE' + $.browser.version +', lub masz włączony "Widok zgodności ze starymi przeglądarkami". Wyłącz widok zgodności, uaktualnij przeglądarkę za darmo przez Windows Update lub sciagnij jedną ze sprawdzonych: Firefox, Chrome, Safari');
} 
if ($.browser.msie && $.browser.version < 6){

	alert('Używasz archaicznej przeglądarki IE' + $.browser.version +' . Uaktualnij ją za darmo przez Windows Update lub sciagnij Firefox w wersji co najmniej 2.0');
} 

  
/*		
		$("div").corner("round");
		
		$("div, ul, li").mouseover(function(){$(this).addClass('div')});
		$("div, ul, li").mouseout(function(){$(this).removeClass('div')});
		
		$("div, ul, li").click(function(){$(this).hide('fast')});

		$("p, a, h1, h2, input").mouseover(function(){$(this).addClass('uppercase')});
		$("p, a ,h1, h2, input").mouseout(function(){$(this).removeClass('uppercase')});
*/
		/* $("#logo").click(function(){$("#slogan").toggle("fast", function(){alert("koniec animacji")})}); */
/*		$("#logo").mouseover(function(){$("#logo").find("a").text('Twój Powiat !')});
		$("#logo").mouseover(function(){
			$(this).animate({paddingLeft: "30px"}, 100,function(){$(this).addClass('minilogo');});
		});
		$("#logo").mouseleave(function(){
			$(this).animate({paddingLeft: "0px"}, 100, function(){$(this).removeClass('minilogo');});
		});
*/
		/* $("#header_bottom").find("span").text('email: starostwo@powiat-ostrowski.pl').click(function(){alert("Blokada antyspamowa, zaznacz i skopiuj adres.")}); 
		function(){$(this).replaceWith("<h1>" + $(this).text() + "</h1>");} 
		$(".www").mouseover(function(){$(this).replaceWith("<h1 class=\"www\"><a href=\"#\" title=\"Strona główna\">Powiat-<span class=\"red\">Ostrowski<\/span>.pl<\/a><\/h1>");});
		$(".www").mouseout(function(){$(this).replaceWith("<h1 class=\"www\"><a href=\"#\" title=\"Strona główna\">Powiat <span class=\"red\">Ostrowski<\/span><\/a><\/h1>");});
		*/
		

});


$(function(){
	$("#tabs").tabs({
			cookie: {
			// store cookie for a day, without, it would be a session cookie
			expires: 1
			}
	});
});

$(function() {
	$("#1, #2, #3").lavaLamp({
			fx: "backout",
			speed: 300,
			click: function(event, menuItem) {
			return false;
			}
	});
});

$(function() {$('#nav').droppy();});

