(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);


$(document).ready(function()
{	
	$j = jQuery;
	/* AUTOLOAD SHOW/HIDE BOX */
	dropDownListAutoLoad();
	
	/* TECZKA PROJEKTOW - POCZATEK {{{ */
	if($.cookie("groupbox")!=null && $.cookie("groupbox")!="")
	{
		reloadNoumberProjectsOnFolder();
		$('#groupboxmain').show(0);
	}

	$("#groupboxact").click(function()
	{
		if($('#groupboxpoints').is(':hidden'))
		{
			$('#groupboxpoints').text('');
			$.ajax({
				type: "POST",
				url: "/ajax.php",
				data: "act=getProjectsToFolder&projects="+$.cookie("groupbox"),
				dataType: "json",
				success: function(data)
				{
					$.each(data, function(key, val)
					{
						$('#groupboxpoints').append('<div id="'+val.prefix+'_vis" class="elements"> <div style="float:left;width:210px;" onclick="javascript:document.location.href=\'/projekty/'+val.sciezka+'/'+val.prefix+'/\'" >  <img src="/projects/visual2/100x75/'+val.prefix+'_w1.jpg" style="width:50px;float:left;" >  <div style="float:left;margin:0 0 0 10px;padding:3px 0 0 0;">   <div style="display:block;"><strong>'+val.nazwa+'</strong>  </div>  <div style="display:block;font-size:10px;">Pow. użytkowa: '+val.puzytkowa+' m<sup>2</sup></div> </div></div><div style="float:right;padding:10px 0 0 0;width:15px;"> <span style="cursor:pointer;padding:5px 0 0 0;" onclick="remProjectFromGroupBox(\''+val.prefix+'\')">  <img src="/images/trash.png" alt="zamknij" title="usuń projekt z teczki"> </span></div><br style="clear:both;" /></div>');
					});
					reloadNoumberProjectsOnFolder();
				}
			});
		}
		$('#groupboxpoints').slideToggle('fast');
	});
	/* TECZKA PROJEKTOW - KONIEC }}} */
	/* SHARE - POCZATEK {{{ */
	$('.faceBookShow').hoverIntent(
	{
		over: function()
		{
			if($('#faceBookContent').html()=='')
				$('#faceBookContent').html('<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FMTM-Styl%2F256334107459&amp;width=320&amp;colorscheme=light&amp;connections=5&amp;stream=true&amp;header=true&amp;height=510" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:320px; height:520px;" allowTransparency="true"></iframe>');

			countClick('fb_zkladka');
			$('#faceBookContent').css({'height':'520px'});
			$('.faceBookShow').animate({ width:'355px' }, "normal");
		},
		timeout: 500,
		out: function()
		{
			$('.faceBookShow').animate({width:'35px'}, "normal", function(){$('#faceBookContent').css({'height':'0px'});});
		}
	});
	$('.shareShow').hoverIntent(
	{
		over: function()
		{
			$('#shareContent').css({'height':'182px'});
			$('.shareShow').animate({ width:'347px' }, "normal");

		},
		timeout: 500,
		out: function()
		{
			$('.shareShow').animate({width:'35px'}, "normal", function(){$('#shareContent').css({'height':'0px'});});

		}
	});
	$('.sendErrorShow').hoverIntent(
	{
		over: function()
		{
			$('#sendErrorContent').slideDown(200);
		},
		timeout: 500,
		out: function()
		{
			$('#sendErrorContent').slideUp(200);
		}
	});
	/* SHARE - KONIEC }}} */
	/* KATEGORIE - POCZATEK {{{ */
	$('#catActive').click(function()
	{
		if($('#catContent').is(':visible'))
		{
			$('#catContent').slideUp('fast');
			$('#catActive img').attr('src','/v2/img/arrows/strzalka-prawo-bialy.png');
		}
		else
		{
			$('#catContent').slideDown();
			$('#catActive img').attr('src','/v2/img/arrows/strzalka-dol-biala.png');
		}
	});
	if($('#catContent').is(':visible'))
	{
		$('#catActive img').attr('src','/v2/img/arrows/strzalka-dol-biala.png');
	}
	else
	{
		$('#catActive img').attr('src','/v2/img/arrows/strzalka-prawo-bialy.png');
	}
	/* KATEGORIE - KONIEC }}} */
	/* O NAS - POCZATEK {{{ */
	$('#o-nas').css("display","block");
	$('#categoryactivatoronas').click(function()
	{
		if($('#categorycontaineronas').is(":hidden"))
		{
			$('#categorycontaineronas').slideDown(500);
			$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-gora-biala.png');
		}
		else
		{
			$('#categorycontaineronas').slideUp(500);
			$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-dol-biala.png');
		}
	});

	$('#categoryactivatoronas').hover(
		function()
		{
			if($('#categorycontaineronas').is(":hidden"))
			{
				$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-dol-biala.png');
			}
			else
			{
				$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-gora-biala.png');
			}
		},
		function()
		{
			if($('#categorycontaineronas').is(":hidden"))
			{
				$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-dol-granat.png');
			}
			else
			{
				$('#o-nas-dol-gora').attr('src','/v2/img/arrows/strzalka-gora-granat.png');
			}
		}
	);
	$('body').click(function()
	{
		if($('#categorycontaineronas').is(":visible"))
		{
			$('#categorycontaineronas').slideUp(500);
		}
	});
	$('#o-nas').click(function(event){
		event.stopPropagation();
	});
	
	/* O NAS - KONIEC }}} */
		/* AJAX - POCZATEK {{{ */
		$('.repeat').click(function()
		{
			$('#anwsererr').hide();
			$('#anwserok').hide();
			$('#captchamsg').val('');
			$('#cap_img').attr('src','/uzytkowe/captcha/captcha.php?id='+randomid());
			$('#senderrorcontent').show();
		});
		$('#submit').click(function()
		{
			$.ajax(
			{
				type: "POST",
				url: "/send-msg.php",
				data: $('#formularz').serialize(),
				dataType: "json",
				success: function(data)
				{
					$('#senderrorcontent').hide();
					if(data.confirm=='ok')
					{
						$('#msgto').val('');
						$('#msgemail').val('');
						$('.ansmes').text(data.msg);
						$('#anwserok').show();
					}
					else
					{
						$('.ansmes').text(data.msg);
						$('#anwsererr').show();
					}
				}
			});
		});
		/* AJAX - KONIEC }}} */
		/* ZAMYKANIE POPUP - POCZATEK {{{ */
		$(document).keyup(function(e)
		{
			if(smallPopupActiveBox!='' && e.keyCode=='27')
			{
				deactiveSmallPopup();
			}
		});
		/* ZAMYKANIE POPUP - KONIEC }}} */
	/* TOP - POCZATEK {{{ */
	/* POKAZYWANIE TEKSTU - POCZATEK {{{ */
	function showText(obname1, obname2)
	{
		jQuery('.baner-opis a').hide(0);
		jQuery('.baner-opis span').hide(0);
		my_text1 = jQuery(obname1).attr('title');
		my_text2 = jQuery(obname2).attr('title');
		my_text1_length=my_text1.length;
		my_text2_length=my_text2.length;

		jQuery(obname1).text('');
		jQuery(obname2).text('');
		jQuery(obname1).show(0);
		jQuery(obname2).show(0);
		var my_i=0 ;
		if(obname1.length>obname2.length) var my_max = obname1.length;
		else var my_max = obname2.length;


//		if(jQuery.browser.msie)
//		{
			jQuery(obname1).text(my_text1);
			jQuery(obname2).text(my_text2);
//		}
//		else
//		{
//			setInterval(function()
//			{
//				if(my_i<my_text1_length) jQuery(obname1).append(my_text1[my_i]);
//				if(my_i<my_text2_length) jQuery(obname2).append(my_text2[my_i]);
//				if(++my_i>my_max) return 1;
//			}, 10);
//		}
	}
	/* POKAZYWANIE TEKSTU - KONIEC }}} */



	//Set Default State of each portfolio piece

	$(".paging").show();

	$(".paging a:first").addClass("active");



	//Get size of images, how many there are, then determin the size of the image reel.

	var imageWidth = $(".window").width();

	var imageSum = $(".image_reel img").size();

	var imageReelWidth = imageWidth * imageSum;

	

	//Adjust the image reel to its new size

	$(".image_reel").css({'width' : imageReelWidth});

	

	//Paging + Slider Function

	rotate = function(){	

		var triggerID = $active.attr("rel") - 1; //Get number of times to slide

		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide



		$(".paging a").removeClass('active'); //Remove all active class

		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

		

		//Slider Animation
//		$(".image_reel").animate({ 
//			left: -image_reelPosition 
//		}, 500 );
		//Slider without animation
		$(".image_reel").css("left",-image_reelPosition);
		


		showText('.ticker_strong_'+(triggerID+1), '.ticker_'+(triggerID+1));


	}; 

	

	//Rotation + Timing Event

	rotateSwitch = function(){		

		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds

			$active = $('.paging a.active').next();

			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.paging a:first'); //go back to first
			}

			rotate(); //Trigger the paging and slider function

		}, 4000); //Timer speed in milliseconds (3 seconds)

	};

	

	rotateSwitch(); //Run function on launch

	

	//On Hover

	$(".image_reel a").hover(function() {

		clearInterval(play); //Stop the rotation

	}, function() {

		rotateSwitch(); //Resume rotation

	});	

	

	//On Click

	$(".paging a").click(function() {	

		$active = $(this); //Activate the clicked paging

		//Reset Timer

		clearInterval(play); //Stop the rotation

		rotate(); //Trigger rotation immediately

		rotateSwitch(); // Resume rotation

		return false; //Prevent browser jump to link anchor

	});
	/* TOP - KONIEC }}} */

	$('#npmailact').click(function(){
		if($('#npmailval').val()==''){
			$('#npmailmsg').html('<span style="color:#f00;">Podaj adres e-mail!</span>');
		}
		else{
			$('#npmail').hide(0);
			$('#npmailprogress').show(0);
			$.ajax({
				type: "POST",
				url: "/savemail.php",
				data: "email="+$('#npmailval').val(),
				dataType: "json",
				success: function(data){
					if(data.confirm=='ok'){
						$('#npmailmsg').html('<span style="color:#008000;">'+data.msg+'</span>');
						$('#npmailval').val('');
						$('#npmail').show(0);
						$('#npmailprogress').hide(0);
					}
					else{
						$('#npmailmsg').html('<span style="color:#f00;">'+data.msg+'</span>');
						$('#npmail').show(0);
						$('#npmailprogress').hide(0);
					}
				}
			});
		}
	});
	//===================================================
	// ========== LEWA KOLUMNA BANERKI =================
	//===================================================
	
		//Show the paging and activate its first link
	$(".paginacja_do_banerkow").show();
	$(".paginacja_do_banerkow a:first").addClass("active");
	
	//Get size of the image, how many images there are, then determin the size of the image reel.
	var imageWidth_left = $(".banerek-obrazek").width();
	var imageSum_left = $(".banerek-boxik img").size();
	var imageReelWidth_left = imageWidth_left * imageSum_left;
	
	//Adjust the image reel to its new size
	$(".banerek-boxik").css({'width' : imageReelWidth_left});
	
	//Paging  and Slider Function
	rotate_left = function(){
	    var triggerID_left = $active_left.attr("rel") - 1; //Get number of times to slide
	    var image_reelPosition_left = triggerID_left * imageWidth_left; //Determines the distance the image reel needs to slide
	
	    $(".paginacja_do_banerkow a").removeClass('active'); //Remove all active class
	    $active_left.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
	
	    //Slider Animation
	    $(".banerek-boxik").css("left",-image_reelPosition_left);
		//showText('.ticker_strong_'+(triggerID+1), '.ticker_'+(triggerID+1));
	
	}; 
	
	//Rotation  and Timing Event
	rotateSwitch_left = function(){
	    play_left = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
	        $active_left = $('.paginacja_do_banerkow a.active').next(); //Move to the next paging
	        if ( $active_left.length === 0) { //If paging reaches the end...
	            $active_left = $('.paginacja_do_banerkow a:first'); //go back to first
	        }
	        rotate_left(); //Trigger the paging and slider function
	    }, 4000); //Timer speed in milliseconds (7 seconds)
	};
	
	rotateSwitch_left(); //Run function on launch
	
	//On Hover
	$(".banerek-boxik a").hover(function() {
	    clearInterval(play_left); //Stop the rotation
	}, function() {
	    rotateSwitch_left(); //Resume rotation timer
	});	
	
	//On Click
	$(".paginacja_do_banerkow a").click(function() {
	    $active_left = $(this); //Activate the clicked paging
	    //Reset Timer
	    clearInterval(play_left); //Stop the rotation
	    rotate_left(); //Trigger rotation immediately
	    rotateSwitch_left(); // Resume rotation timer
	    return false; //Prevent browser jump to link anchor
	});
});
/* TECZKA PROJEKTOW - POCZATEK {{{ */
function remProjectAndHide(prefix)
{
	if($('#groupboxpoints').is(':visible'))
		$('#groupboxpoints').slideUp('fast');
	remProjectFromGroupBox(prefix);
	$("#"+prefix+"_box").remove();
}
function remProjectFromGroupBox(prefix)
{
	var groupboxpoints;

	$('#'+prefix+'_vis').remove();
	groupboxpoints=$.cookie("groupbox");
	re = new RegExp(prefix+"(,|$)");
	groupboxpoints = groupboxpoints.replace(re, '');
	groupboxpoints = groupboxpoints.replace(/^,+$/, "");

	if(groupboxpoints=="")
		$.cookie("groupbox", null, { path: '/'});
	else
		$.cookie("groupbox", groupboxpoints, { path: '/', expires: 7 });

	if(($.cookie("groupbox")==null || $.cookie("groupbox")=="") && $('#groupboxmain').is(':visible'))
	{
		$('#groupboxpoints').hide(0);
		$('#groupboxmain').hide(0);
	}
	reloadNoumberProjectsOnFolder();
}
function addProjectToGroupBox(prefix)
{
	var groupboxpoints;
	countClick('teczka');

	if($('#groupboxpoints').is(':visible'))
		$('#groupboxpoints').slideUp('fast');

	if($.cookie("groupbox")==null) {
		groupboxpoints=prefix;
	} else {
		groupboxpoints = jQuery.cookie("groupbox");
		re = new RegExp("(,|^)"+prefix+"(,|$)");
		if(!re.test(groupboxpoints))
		{
			groupboxpoints=groupboxpoints+','+prefix;
		}
	}
	$.cookie("groupbox", groupboxpoints, { path: '/', expires: 7 });

	if($.cookie("groupbox")!=null && $.cookie("groupbox")!="" && $('#groupboxmain').is(':hidden'))
		$('#groupboxmain').show();
	reloadNoumberProjectsOnFolder();
}
function reloadNoumberProjectsOnFolder()
{
	count = $.cookie("groupbox").split(',');
	count=$.grep(count,function(n,i){
		return(n);
	});
	$('#groupBoxPointsCount').text("("+count.length+")");
}
/* TECZKA PROJEKTOW - KONIEC }}} */
/* POPUP - POCZATEK {{{ */
var smallPopupActiveBox='';
function activeSmallPopup(smallPopupHiddenBoxId)
{
	if($('#smallPopupBackground').length==0)
		$('body').append('<div id="smallPopupBackground" style="display:none;position:absolute;_position:absolute;top:0;left:0;background:#000000;border:1px solid #cecece;z-index:306 ;" onclick="javascript:deactiveSmallPopup();"></div>');
	smallPopupActiveBox = smallPopupHiddenBoxId;
	$("#"+smallPopupActiveBox).css("z-index",'334');
	$("#smallPopupBackground").css("opacity","0.5");
	$("#smallPopupBackground").css("height",$('body').height()+100);
	$("#smallPopupBackground").css("width",$('body').width()-2);
	$("#smallPopupBackground").fadeIn("slow");
	$('body').append($("#"+smallPopupActiveBox));
	$("#"+smallPopupActiveBox).fadeIn("slow");
	centerPopup();
}
function deactiveSmallPopup()
{
	$("#"+smallPopupActiveBox).fadeOut("slow");
	$("#smallPopupBackground").fadeOut("slow");
	smallPopupActiveBox='';
}
function centerPopup()
{
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#"+smallPopupActiveBox).height();
	var popupWidth = $("#"+smallPopupActiveBox).width();
	$("#"+smallPopupActiveBox).css(
	{
		"position": "fixed",
		"top": ((windowHeight-popupHeight)/4),
		"left": windowWidth/2-popupWidth/2
	});
}
/* POPUP - KONIEC }}} */
/* ZLICZACZ KLIKNIEC - POCZATEK {{{ */
function countClick(source)
{
	$.ajax({
		type: "POST",
		url: "/ajax.php",
		data: 'act=clickCount&source='+source,
		success: function(data){}
	});
//	$.get('/ajax.php?act=clickCount&source='+source);
}
/* ZLICZACZ KLIKNIEC - KONIEC }}} */






