
// function social(type) {
//	if(type=='twitter'){
//		$("#hp-news-social").css("background-image","url(/images/hpimages/twitter-on.gif)");
//		
//		if($("#tweet-id-1").text() == "")
//		{
//			$("#hp-news-social-show").html("The direct Twitter feed is temporarily unavailable, but you can read our latest tweets at <a target=\"_blank\" href=\"http://twitter.com/CR_UK\">http://twitter.com/CR_UK</a>");
//		}
//		else
//		{
//			$("#hp-news-social-show").html($("#twtr-widget-1").html());
//		}
//		
//		// IE fix
//		$(".twtr-tweet-text").css("margin-left","0px");
//		$(".twtr-avatar").remove();
//	}
//	else if(type=='podcast'){
//		$("#hp-news-social-show").html($("#hp-news-social-hidden-podcast").html());
//		$("#hp-news-social").css("background-image","url(/images/hpimages/podcast-on.gif)");
//	}
//	else{
//		$("#hp-news-social-show").html($("#hp-news-social-hidden-blog").html());
//		$("#hp-news-social").css("background-image","url(/images/hpimages/blog-on.gif)");
//	}
// }




jQuery.fn.center = function () {
	this.css("position","absolute");
	this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
	this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
	return this;
}

function setPanelHeights(row) {
	row = $(row);
	row.each(function(){
		$(this).addClass('temp');
		setPanelHeight('.temp > div');
		setPanelHeight('.temp > div');
		setPanelHeight('.temp > div');
		$(this).removeClass('temp')
	});
}

function setPanelHeight(col) {
	maxHeight = 0;

	col = $(col);

	if (!($.browser.msie && $.browser.version == 6.0)) {
		col.css({'min-height': 0});
		col.css({'height': 'auto'});
	}

	col.each(function() {
		if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
	});

	if ($.browser.msie && $.browser.version == 6.0) { col.css({'height': maxHeight}); }
	col.css({'min-height': maxHeight});
}



function hpCarousel(i, time)
{
	var k = i;
	var which = "#carouselImages > div";

	if($(which).length==0)
	{
		return;
	}

	if(k>=$(which).length)
	{
		k=0;
	}
	
	//var whichShow = '#carouselImage'+k;
	var show = $("#hp-flash");
	
	show.html($(which)[k].innerHTML);
	
	//show.fadeOut("slow", function callback()
	//	{
	//		show.html($(which)[k].innerHTML);
	//		show.fadeIn("slow");
	//	}
	//);
	setTimeout(function() {hpCarousel(k+1, time); }, time);
}



function Show_Popup(action, userid)
{
	$('#window').center();
	$('#popup').fadeIn('fast');
	$('#window').fadeIn('fast');
}
function Close_Popup()
{
	$('#popup').fadeOut('fast');
	$('#window').fadeOut('fast');
}

$(function() {
	$('#primary-nav ul li:last').addClass('lasttab');
});
