// Start jQuery

$(document).ready(function() {

// GLOBALS //

/* Hover functionality site-wide ***********************************/

	$('.hover').hover(function() {
		$(this).addClass('active');
	}, function() {
		$(this).removeClass('active');
	});

/* Featured Articles ***********************************************/   

	$("div.scrollable").scrollable({
		size: 3,
		items: '#thumbs',   
		hoverClass: 'hover',
		speed: 400,
		keyboard: true
	});
	
	$("div.articlewrap").click(function(){
    	window.location=$(this).find("a").attr("href");
    	return false;
	});

/* Standard Articles ***********************************************/

	$("div.article.home:last-child").addClass('last');
	$("div.cat:last-child").addClass('last');

/* Recommended Articles *********************************************/

	$("div.recarticle").click(function(){
		window.location=$(this).find("a").attr("href");
		return false;
	});

	$("div.recarticle:nth-child(4)").addClass('last');

	$("div.twitterfeed").getTwitter({
		userName: "netgent",
		numTweets: 1,
		loaderText: "Loading latest tweet...",
		slideIn: true,
		showHeading: false,
		headingText: "",
		showProfileLink: false
	});

/* Related Articles ************************************************/

	$("div#relatedarticles ul li:nth-child(6)").addClass('last');


/* Comments ********************************************************/

	$("ol.commentlist li:last-child").addClass('last');


/* Archives ********************************************************/

	$("div.archive:even").addClass("even");


/* Holiday Promo ***************************************************/

	$("div.gift:even").addClass("even");
	$("div.gift:odd").addClass("odd");
	$("div.gift:nth-child(11)").addClass('noline');
	$("div.gift:nth-child(12)").addClass('noline');
	

/* Search **********************************************************/

	var searchLabel = $('#newsletter form label').remove().text();
	$('#emailaddress').addClass('placeholder').val(searchLabel).focus(function() {
		if (this.value == searchLabel) {
			$(this).removeClass('placeholder').val('');
		};
	}).blur(function() {
		if (this.value == '') {
			$(this).addClass('placeholder').val(searchLabel);
		};
	});
	
	$('#newsletter form').submit(function() {
		if ($('#email').val() == searchLabel) {
			$('#email').val('');
		}
	});

	$("div.result p").truncate( 125 );

	$("div.result:last-child").addClass('last');

}); // End jQuery