
/*                                          JQUERY MASONRY
__________________________________________________________
*/
	
	$(function(){
	
      var 
        speed = 400,   // animation speed
        $wall = $('#main').find('#clipboard-grid')
      ;
           
      $wall.masonry({
        columnWidth: 15, 
        // only apply masonry layout to visible elements
        itemSelector: '.hp-clip:not(.invis)',
        animate: true,
        animationOptions: {
          duration: speed,
          queue: false
        }
      });


	  $("li#clipsnav-all").addClass("on");
	  
      $('#clipsnav li a').click(function(){      
        var clipClass = '.' + $(this).attr('class');
        if(clipClass=='.clip-all') {
          // show all hidden boxes
          $wall.children('.invis')
            .toggleClass('invis').fadeIn(speed);
             $('#clipsnav li').removeClass("on");
        } else {  
          // hide visible boxes 
          $wall.children().not(clipClass).not('.invis')
            .toggleClass('invis').fadeOut(speed);
            $('#clipsnav li').removeClass("on");
          // show hidden boxes
          $wall.children(clipClass+'.invis')
            .toggleClass('invis').fadeIn(speed);
            $('#clipsnav li').removeClass("on");
        }
        
        $(this).parent().addClass("on");
        $wall.masonry();

        return false;
      });

    });



/*                                     JQUERY ON DOC READY
__________________________________________________________
*/

  	$(document).ready(function(){
	
		/* ---ALL EXTERNAL LINKS OPEN IN NEW WINDOW----- */	
		
		jQuery("a[href^='http:']").not("[href*='findawayworld.com']").attr('target','_blank');
	
	
		/* ---SPAM BLOCKER------------------------------ */	
	
		$('a.email').each(function(){
			e = this.rel.replace('/','@').replace('site','findawayworld.com');
			this.href = 'mailto:' + e;
			$(this).text(e);
			//format: <a href="#" rel="emailaddress/site" class="email"></a>
		});
		
		$('a.btn-job_apply').each(function(){
			this.href = 'mailto:' + 'hr_resumes' + '@findawayworld.com?subject=' + this.rel;
		});
		
		$('a.btn-job_creative').each(function(){
			this.href = 'mailto:' + 'creative' + '@findawayworld.com?subject=' + this.rel;
		});
		
		$('a.footer_contact').each(function(){
			e = this.rel.replace('/','@').replace('site','findawayworld.com');
			this.href = 'mailto:' + e;
		});
		
		/* ---PRELOAD CSS IMAGES-------------------- */	
		jQuery.preLoadImages("navbg-ie-main-trans.png", "/wp-content/themes/findawayworld/images/navbg-ie-main-trans.png");
		jQuery.preLoadImages("navbg-ie-sub-trans.png", "/wp-content/themes/findawayworld/images/navbg-ie-sub-trans.png");
		jQuery.preLoadImages("nav-inourworld.png", "/wp-content/themes/findawayworld/images/nav-inourworld.png");
		jQuery.preLoadImages("nav-whatwedo.png", "/wp-content/themes/findawayworld/images/nav-whatwedo.png");
		jQuery.preLoadImages("nav-buzzworthy.png", "/wp-content/themes/findawayworld/images/nav-buzzworthy.png");
		jQuery.preLoadImages("nav-clipboard.png", "/wp-content/themes/findawayworld/images/nav-clipboard.png");
		jQuery.preLoadImages("btn-readmore-trans.png", "/wp-content/themes/findawayworld/images/btn-readmore-trans.png");
		jQuery.preLoadImages("tipsy.png", "/wp-content/themes/findawayworld/images/tipsy.png");



		/* ---ORBIT FADING SLIDES----------------------- */	
		$('div#hp-feature').orbit({
			advanceSpeed: 9000
		});
		
		$('div#givesback-fade').orbit({
		     animation: 'fade',
		     animationSpeed: 1200,
		     timer: true,
		     advanceSpeed: 6000,
		     directionalNav: false,
		     captions: false,
		     bullets: false,
		     bulletThumbs: false
		});
		
		$('div#leadership-slide').orbit({
		     animation: 'horizontal-slide',
		     animationSpeed: 800,
		     timer: false,
		     directionalNav: true,
		     captions: false,
		     bullets: true,
		     bulletThumbs: true
		});
		
		
		/* ---CLIPBOARD TOOLTIP HELP-------------------- */
		$('#clipboard-tooltip').tipsy({gravity: 'n'});
		
		
		/* ---FADE CLIP INFO ON HOVER------------------- */	
		$("div.hp-clip").hover(function(){
			$(this).children(".rgba div").stop().fadeTo(400, 1);
			$(this).children(".no-rgba div").stop().fadeTo(400, 0.9);
		},function(){
			$(this).children("div").stop().fadeTo(600, 0);
		});
		
		$("div.hp-clip div").hide();

		

	});
	

