$(document).ready(function(){
	$('#s').focus(function(){
		if($(this).attr('value') == "Search for player or venue...."){
			$(this).attr('value', '');
		}
	}).blur(function() {
		if($(this).attr('value') == "Search for player or venue...."){
			$(this).attr('value', '');
		}
	}); 	
		
	Cufon.replace('.neue, #nav a', { fontFamily: 'Helvetica Neue Bold Consensed', hover: true});
	Cufon.replace('h1, h2, h3', { fontFamily: 'Helvetica Neue Heavy'});
	Cufon.replace('.neueHeavy', { fontFamily: 'Helvetica Neue Heavy', textShadow: '2px 2px rgba(0, 0, 0, 0.5)'});
	
	$('ul.nav').superfish();
	
	$('#content p img').each(function(){
		$(this).wrap('<a href="'+$(this).attr('src')+'" rel="page_group"/>');

	});
	
	$('#content .stub-body p a').colorbox();
	
	$('.playersearchdd').toggle(
		function(){
			var height = getHeight($(this).parent().children('ul'), true) + getHeight($(this).parent(), true);
			$(this).parent().animate({height: height}, 800, "linear");
		},
		function(){
			var height = getHeight($(this), true);
			$(this).parent().animate({height: height}, 800, "linear");
		}
	
	);
	
	$('.panels .last-panel').click(function(){
		window.open('http://banner.gentingpoker.com/cgi-bin/redir.cgi?TheWeeklyPC');
	});
});

function getHeight(element, incMargin){
	var height = element.height();
	height += parseInt(element.css("padding-top"), 10);
	height += parseInt(element.css("padding-bottom"), 10);
	if(incMargin){
		height += parseInt(element.css("margin-top"), 10);
		height += parseInt(element.css("margin-bottom"), 10);		
	}
	return height;
}
