/**
 * Activate Cufon Font Replacement
 */
 Cufon.set('fontFamily','TradeGothic_Condensed').replace('h1')('#slideshow h2')('#slideshow h2 a')('h4.highlight')('h4.pageTitle')('#slideshow h4')('#slideshow h4 a')('#slideshow h4 a:visited')('h5')('#socialMedia label.replace')('#followProject label');

 $(document).ready(function() {
   
   if (jQuery('#slideshow').length > 0) {
     $('#slideshow').cycle({
       fx: 'fade'
     });
  
     $('#previous').click(function() { 
       $('#slideshow').cycle('prev'); 
     });
  
     $('#pause').click(function() { 
       $('#slideshow').cycle('pause'); 
       //$('#play').toggle();
       //$('#pause').toggle();
     });
  
     $('#play').click(function() { 
       $('#slideshow').cycle('resume'); 
       //$('#play').toggle();
       //$('#pause').toggle();
     });
     
     $('#play').replaceWith('');
  
     $('#next').click(function() { 
       $('#slideshow').cycle('next'); 
     });
   
   }
   
   $("#tabs_SocialMedia").tabs();
   	
   $('#tab_Twitter').click(function() { 
     $('#twitter').css('z-index','5'); 
     $('#facebook').css('z-index','4'); 
     $('#flickr').css('z-index','3'); 
     $('#youtube').css('z-index','2'); 
     $('#blog').css('z-index','1'); 
   });

   $('#tab_Facebook').click(function() { 
     $('#twitter').css('z-index','4'); 
     $('#facebook').css('z-index','5'); 
     $('#flickr').css('z-index','3'); 
     $('#youtube').css('z-index','2'); 
     $('#blog').css('z-index','1'); 
   });

   $('#tab_Flickr').click(function() { 
     $('#twitter').css('z-index','3'); 
     $('#facebook').css('z-index','4'); 
     $('#flickr').css('z-index','5'); 
     $('#youtube').css('z-index','2'); 
     $('#blog').css('z-index','1'); 
 });

   $('#tab_YouTube').click(function() { 
     $('#twitter').css('z-index','2'); 
     $('#facebook').css('z-index','3'); 
     $('#flickr').css('z-index','4'); 
     $('#youtube').css('z-index','5'); 
     $('#blog').css('z-index','1'); 
   });

   $('#tab_Blog').click(function() { 
     $('#twitter').css('z-index','1'); 
     $('#facebook').css('z-index','2'); 
     $('#flickr').css('z-index','3'); 
     $('#youtube').css('z-index','4'); 
     $('#blog').css('z-index','5'); 
   });
   
   if (jQuery('#project_slideshow').length > 0) {
    $('#project_slideshow').after('<hr class="left" /><ul id="project_slideshow_nav"></ul> ').cycle({ 
        fx:     'fade', 
        speed:  10, 
        timeout: 0, 
        pager:  '#project_slideshow_nav',
         
        // callback fn that creates a thumbnail to use as pager anchor 
        pagerAnchorBuilder: function(idx, slide) {
            return '<li><a href="#"><img src="' + jQuery(slide).children("img").eq(0).attr('longdesc') + '" title="' + jQuery(slide).children("img").eq(0).attr('title') + '" alt="' + jQuery(slide).children("img").eq(0).attr('title') + '" width="100" height="100" /></a></li>'; 
        }
    });
   }
   
   $("#contentWrapper div.column").equalHeights();
   $("#socialMediaWrapper div.column").equalHeights();

   //equalHeight($("#contentWrapper .column"));

   var setMargins = ($('body').width() - 1260)/2;

   $('#slideshowInteriorWrapper').css('margin-left', setMargins);
   $('#slideshowInteriorWrapper').css('margin-right', setMargins);
   
   $('#socialMedia input.form-text').focus(function() {
     $("#NewsletterCategories").slideDown();
   });
   
   $('#socialMedia form').blur(function() {
     $("#NewsletterCategories").slideUp();
   });
   
 });


 $(window).resize(function() {
   
     var setMargins = ($('body').width() - 1260)/2;

     $('#slideshowInteriorWrapper').css('margin-left', setMargins);
     $('#slideshowInteriorWrapper').css('margin-right', setMargins);
   
 });
 