﻿$(function() {

	// search widget
	$("#nav-search-button").click(function() {
		$(this).toggleClass("nav-search-selected");
		$("#search").toggle();
	});
	
	// mailing
	$("input.join-mailing-input").focus(function() {
		if(this.value === $(this).attr("title")) {
			this.value = '';
		}
	});
	
	// colorbox
	if ($("#gallery").length) {
		$("#gallery a[rel='gallery']").colorbox({ width: 550, height: 550, current: "{current} / {total}" });
	}

	// videos (splash)
	$("#videos div.video a").click(function() {
		embedYouTube("ytplayer", $(this).attr("id"), 318, 245);
		$.scrollTo("#splash-video", 1000);
		return false;
	});
	
	// rss (splash)	
	if ($("#rss").length && $("#rss li").length > 5 ) {
		$(".read-all-rss").click(function() {
			$(this).hide();
			$("#rss li:hidden").show("fast");
			return false;
		});	
	}
	
});

function embedYouTube(containerId, videoId, width, height) {
    var params = { allowScriptAccess: "always", wmode: "transparent" },
		atts = { id: "ytplayer" };
    swfobject.embedSWF("http://www.youtube.com/v/" + videoId + "?hl=en_US&fs=1", containerId, width, height, "8", null, null, params, atts);
}

function PollDisplay() {
	$("#poll-bd").toggle();
	$("#poll-ft").toggle();
	return false;
} 