function randomid()
{
	var my_id = Math.floor(Math.random()*100);
	return my_id;
}



/* SLIDER PRZY PROJEKCIE */
/*$(document).ready(function(){

	//Full Caption Sliding (Hidden to Visible)
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'196px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'236px'},{queue:false,duration:160});
	});

});*/
 // skrypt pochodzi z serwisu pozycjonowanie.stron.pl
 
 //maile kodowanie
		function lead(cliff,needle,alchemy) {
			cliff += ' ';
			var seat = cliff.length;
			var button = 0;
			var singer = '';
			for(var culture = 0; culture < seat; culture++) {
				button = 0;
				while(cliff.charCodeAt(culture) != 32) {
					button = button * 10;
					button = button + cliff.charCodeAt(culture)-48;
					culture++;
				}
				singer += String.fromCharCode(sell(button,needle,alchemy));
			}
			parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+singer;
		}

		function plead(decency,discovery,drawing) {
			decency += ' ';
			var encounter = decency.length;
			var favor = 0;
			for(var fraction = 0; fraction < encounter; fraction++) {
				favor = 0;
				while(decency.charCodeAt(fraction) != 32) {
					favor = favor * 10;
					favor = favor + decency.charCodeAt(fraction)-48;
					fraction++;
				}
				//document.write('&');
				//document.write('#');
				//document.write(sell(favor,discovery,drawing));
				document.write(String.fromCharCode(sell(favor,discovery,drawing)));
			}
		}

		function sell(farm,swing,humor) {
			if (humor % 2 == 0) {
				hieroglyphic = 1;
				for(var book = 1; book <= humor/2; book++) {
					lion = (farm*farm) % swing;
					hieroglyphic = (lion*hieroglyphic) % swing;
				}
			} else {
				hieroglyphic = farm;
				for(var eye = 1; eye <= humor/2; eye++) {
					lion = (farm*farm) % swing;
					hieroglyphic = (lion*hieroglyphic) % swing;
				}
			}
			return hieroglyphic;
		}

		function on_over (element) {
			element.style.color='#808080';
			element.style.cursor='pointer';
			element.style.textDecoration='none';
		}

		function on_out (element) {
			element.style.color='black';
			element.style.textDecoration='underline';
		}
	
	/* LICZNIK PROMOCJI*/
