	
	$(document).ready(function(){ 
		
		$('#wpweather-3 p').wrapAll('<div id="wpweather_hldr" />');
		
		/* Fix Untitled in Facebook RSS
		---------------------------------------- */
		var fb_link		= $('#rss-3 ul li a');
		var fb_title	= fb_link.attr('title');
		if (fb_link.text() == "Untitled") {
			fb_link.text(fb_title);
		}
		
		
		/* Open RSS links in new window
		---------------------------------------- */
		$('.widget_rss a').attr('target', '_blank');
		
		
		/* Map List Show Hide
		---------------------------------------- */
		$("#ms_list_trigger a").click(function(){
			$("#map_sidebar").slideToggle('slow');
			
			if ($(this).find('span').html() == '+') {
				$(this).find('span').html('&times;');
			} else {
				$(this).find('span').html('+');
			}
			
			return false;
		
		});
		
		
		/* Date Picker jqueryui
		---------------------------------------- */
		$("#sb_forms .date_picker").each(function(){
			$(this).datepicker({ dateFormat: 'mm/dd/y', showAnim: 'fadeIn' });
		});
		
		
		/* Gallery Layouts
		---------------------------------------- */
		$('#gallery_list .gallery:nth-child(3n)').addClass('no_margin');
		
		$('.thickbox').each(function(){
			var title = $(this).attr('title');
			$(this).append('<span class="title">' + title + '</span>');
		});
		
		
		/* YouTube Video Thickbox Layouts
		---------------------------------------- */
		$('.youtube').each(function(){
			var title = $(this).attr('title');
			$(this).append('<span class="title">' + title + '</span>');
		});
		
		$('#youtube_embed').each(function(){

			// set the link with the thickbox values
			var object		= $(this).find('object');
			var yt_height = parseInt(object.attr('height')) + 8; 
			var yt_width	= parseInt(object.attr('width')) + 8;
			var yt_id			= $(this).attr('id'); 
			var yt_link		= $(this).parent().find('.youtube').addClass('thickbox');
			
			var yt_href		= "#TB_inline?height="+yt_height+"&width="+yt_width+"&inlineId="+yt_id;
			yt_link.attr('href', yt_href);
			
		});
		
		
		/* Main Navigation Dropdowns
		---------------------------------------- */
		$('#header_nav_list').superfish();
		$('#bg_navlist').superfish();
		
		
		/* Equalize Home Page Bucket Heights
		---------------------------------------- */
		if( $('#sc_left').length > 0 && $('#sc_right').length > 0 ) {
			var left 	= $('#sc_left').height();
			var right = $('#sc_right').height();
			if (left > right) {
				$('#sc_right').height(left);
			} else if (right > left) {
				$('#sc_left').height(right);
			}
		}
	
	
	


	/* fancybox */
	
	
	$("a.iframe").fancybox({
			'hideOnContentClick': false
	});

	
	
		
		
		/* Embed Sidebar Video
		---------------------------------------- */
		if ( $('#sb_video_hldr').length > 0 ) {	
			
			// load sidebar video
			var flashvars = {};
			var params = { allowScriptAccess: "always" };
			var atts = { id: "sb_video" };
			var videoID = "YMVte7l-oRY";
			swfobject.embedSWF("http://www.youtube.com/v/" + videoID + 
												"&enablejsapi=1&playerapiid=sb_video", 
												"sb_video_hldr", "628", "378", "8", null, null, params, atts);			
			}
				
		
	});
	
	/* Embed Sidebar Video
		---------------------------------------- */
		
	// start sidebar video playing
	function onYouTubePlayerReady(playerId) {
  	ytplayer = document.getElementById("sb_video");
  	// ytplayer.playVideo();
  	// ytplayer.mute();
	}	
