/** Cufon
 * 
 */
Cufon.replace('h2');
Cufon.replace('#mainNav ul li a', { hover:true });
Cufon.replace('.cta a span', { textShadow: '0 -1px 1px #c0174c' });

//Swfobject Youtube Embedded video
var youTubeEmbed = function(){
	var atts = {};
	atts.id = "vid";
	swfobject.embedSWF('http://www.youtube.com/v/'+ytVideoID+"&hl=en&fs=1&rel=0&color1=0x000000&color2=0x2d2d2d&enablejsapi=1&playerapiid=ytplayer", 
			   "vid", "255px", "168px", "8", null, null, atts);
};








$(document).ready(function() {
			


			//detect IE7 
			if(jQuery.browser.msie==true && jQuery.browser.version==7.0){var IE7=true;};
			  //removes class writen from document write which loaded before jQuery Loaded to stop it flashing
			  $('.pop').children().hide();
			  $('.pop').css({"display":"block"});
			
			  
			  $('body').removeClass('nojs');
			  $('.top').children('a').removeAttr('href');
			  //hide stuff that has a transition
			  $('#secNav').hide();

			  $('#back').hide();
			  $('.hideme').hide();

			  
			  //show stuff with annimation
			  $('#secNav').slideDown('slow');

			  			
				
				
				//Annimation as well as Alpha Transporancy is not properly supported by IE7 at the same time so show() and hide() are used in place of fadeIn() and fadeOut()
				if(IE7==true){
					//get title from li and use it to refer to the id of the box to be shown
				   	$('ul#csList li').click(function () { 
						var id= $(this).attr("title");
						var str="#"+id+" div.detail";
				  	  	$(str).show();	
					});
					
					//close detail on click
					$('span.close').click(function(){
						$(this).parent().parent('div.detail').hide();
					});	
				}
				else{
					//get title from li and use it to refer to the id of the box to be shown
				   	$('ul#csList li').click(function () { 
						var id= $(this).attr("title");
						var str="#"+id+" div.detail";
				  	  	$(str).fadeIn(400);	
					});
					
					//close detail on click
					$('span.close').click(function(){
						$(this).parent().parent('div.detail').fadeOut();
					});		
				};
		
				//where we are lightswitch function
				$('#switch').click(function(){
					$('#wrapper').toggleClass("wwdOff");	
				});	
				
				
				//PNG Fix
				$(document).pngFix(); 

				//who we are page
				$('div.more').hide();
				$('div.patron').hover(
				function(){
					$(this).children('span.main').hide();
					$(this).children('div.more').slideDown();	
				},
				function(){
					$(this).children('div.more').slideUp();
					$(this).children('span.main').show();
				});

				
				//podcast title slide function
				$('#podcast span.slide').hide();
				$('#podcast span.pc').hide();
				$('#podcast span.slide').animate({marginLeft: -170});
				
				$('#podcast').hover(function(){	
					$('#podcast span.pc').show();
					$('span.slide').animate({marginLeft: 0, opacity: 'show'}, "slow");
				},
				function(){
					$('span.slide').animate({marginLeft: -170, opacity: 'hide'}, "slow",function(){
					$('#podcast span.pc').hide();
					});		
				});	
				
				//external links to open in new window
				$('a.new-window, a[@href^="http://"]').click(function(){
					window.open(this.href);
					return false;
				});

				
});