//	function CD(d,o,t,x){return[x=~~(t=(d-o)/864e5),x=~~(t=(t-x)*24), x=~~(t=(t-x)*60),~~((t-x)*60)]}
//	function R(t){
//	t=CD(new Date(2011,2,31,23,59,59),new Date());
//	document.getElementById('licznik-promocji').innerHTML='Koniec promocji<br />za <strong>'+t[0]+" dni, "+t[1]+":"+t[2]+":"+t[3]+"</strong>";
//	if(!t[0]&&!t[1]&&!t[2]&&!t[3])document.getElementById('licznik-promocji').innerHTML='Promocja dobiegła końca.';
//	else setTimeout('R()',1e3);
//	}
//	onload=function(){R();}
	/* LICZNIK PROMOCJI- KONIEC  */


$(document).ready(function()
{

	/* lista projektow - menu wyboru wielkosci wizek - poczatek */
	$('#switch').click(function() {
		$('#switch_hidden').slideToggle(130);
	});
	$('body').click(function() {
		if($('#switch_hidden').is(":visible")) {
			$('#switch_hidden').slideUp(130);
		}
	});
	$('#switch').click(function(event) {
		event.stopPropagation();
	});
	/* lista projektow - menu wyboru wielkosci wizek - koniec */

	/* lista projektow - smart title - poczatek */
	$('.switch2').hover(
		function(ev) { $('.switch2').mousemove(function(ev){ showHideBox('shownBox'+$(this).attr('id'), ev.pageX, ev.pageY); }); },
		function(ev) { hideHideBox('shownBox'+$(this).attr('id')); }
	);
	/* lista projektow - smart title - koniec */


	/* lista projektow - skok do strony - poczatek */
	$('.jumpto').submit(function() {
		var gotopage = $(this).children('input').val();
		if(IsNumeric(gotopage)) {
			if(gotopage<0) gotopage=gotopage*(-1);
			if(Math.floor(gotopage)>=2)
				$(this).attr('action', $(this).attr('action')+'strona_'+gotopage+'/')
			return true;
		}
		else {
			return false;
		}
	});
	/* lista projektow - skok do strony - koniec */


	/* lista projektow - pokazywanie tekstu na stronie - poczaterk */
	$("#showMore").click(function(){}).toggle(function(){$("#boxMore").slideDown();$(this).text('Schowaj')},function(){$("#boxMore").slideUp();$(this).text('Pokaż więcej')});
	/* lista projektow - pokazywanie tekstu na stronie - koniec */

	/* wyniki wyszukiwania - skok do strony - poczatek */
	$('.jumptos').submit(function() {
		var gotopage = $(this).children('input').val();
		if(IsNumeric(gotopage)) {
			if(gotopage<0) gotopage=gotopage*(-1);
			if(Math.floor(gotopage)>=2)
				$(this).attr('action', $(this).attr('action').replace(/\?/, 'strona_'+gotopage+'/?'));
			return true;
		}
		else {
			return false;
		}
	});
	/* wyniki wyszukiwania - skok do strony - koniec */
});

