
	// Główne 

	function stratujzinfo(i)
	{
		var ua = navigator.userAgent;
		if (ua.indexOf("MSIE") > 0) { i.style.behavior='url(#default#homepage)'; i.setHomePage('http://info.elblag.pl/'); } else { location.href = "/startuj.html"; } 
	}

	//
	function zamykajdiva(elementID) 
	{ 
		if (document.getElementById) 
		{ // DOM3 = IE5, NS6 
		  document.getElementById(elementID).style.visibility = 'hidden'; 
		  document.getElementById(elementID).style.display = 'none'; 
		  document.getElementById(elementID).setAttribute( 'style', 'display:none' );
		  document.getElementById(elementID).setAttribute( 'style', 'visibility:hidden' );
 		} 
		
 	} 
	
  	/*
	function ZaladujZajawki()
	{	 
		$(document).ready( function()
		{	 
			var buttons = { previous:$('#artykuly-glowne-2 .lof-previous') , next:$('#artykuly-glowne-2 .lof-next') };
			$obj = $('#artykuly-glowne-2').lofJSidernews({ 
				
				interval:5000,
				direction : 'opacity',
				easing:'easeOutExpo',
				duration:2000,
				auto:true,
				mainWidth:985,
				buttons:buttons,
				maxItemDisplay:3,
				navPosition:'horizontal',
				navigatorHeight : 95,
				navigatorWidth  : 109,
				startItem:0
				
			});	
		});
	}
 
	$(document).ready(function() 
	{
		$(".carousel").dualSlider({
			auto:true,
			autoDelay: 6000,
			easingCarousel: "swing",
			easingDetails: "easeOutBack",
			durationCarousel: 1000,
			durationDetails: 300
		});
	});
	
 	function MenuInfo()
	{
		$('#nav .sel').parent().find('UL').css('display','block');
		$('#nav .sel').attr('id','actual');
		
		$('#nav .gNav').parent().hover(function(){
			$('#nav .sel').removeClass('sel');
			
			if ($(this).find('.gNav').attr('id') != 'actual') {
				$('#actual').parent().find('UL').css('display','none');
			}
			
			$(this).find('.gNav').addClass('sel');
		}, function(){
			if ($(this).find('.gNav').attr('id') != 'actual') {
				$('#actual').parent().find('UL').css('display','block');
				$('#actual').addClass('sel');
				$(this).find('.gNav').removeClass('sel');
			}
		});
	}

	$(function() {
		
 		// 
		// MenuInfo();
 
	});
	*/
 	
	/*
	function ArtKategorie()
	{
		$('#loader').hide()
		$('#art_kategorii').change(function()
		{
			$('#wyniki').fadeOut();
			$('#loader').show();

			$.post("ajax/ajax_art_kategorie.php", {
				art_kategorii: $('#art_kategorii').val()
			}, function(response){
				setTimeout("finishAjax('wyniki', '"+escape(response)+"')", 100);
			});
			return false;
		});


 	}	
	*/
	
  	//
	// $(document).ready(function() { $('#art_kategorii').selectbox({debug: true}); });
	
  	//
	function finishAjax(id, response)
	{
		$('#loader').hide();
		$('#'+id).html(unescape(response));
		$('#'+id).fadeIn();
	}	
	
 	//
	function addEvent(obj,evt,fn) 
	{
		if (obj.addEventListener)
			obj.addEventListener(evt,fn,false);
		else if (obj.attachEvent)
			obj.attachEvent('on'+evt,fn);
	}
  
	//
 	function showHide(elementid,targetid)
	{
 	    el = document.getElementById(elementid);
 		
		if (!el) { return ''; }
	   
 		addEventSimple(el,'mouseover',function() { document.getElementById(targetid).style.display = 'block'; } );
 		addEventSimple(el,'mouseout',function(ev) {
		  var related = ev.toElement ? ev.toElement : ev.relatedTarget;
		  if (!Pochodne(this, related))
		  {
			// document.getElementById(targetid).style.display = 'none';
			 this.getElementsByTagName('div')[0].style.display = 'none';           
		  }
		})
 	} 
 
	//
	function toggleme(myblock, whichway) 
	{
	  var expireDate = new Date()
	  var expstring=expireDate.setDate(expireDate.getDate()+30)
	
	  if (whichway == 'bigger') {
	
		 // show big
		document.getElementById('toggleme-' + myblock + '-big' ).style.display = '';
		// hide small
		document.getElementById('toggleme-' + myblock + '-small' ).style.display = 'none';
		//set cookie for myblock to big
		document.cookie = myblock + "=big; expires="+expireDate.toGMTString()
	
	  } else {
	
 		 // show small
		document.getElementById('toggleme-' + myblock + '-small' ).style.display = '';
		// hide big
		document.getElementById('toggleme-' + myblock + '-big' ).style.display = 'none';
		//set cookie for myblock to small
		document.cookie = myblock + "=small; expires="+expireDate.toGMTString()
		}
	
	}
	
	//
 	function Pochodne(parent, node) 
	{
		if (node == null || node == 'undefined')
		{
		  return false;
		}
		if (node == parent) 
		{
		 //window.status = 'Pochodne::' + parent.id + '|' + node.id + ' == 1';
		  return true;
		}
		return Pochodne(parent, node.parentNode);
	}

	//	
	function addEvent(obj, type, fn) 
	{
	    if (obj.addEventListener) 
	    {
			obj.addEventListener(type, fn, false);
	    }
	    else if (obj.attachEvent)
	    {
		    obj['e'+type+fn] = fn;
		    obj[type+fn] = function()
		    {
			obj['e'+type+fn](window.event);
		    }
			obj.attachEvent('on'+type, obj[type+fn]);
	    }
	}
		
	//
	function makePullDown(elId)
	{
	    el = document.getElementById(elId);
	   
	    if (!el) { return ''; }
	   
	    span = el.getElementsByTagName('strong')[0];
	    div = el.getElementsByTagName('div')[0];
	   
	    addEvent(span, 'mouseover', function() 
		{
			extend = this.parentNode.getElementsByTagName('div')[0];
			extend.style.display = 'block';      
	    });
		
	    addEvent(el, 'mouseout', function(ev)
	    {
		    var related = ev.toElement ? ev.toElement : ev.relatedTarget;
		    if (!Pochodne(this, related))
		    {
			this.getElementsByTagName('div')[0].style.display = 'none';        
			}
	    })
	}
 
 	//
	function readCookie(name) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	//
	function createCookie(name,value,days) 
	{
		if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	//
	function checkCookie(name) 
	{
		/*
		var x = readCookie(name)
		if (x == 'false') {
			
			document.getElementById('artykuly-glowne-2').style.display = 'none';
			document.getElementById('zamkniete-glowne').style.display = 'block';
			document.getElementById('plus').style.display = '';
			document.getElementById('minus').style.display = 'none';
  			
		} else if (x == 'true') {
			
			document.getElementById('artykuly-glowne-2').style.display = '';
			document.getElementById('zamkniete-glowne').style.display = 'none';
			document.getElementById('plus').style.display = 'none';
			document.getElementById('minus').style.display = '';
			
 			ZaladujZajawki();
 		}
		*/
	}
	 
	//
 	function PokUkr(elementid)
	{
	    if (document.getElementById(elementid).style.display == 'none')
	    {
	   		document.getElementById(elementid).style.display = '';
			document.getElementById('zamkniete-glowne').style.display = 'none';
			document.getElementById('plus').style.display = 'none';
			document.getElementById('minus').style.display = '';
			
			createCookie('open','true',0);
			ZaladujZajawki();
			
	    } else {
		
	   		document.getElementById(elementid).style.display = 'none';
			document.getElementById('zamkniete-glowne').style.display = 'block';
			document.getElementById('plus').style.display = '';
			document.getElementById('minus').style.display = 'none';
			createCookie('open','false',0);
  	    }
	} 
 	
	//
 	function pImp(id){ document.getElementById(id).style.display = 'block'; }
	function uImp(id){ document.getElementById(id).style.display = 'none'; }
	
	var dn = new Array('div','p','td','h6','h5','h4');
 	var szs = new Array( '13px','15px','18px' );
	var startsz = '';

	function ts( tgs,trgt,inc ) 
	{ 
		if (!document.getElementById) return;
		var d = document,cEl = null,sz,i,j,cTags;
		
		sz = inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 2 ) sz = 2;
		startsz = sz;
			
		if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

		cEl.style.fontSize = szs[ sz ];
		if (inc==2) cEl.style.lineHeight = '24px'; 
		else if (inc==1) cEl.style.lineHeight = '20px'; 
		else cEl.style.lineHeight = '18px';

		for ( i = 0 ; i < tgs.length ; i++ ) 
		{
			cTags = cEl.getElementsByTagName( tgs[ i ] );
			for ( j = 0 ; j < cTags.length ; j++ )
			{ 
				cTags[ j ].style.fontSize = szs[ sz ]; 
				if (inc==2) cTags[ j ].style.lineHeight = '24px'; 
				else if (inc==1) cTags[ j ].style.lineHeight = '20px'; 
				else cTags[ j ].style.lineHeight = '18px';	
			}
		}
	}	 
	
	/*
    if (startsz==0||startsz==1||startsz==2) { ts(dn,'art',startsz); }
    
	var position = getCoo(document.cookie);
    if (position != -1) 
	{
		ts(dn,'art', position);
    }
	*/
	
	//
	function setCoo(size)
	{
		document.cookie='rozmiar_czcionki='+size+'; path=/';
	}
	
	//
	function getCoo(cookie)
	{
		var position = cookie.indexOf("rozmiar_czcionki");
		if (position != -1) {
			return cookie.substr(position+17, 1);
		}
		return -1;
	}
 
	//
 	function PokUkr(elementid)
	{
	    if (document.getElementById(elementid).style.display == 'none')
	    {
	   		document.getElementById(elementid).style.display = '';
			document.getElementById('zamkniete-glowne').style.display = 'none';
			document.getElementById('plus').style.display = 'none';
			document.getElementById('minus').style.display = '';
			
			createCookie('open','true',0);
			ZaladujZajawki();
			
	    } else {
		
	   		document.getElementById(elementid).style.display = 'none';
			document.getElementById('zamkniete-glowne').style.display = 'block';
			document.getElementById('plus').style.display = '';
			document.getElementById('minus').style.display = 'none';
			createCookie('open','false',0);
  	    }
	} 
	
	//
 	function PokPozostale(elementid)
	{
	    if (document.getElementById(elementid).style.display == 'none')
	    {
	   		document.getElementById(elementid).style.display = '';
 			
	    } else {
		
	   		document.getElementById(elementid).style.display = 'none';
   	    }
	} 

	//
 	function druk(id,kat,imag)
	{
		plik="php/druk.php?id="+id+"&kat="+kat+"&imag=1";
		dane="toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,status=no,location=no,directories=no,top=100,bottom=30,left=100,fullscreen=0,width=760";
		window.open(plik, "info", dane);
	}
	
	//
	function wyslij(id,kat)
	{
		plik="php/wyslij.php?id="+id+"&kat="+kat;
		dane="toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,left=400,top=140,height=200,width=272";
		window.open(plik, "info", dane);
 	}
	
	//
	function zgloskomentarz(id,kat)
	{
		plik="php/zgloskomentarz.php?id="+id;
		dane="toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,left=400,top=140,height=200,width=272";
		window.open(plik, "info", dane);
 	}

	//
	function zglosblad(id,kat)
	{
		plik="php/blad.php?id="+id;
		dane="toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no,left=400,top=140,height=400,width=472";
		window.open(plik, "info", dane);
 	}
 
 	
	//
	function fills(tsVal) 
	{	
		alert( "s"+tsVal);
	}
	
	
	$(document).ready(function() {

		//Default Action
		$(".tresc-zakladki").hide(); //Hide all content
		$("ul.zakladki li:first").addClass("active").show(); //Activate first tab
		$(".tresc-zakladki:first").show(); //Show first tab content
		
		//On Click Event
		$("ul.zakladki li").click(function() {
			$("ul.zakladki li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".tresc-zakladki").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active content
			return false;
		});
	
	})

	$(document).ready(function() {

		//Default Action
		$(".art-tresc-zakladki").hide(); //Hide all content
		$("ul.art-zakladki li:first").addClass("active").show(); //Activate first tab
		$(".art-tresc-zakladki:first").show(); //Show first tab content
		
		//On Click Event
		$("ul.art-zakladki li").click(function() {
			$("ul.art-zakladki li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$(".art-tresc-zakladki").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active content
			return false;
		});
	
	})
	
	/*
	$(document).ready(function () 
	{
 		$('[id^=type_]').click(function () {
			type = this.id.replace('type_', '');
			$('[id^=type_]').removeClass('aktualna');
			$('#type_' + type).addClass('aktualna');
		});
		
		$('#type_wszystko').click();

		$('input').keyup(function () {
			query = $(this).val();
			url = '/' + type + '/' + query + '/';
			window.location.hash = '' + type + '/' + query + '/';
			document.title = $(this).val() + ' - My Search Script';
 			/*
			$('#results').show();
			if (query == '') {
				window.location.hash = '';
				document.title = 'My Search Script';
				$('#results').hide();
			}
			$.ajax({
				type: 'GET',
				url: url,
				dataType: 'html',
				success: function (results) {
					$('#results').html(results);
				}
			});
 			
		});
		
		window.location.replace = window.location.hash;

	});	
	*/
	
	//
	$(document).ready(function()
	{
		/*
		$("#query").keyup(function()
		{
			var query=$(this).val();
			//var type='web' //substitute text, default whatever
			// var yt_url=type+'.html';
			
			// alert(yt_url);
			// window.location.hash=''+type+'/'+query+'/';
			
			$.ajax(
			{
				type:"GET",
				url:yt_url,
				data: type+"="+query,
				error: function(a,b,c,d)
				{
					$("#results").html("A:"+a+"B: "+b+" C "+c);
				},
				dataType:"html",
				success:function(results)
				{
				   console.log("Result"+results);
				}
			});
				
		});
		*/
		
		//
		$(".zakladki a").click(function() 
		{
 			type = this.id.replace('typ_', '');
			$('[id^=typ_]').removeClass('aktualna');
			$('#typ_' + type).addClass('aktualna');
			
			//
			// alert('ok');
			
 			//alert( 'ECHO-'+$('#typv_' + type)+' nic' );
				
			if($('#typv_' + type).val() == 0)
			{	
				$('[id^=typv_]').val('0');
				$('#typv_' + type).val('1');
				
			} else {
				
				$('#typv_' + type).val('0');
			}				
			
			// $('[id^=typv_]').val('0');
			// $('#typv_' + typev).val('1');
 			
			//
			
			/*
			
 			var query = $("#query").val();
			var type = $(this).attr('id');
			var yt_url = type+'.html';

			//window.location=''+type+'/'+query+'/';
			//window.location='wyszukiwarka.html,'+query+'';
			
 			$.ajax(
			{
 				type:"GET",
				url:yt_url,
				data: type+"="+query,
				error: function(a,b,c,d)
				{
					console.log("A:"+a+"B: "+b+" C "+c);
				},
				dataType:"html",
				success:function(results)
				{
				   console.log("Result"+results);
				}
			});
			
			*/
			
		})
		
	});
	
	
	//
	function suggest(inputString,inputSort)
	{
        if(inputString.length == 0) 
		{
            $('#podpowiedzi').fadeOut('fast');

        } else {

			$('#query').addClass('load');

            $.post("lib/php/szukaj.php", {queryString: ""+inputString+"", sort: ""+inputSort+""}, function(data)
			{
                if(data.length > 0) 
				{
                    $('#podpowiedzi').fadeIn('fast');
                    
					
					$('#listapodpowiedzi').html(data);
					
                    $('#query').removeClass('load');
                }
            });
        }
    }
	
	
	//
	function Submit()
	{
 		$("form:#wform").submit(); 
 	}

	
	//
    function fill(thisValue) 
	{
        $('#query').val(thisValue);
 		$("form:#wform").submit(); 
        // setTimeout("$('#podpowiedzi').fadeOut();", 'fast');
		
		// window.location.href = "wyszukiwarka.html,"+thisValue+"";		
	} 
	
	
	//
	/*
	$(document).ready(function() 
	{
		var imgWrapper = $('.slideshow .img-g');
		
		// only show the first image, hide the rest
		
		imgWrapper.hide().filter(':first').show();
		
		$('ul.recentlist li a').click(function () 
		{
			// check if this item doesn't have class "current"
			// if it has class "current" it must not execute the script again
			if (this.className.indexOf('current') == -1)
			{
				imgWrapper.hide();
				imgWrapper.filter(this.hash).fadeIn(500);
				$('ul.recentlist li a').removeClass('current');
				$(this).addClass('current');
			}
			
			return false;
		});
	});
	*/
	
	//
	
	/*
	$(function () {
		$('#js-news').ticker();
    });
	*/
	
	// FIN.......

