/*COMPILATION OF JQUERY EFFECTS ON TYPOZE.COM*/

//navigation bar menu
$(document).ready(function(){

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	
	$("ul.topnav li span").click(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});
//accordion style menu
$(document).ready(function(){

	$(".r_accordion_menu h4:first").addClass("active");
	$(".r_accordion_menu p:not(:first)").hide();

	$(".r_accordion_menu h4").click(function(){

	  $(this).next("p").slideToggle("slow")
	  .siblings("p:visible").slideUp("slow");
	  $(this).toggleClass("active");
	  $(this).siblings("h4").removeClass("active");

	});

});

//book titles on main page
$(document).ready(function(){
	$("div.tabdiv img").hover(function(){
		var title = $(this).attr("title");
		$('#booktitle').text(title);
 	});	 	
});	

//adding friends
$(document).ready(function(){
	$(".addfriend a").click(function(){
		$(this).hide("slow");
	});	
});	

//dynamic delete X's
$(document).ready(function(){
	$("div.crosstrigger a").click(function(){
		$(".cross").show("slow");
	},function(){
		$(".cross").hide("fast");
	});	
});	

//character count for inbox
$(document).ready(function()
{
	// get current number of characters
	$('#counter2').html('500 characters left');

	$('#countertext2').keyup(function(){
		// get new length of characters
		$('#counter2').html((500 -$(this).val().length) + ' characters left');
	});
});

//character count for inbox
$(document).ready(function()
{
	// get current number of characters
	$('#counter1').html('500 characters left');

	$('#countertext1').keyup(function(){
		// get new length of characters
		$('#counter1').html((500 -$(this).val().length) + ' characters left');
	});
});

//character count for additional comments 
//added by ako 11/25/09
$(document).ready(function()
{
	// get current number of characters
	$('#counter3').html('500');

	$('#countertext3').keyup(function(){
		// get new length of characters
		$('#counter3').html(500 -$(this).val().length);
	});
});

// error in javascript... can't find function tablesorter, hiro commented this out on Feb 5
// tablesorter
// $(document).ready(function(){
// 	$('#myTable').tablesorter();
// });
