/* -------------------------------------------------- *
 * ToggleVal Plugin for jQuery                        *
 * Version 1.0                                        *
 * -------------------------------------------------- *
 * Author:   Aaron Kuzemchak                          *
 * URL:      http://kuzemchak.net/                    *
 * E-mail:   afkuzemchak@gmail.com                    *
 * Date:     8/18/2007                                *
 * -------------------------------------------------- */

 $(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready
 // (a little sooner than page load)
  $('.slickbox').hide();
 // shows the slickbox on clicking the noted link
 // toggles the slickbox on clicking the noted link
  $('a.slick-toggle').click(function() {
	$('.slickbox').toggle(700);
	return false;
  });
});
 
jQuery.fn.toggleVal = function(focusClass) {
	this.each(function() {
		$(this).focus(function() {
			// clear value if current value is the default
			if($(this).val() == this.defaultValue) { $(this).val(""); }
			
			// if focusClass is set, add the class
			if(focusClass) { $(this).addClass(focusClass); }
		}).blur(function() {
			// restore to the default value if current value is empty
			if($(this).val() == "") { 
				$(this).val(this.defaultValue);
				// if focusClass is set, remove class
				if(focusClass) { $(this).removeClass(focusClass); }
			}
		});
	});
}

//*********************
// MY STARTUP FUNCTIONS
//*********************

$(function () {	
	$("a#pulldown").click(function() {
		if ($("#topad").css("height") == "95px") {
			$("#topad").animate({height: "129px"}, 300);
			$(".topad2 ul").animate({height: "29px"}, 300);
			$("#pulldown").addClass("open");
		} else {
			$("#topad").animate({height: "95px"}, 300);
			$(".topad2 ul").animate({height: "0px"}, 300);
			$("#pulldown").removeClass("open");
		}
		return false;
	});
	
	$("#sidebar h4").click(function() {
		$(this).parent().siblings().removeClass("active").children('div:visible').slideUp('fast');

		$(this).parent().addClass("active");
    $(this).next().slideDown('fast');
		return false;
  });
  
 	$("#new-comment .col1 input").toggleVal("active");

	//FOR DEMO PURPOSES ONLY
	$(".aboutpage #navone").addClass("at");
	$(".subscribepage #navtwo").addClass("at");
	$(".episodespage #navthree").addClass("at");
	$(".contactpage #navfour").addClass("at");
	$(".forumpage #navfive").addClass("at");
	$(".storepage #navsix").addClass("at");
	
});