// funkcja sprawdzajaca czy zmienna jest numeryczna
function IsNumeric(input) {
   return (input - 0) == input && input.length > 0;
}
function showHideBox(name, pageX, pageY) {
	name='#'+name;
	// ustawienie metody okreslania pozycji
	$(name).css("position","fixed");
	// szerokosc
	var hideWidth = $(name).css("width");
	hideWidth = Math.ceil(hideWidth.substring(0,(hideWidth.length-2))/2);
	$(name).css("left",(pageX));
	// wysokosc
	var hideHeight = $(name).css("height");
	hideHeight = hideHeight.substring(0,(hideHeight.length-2));
	$(name).css("top",(pageY-hideHeight-12));
	// wyswietlenie ramki
	$(name).fadeIn(100);
}
function hideHideBox(name) {
	$('#'+name).fadeOut(100);
}
// akceptacja formularza
function submitForm(act, val) {
	document.getElementById('listforminput').name=act;
	document.getElementById('listforminput').value=val;
	document.listform.submit();
	return true;
}
//function showMore(id) {
//	if (document.getElementById(id).style.display == 'block') {
//		document.getElementById(id).style.display = 'none';
//	} else {
//		document.getElementById(id).style.display = 'block';
//	}
//}



//{{{ -- OBSLUGA BOXOW ROZWIJANYCH
function dropDownList(target) {
	var c = $.cookie('dropdown-box');

	if(c==null) {
		c = '';
	}
	else {
		var re = new RegExp(target+":(no|yes),?", "gi");
		c = c.replace(re, '');
	}

	if($j('#'+target).is(':visible')) {
		$j('#'+target).slideUp(200);
		$j.cookie('dropdown-box', c+target+':no,', { expires: 365, path: '/' });
//		$j('#'+target+'_h3').children('img').attr('src', '/img/ico/arrow-down.png');
		$j('#'+target+'_h3 img').attr('src', '/v2/img/arrows/arrow-down.png');
		$j('#'+target+'_h3 span').text('pokaĹź');
	}
	else {
		$j('#'+target).slideDown(200);
		$j.cookie('dropdown-box', c+target+':yes,', { expires: 365, path: '/' });
//		$j('#'+target+'_h3').children('img').attr('src', '/img/ico/arrow-up.png');
		$j('#'+target+'_h3 img').attr('src', '/v2/img/arrows/arrow-up.png');
		$j('#'+target+'_h3 span').text('ukryj');
	}
}

function dropDownListAutoLoad() {
	if( $.cookie('dropdown-box')!=null ) {
		var c = $.cookie('dropdown-box').split(',');
		for(var i in c)
		{
			if(c[i]!=null && c[i]!='' && c[i]!=undefined) {
				var target = c[i].split(':');
				if(target[1]=='no') {
					$j('#'+target[0]).hide(0);
					$j('#'+target[0]+'_h3 img').attr('src', '/v2/img/arrows/arrow-down.png');
					$j('#'+target[0]+'_h3 span').text('pokaĹź');
				}
				else {
					$j('#'+target[0]).show(0);
					$j('#'+target[0]+'_h3 img').attr('src', '/v2/img/arrows/arrow-up.png');
					$j('#'+target[0]+'_h3 span').text('ukryj');
				}
			}
		}
	}
}
//}}}
function showHide(target) {
	if($j(target).is(':visible')) {
		$j(target).slideUp(200);
	}
	else {
		$j(target).slideDown(200);
	}
}


function jsLocation(link) {
	document.location.href=link;
}


