// Halal Tube JS
// Written by Amir M. Sahib
// www.amirsahib.com
// Rajab 1429
// July 2008

$(function() {
	
	$("div.order-date").hide();
	$("div.order-title").show();
	
	$(".order-date-btn").click(function () {
		$("div.order-date").show();
		$("div.order-title").hide();
		return false;
	});

	$(".order-title-btn").click(function () {
		$("div.order-title").show();
		$("div.order-date").hide();
		return false;
	});
	
	$("a.get-bio").click(function () {
		$("div.bio").show();
		$("div.order-title").hide();
		$("div.order-date").hide();
		return false;
	});


	//Sidebar tabs (speakers/topics)
	$("#side-nav li").each(function(){
		var tab = $(this);
		$('a',tab).click(function(e){
			e.preventDefault();
			$("#side-nav li").removeClass('current');
			tab.addClass('current');
			var id = $(this).attr('href');
			$(".side-panel").removeClass('current');
			$(id).addClass('current');
		});
	});

	// Age limit posts
	$('#age-check-form').each(function(){
		var x = $(this);
		$('input[name=age_check]').click(function(){
			if ( $('input[name=age_check]:checked',x).val() == 'true' ) {
				x.hide();
				$("#hidden-content").show();
			} else {
				window.location.href = 'http://halaltube.com';
			}
		});
	});

	//Category Order option radio buttons
	$('#cat-order-options').each(function(){
		$(this).buttonset();
	});

	//Homepage adjust sidebar height
	$('body.home').each(function(){
		var h = parseInt($('#content').height()) - 50;
		$('#sidebar .side-panel').css('height',h+'px');
	});
	
	//Lightbulb feature
	$('#lightbulb').each(function(){
		$('a',$(this)).click(function(e){
			e.preventDefault();
			if ( $(this).hasClass('off') ) {
				$(this).addClass('on').removeClass('off');
				$('#curtain').show();
			} else {
				$(this).addClass('off').removeClass('on');
				$('#curtain').hide();
			}
		});
	});
	
	// Lecture details hover
	$('#content .lecture-list ul li').each(function(){
		/*var lec = $(this);
		lec.hover(function(){
			$('.lecture-details',lec).slideDown();
		}, function() {
			$('.lecture-details',lec).slideUp();
		});*/
	});
	
});

