var default_search_text = 'Enter Keywords';

$(document).ready(function(){

	/* Flah Player Expander */
	$("div#mainVideoPlayerTitle").click(
		function()
		{
			$("div#videoPlayer").slideToggle('fast', function () {
				if( $('#putVideoHere').html() == beforeFlash ) {
					$('#putVideoHere').html(afterFlash);
				} else {
					$('#putVideoHere').html(beforeFlash);
				}
				});
			$(this).toggleClass('videoPlayerTitleActive');
		}
	);
	
	$("div#mainVideoPlayerTitle").hover(
		function () {
			if( !$(this).hasClass('videoPlayerTitleActive') )
			{
				$(this).addClass('videoPlayerTitleHover').removeClass('videoPlayerTitle');
			}
		}, 
		function () {
			if( !$(this).hasClass('videoPlayerTitleActive') )
			{
				$(this).addClass('videoPlayerTitle').removeClass('videoPlayerTitleHover');
			}
		}
	);

	/* Ajax Tabs */
	$("ul.tabs a[rel]").livequery('click',
		function()
		{
			me = $(this);
			$("ul.tabs a[rel="+me.attr("rel")+"]").removeClass('tabActive');
			me.toggleClass('tabLoading');
			tab_name = me.attr("href").substr(1);
			
			$.ajax({
				url: 'http://www.heartsupport.com/includes/index_tabs.php?v='+tab_name,
				cache: false,
				success: function(html){
					$("#"+me.attr("rel")).html(html);
					me.removeClass('tabLoading').addClass('tabActive');
					
					/*
					if( tab_name == "news" ) {
						$("#miniBlogViewAll").text("View All News").attr("href","/blogs/news/");
					} else if( tab_name == "blogs" ) {
						$("#miniBlogViewAll").text("View All Blogs").attr("href","/gethelp/#content");
					} else if( tab_name == "confessions" ) {
						$("#miniBlogViewAll").text("View All Confessions").attr("href","/gethelp/confessions/");
					} else if( tab_name == "dates" ) {
						$("#miniBlogViewAll").text("View All Tour Dates").attr("href","/gethelp/dates.html");
					}
					*/
				}
			});
			
			return false;
		}
	);

	/* Search Box */
	if( $("#searchField").val() == '' )
	{
		$("#searchField").val(default_search_text);
	}
	
	$("#searchField").focus(function () {
		if( $(this).val() == default_search_text )
		{
			$(this).val('');
		}
	});
	$("#searchField").blur(function () {
		if( $(this).val() == '' )
		{
			$(this).val(default_search_text);
		}
	});
	
});
