// JavaScript Document


		$(document).ready(function(){
		
		// image hover
		
				$(".thumbs img").fadeTo("fast", 1); 
				$(".thumbs img").hover(function(){
				$(this).fadeTo("fast", 0.8); 
				},function(){
				$(this).fadeTo("fast", 1); 
				});
					
		// linki w nowym oknie	
			$('a[rel="external"]').click( function() {
        		window.open( $(this).attr('href') );
        		return false;});
				
				$('a[rel="external"]').filter(function() {
         return this.hostname && this.hostname !== location.hostname;
        }).addClass('externalLink');

		// link blur
			$("a").focus(function() {
  			$(this).blur();
			});
	
		// ochrona adresow mailowych	
			$('#no_01').safe_mail("studio", "terrastudio", "com.pl", "skontaktuj się z terrastudio");
			$('#no_02').safe_mail("iga.dudziak", "terrastudio", "com.pl");
			$('#no_03').safe_mail("wojciech.fran", "terrastudio", "com.pl");

		
		// scroll
		function filterPath(string) {
		  return string
			.replace(/^\//,'')
			.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
			.replace(/\/$/,'');
		  }
		  var locationPath = filterPath(location.pathname);
		  $('a[href*=#]').each(function() {
			var thisPath = filterPath(this.pathname) || locationPath;
			if (  locationPath == thisPath
			&& (location.hostname == this.hostname || !this.hostname)
			&& this.hash.replace(/#/,'') ) {
			  var $target = $(this.hash), target = this.hash;
			  if (target) {
				var targetOffset = $target.offset().top;
				$(this).click(function(event) {
				  event.preventDefault();
				  $('html, body').animate({last: targetOffset}, 400, function() {
					location.hash = target;
				  });
				});
			  }
			}
		  });
		  
	
	
	
	
	
		});