//// -------------------------------------------------------------------------------
		$(document).ready(function(){
			
// linki w nowym oknie			
			$('a[rel="external"]').click( function() {
        		window.open( $(this).attr('href') );
        		return false;});
		
// --------------------------- no spam mail

			$('a[rel="mail"]').each( function() {
			   this.href = this.href.replace('(at)',"@");
       		   return true;});
			
			$('a.mail').each( function() {
			   this.href = this.href.replace('(at)',"@");
       		   return true;});			
			
//----------------------------------------------------------------------------------------------------------------------------------

// link blur		
			$("a").focus(function() {
  			$(this).blur();
			});
//----------------------------------------------------------------------------------------------------------------------------------

// logotypy scroll

		$('#logotypy_scroll').slide({autoplay: true, duration: 2000, showSlideIndex: false});

// ----------------------------------------------------------------

// go to top

		$.fn.scrollToTop=function(){
//			$(this).hide().removeAttr("href");
			var scrollDiv=$(this);
					$(this).click(function(){
							$("html, body").animate({scrollTop:0},"slow")
					})
		}

		$("#right_bottom a").scrollToTop();

// sitemap - przycisk

/*//accordion
			$('ul.accordion').accordion();
//----------------------------------------------------------------------------------------------------------------------------------*/

//fancybox

			$(".podstrony_galeria a").fancybox();
			$(".podstrona_glowne_foto a").fancybox();			
			
			$(".news_galeria a").fancybox();
			$("a.podstrony_foto").fancybox();			
		
			$("a.mapa_witryny").fancybox({'padding':0,'frameWidth':800,'frameHeight':500});		
		
		
//			$("a.list_referencyjny").fancybox();					
			
			

/*

			$("a.zoom1").fancybox({
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#FFF'
			});

			$("a.zoom2").fancybox({
				'zoomSpeedIn'		:	500,
				'zoomSpeedOut'		:	500,
				'centerOnScroll' : true
			});
	*/		
//----------------------------------------------------------------------------------------------------------------------------------
	

// formularz kontaktowy

			$("#ajax-contact-form").submit(function(){

			var str = $(this).serialize();

  				 $.ajax({
  				 type: "POST",
 				 url: "/inc/email/contact.php",
 				 data: str,
  				success: function(msg){
    
			$("#note").ajaxComplete(function(event, request, settings){

			if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
			{
			result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';

			$("#fields").hide();
			}
			else
			{
			result = msg;
			}

			$(this).html(result);

			});

			}

			 });

			return false;

			});
//----------------------------------------------------------------------------------------------------------------------------------

// hover dla elemnetow logoscrolla
			$("div.items div.scroll_item").hover(function() { //On hover...

				var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
			$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
			$(this).find("span").stop().fadeTo('normal', 0 , function() {
				$(this).hide() //Hide the image after fade
				});
			} , function() { //on hover out...
		//Fade the image to full opacity 
				$(this).find("span").stop().fadeTo('normal', 1).show();
			});
//----------------------------------------------------------------------------------------------------------------------------------


// dodawanie ikon dla zalącznikow

	// pdf 
	$("a[href$='.pdf']").addClass("pdf");
	 
	// txt (doc, rtf, txt)
	$("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").addClass("txt");

	// zip (zip, rar)
	$("a[href$='.zip'], a[href$='.rar']").addClass("zip"); 
	
	// Add email icons to email links
	//$("a[href^='mailto:']").addClass("email");

	// external link 
	//$('a').filter(function() {
		///Compare the anchor tag's host name with location's host name
	  //  return this.hostname && this.hostname !== location.hostname;
	 // }).addClass("external");

//----------------------------------------------------------------------------------------------------------------------------------
		});
//// ------------------------------------------------------------------------------	







// -------------------------------------------------------------------------------	
// -------------------------------------------------------------------------------			
/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 

 
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
// -------------------------------------------------------------------------------	
// -------------------------------------------------------------------------------	


//// ------------------------------------------------------------------------------	PLUG INS END


// starting the script on page load
/*
$(document).ready(function(){						 

	// Set the transparent pixel
	jQuery.ifixpng('/blank.gif');
	jQuery('#pasek_banery_start').ifixpng();
});		
		
*/

/* CUFON - wywołania */

	Cufon('h1.tytul');
	Cufon('h3.tytul');
	Cufon('#box_1 h3');	
	Cufon('#box_2 h3');	
	Cufon('#box_3 h3');		
	Cufon('div.home_right_box h2');			
	Cufon('div.home_left_box h2');
	Cufon('h1.cufon');	
	Cufon('div.nasi_klienci_txt');
	Cufon('#content_sitemap h1');	

 // tooltip galeria podstrony
//		$('a.tooltip').tooltip();

/* banery start */

$(document).ready(
                function(){
						$('ul#banery_start').css('display', 'block');					
                    	$('ul#banery_start').innerfade({
                        speed: 1000,
                        timeout: 6000,
                        type: 'sequence',
                        containerheight: 	'179px',
                        slide_timer_on: 	'yes',
                        slide_ui_parent: 	'banery_start',
                        slide_ui_text:		'banery_start_opis',
                       	slide_nav_id:		'banery_start_nav'
                    	});
					$.setOptionsButtonEvent();						
			});

/* animacja - pokaz/ukryj */

		$("#animacja_content").hide();
$(document).ready(function(){
	
	if( $.cookie('oc')=='close') {
//		$("#banery_start").css('display', 'none');			
//		$("#banery_start").hide();
		$("#animacja_content").hide();
		$("#animacja_header a").html('pokaż');
	} else {
//		$("#banery_start").css('display', 'block');					
//		$("#banery_start *").show();
		$("#animacja_content").show();
		$("#animacja_header a").html('ukryj');		
	}

	$("#animacja_header").click (function() { 

        var date = new Date();
		date.setTime(date.getTime() + (3 * 24 * 60 * 60 * 1000));

		if( $.cookie('oc')=='close' ) {
			$("#banery_start_nav").show();			
			$(this).parent().find("#animacja_content").slideDown('fast').fadeIn(5).show();
			$("#animacja_header a").html('ukryj');
		    $.cookie('oc', 'open', { path: '/', expires: date });
		} else {
			$("#banery_start_nav").hide();			
			$(this).parent().find("#animacja_content").slideUp('fast').fadeOut(5).hide();
			$("#animacja_header a").html('pokaż');
		    $.cookie('oc', 'close', { path: '/', expires: date });
		}
		return false;

	});

});

/* facebook - left slider */

    $(function(){
 
    $("#wysuwane").css("left","-210px");
 
$("#wysuwane").hover(
  function () {
    $("#wysuwane").animate({left: "0px"}, 800);
        $(this).addClass("zamknij");
  },
  function () {
    $("#wysuwane").animate({left: "-210px"}, 800 );
        $(this).removeClass("zamknij");
  }
);
});
