;(function(jQuery) {
jQuery(document).ready(function() {
 
 
 
 
 
     var userAgent = navigator.userAgent.toLowerCase();
    jQuery.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
    
    // Is this a version of IE?
    if(jQuery.browser.msie){
        jQuery('body').addClass('browserIE');
        
        // Add the version number
        jQuery('body').addClass('browserIE' + jQuery.browser.version.substring(0,1));
    }
    
    
    // Is this a version of Chrome?
    if(jQuery.browser.chrome){
    
        jQuery('body').addClass('browserChrome');
        
        //Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
        userAgent = userAgent.substring(0,1);
        jQuery('body').addClass('browserChrome' + userAgent);
        
        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
        jQuery.browser.safari = false;
    }
    
    // Is this a version of Safari?
    if(jQuery.browser.safari){
        jQuery('body').addClass('browserSafari');
        
        // Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
        userAgent = userAgent.substring(0,1);
        jQuery('body').addClass('browserSafari' + userAgent);
    }
    
    // Is this a version of Mozilla?
    if(jQuery.browser.mozilla){
        
        //Is it Firefox?
        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
            jQuery('body').addClass('browserFirefox');
            
            // Add the version number
            userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
            userAgent = userAgent.substring(0,1);
            jQuery('body').addClass('browserFirefox' + userAgent);
        }
        // If not then it must be another Mozilla
        else{
            jQuery('body').addClass('browserMozilla');
        }
    }
    
    // Is this a version of Opera?
    if(jQuery.browser.opera){
        jQuery('body').addClass('browserOpera');
    }
    
    
    
    
    
    
jQuery("#toggleCommentFormPanel").toggle(
  function () {
    jQuery('#commentFormPanel').slideDown();

  },
  function () {
    jQuery('#commentFormPanel').slideUp();

  }
);

 
jQuery("#triggerSearch").toggle(
  function () {
  	jQuery("#SearchForm_SearchForm_Search").val("Type your search here...");
    jQuery('#pageSearch').fadeIn(80);
    jQuery(this).addClass("searchCurrent");
  },
  function () {
    jQuery('#pageSearch').fadeOut(300);
    jQuery(this).removeClass("searchCurrent");
  }
);


jQuery("#SearchForm_SearchForm_Search").focus(
	function () {
		jQuery(this).val("");
	}
);


jQuery(".hideShow").toggle(
  function () {
  	jQuery(this).hide();
	jQuery(this).parent().find('fieldset').fadeIn();
  },
  function () {
    jQuery(this).parent().find('fieldset').fadeOut();
  }
);


// footer buttons
jQuery("#FooterSitemapWidget").toggle(
  function () {
    jQuery(this).removeClass("expandWidget").addClass("expandWidgetActive");
    jQuery("#FooterSitemapPanel").slideDown();

  	
  },
  function () {
    jQuery(this).removeClass("expandWidgetActive").addClass("expandWidget");
    jQuery("#FooterSitemapPanel").slideUp();

  }
);

// Share this button
jQuery("#sharethisTrigger").toggle(
  function () {
  	jQuery(this).css({opacity:1}).removeClass("expandWidget").addClass("expandWidgetActive");
  	jQuery("#bookmarkicons").fadeIn();	  	
  },
  function () {
  	jQuery(this).css({opacity:0.5}).removeClass("expandWidgetActive").addClass("expandWidget");
    jQuery("#bookmarkicons").fadeOut();
  	}
);



// latestFeaturedBlock fade effect
jQuery('.latestFeaturedBlock a').hover(function(){jQuery(this).parent().addClass('genericHover')},function(){jQuery(this).parent().removeClass('genericHover')})



// Popup for video class
jQuery(".popup-video").click(function() {
	jQuery.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'width'			: 560,
			'height'		: 340,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
									'wmode'				: 'transparent',
									'allowfullscreen'	: 'true'
								}
		});

	return false;
});


// Popup for image class
jQuery(".popup-image").click(function() {
	jQuery.fancybox({
			'padding'		: 0,
			'autoScale'		: true,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none'
	});
	return false;
});




})
})(jQuery);



