/*------------------------------------------------------------------
[Global Javascript]

Copyright: Codefor 2009
Client: Joy Stick Generals
Project: Joy Stick Generals blog
Created by: Adam Foster
Last Updated: 01 - 11 - 10
-------------------------------------------------------------------*/

Cufon.replace('h1')('h2')('#nav a', { hover: true })('.btn', { hover: true })('.postNav a', { hover: true })('#commentform label');

$j = jQuery.noConflict();

/* When dom is ready ----------------------------------------------*/

$j(document).ready(function(){
	init();
	hoverStates();
	if($j('#mediaViewer')) mediaGo();	
});

/* Init -----------------------------------------------------------*/

function init(){
	$j('body').addClass('js');
	$j('a[rel="external"]').attr("target", "_blank");	
}

/* Nav hover states -----------------------------------------------*/

function hoverStates() {
	
	$j('#nav li:not(.current_page_item):not(.current_page_parent)').hover(
		function(){
			$j(this).children('a').stop().animate({paddingTop:"46px", backgroundColor: "#C1272D"}, 150, "easeInOutQuad");
		},
		function(){
			$j(this).children('a').stop().animate({paddingTop:"36px", backgroundColor: "black"}, 150, "easeInOutQuad");
		}
	);

}

/* Media ----------------------------------------------------------*/

function mediaGo () {
		
	$j('#thumbset li').children('a').click(function (e) {
		e.preventDefault();
		$j("#thumbset .selected").removeClass("selected");
		$j(this).parent().addClass("selected");
		var tHREF = $j(this).attr("href");
		$j('#screenshot img').fadeOut('fast', function() {
			$j('#screenshot').empty().append("\<img src='"+tHREF+"'\/>").children('img').css({opacity: 0}).stop().animate({opacity: 0},1000).animate({opacity: 1},300);
		});
	});
	
}
