$(document).ready(function(){ 
	if($.browser.msie && parseInt($.browser.version) == 6) {
		$(document).pngFix();
	}
	
	$("table.table tr:even td").css("background-color", "#e4ecff");
	$("table.table tbody td:first-child").css("border-left", "2px solid #e7ebf7");
	$("table.table tbody td:last-child").css("border-right", "2px solid #e7ebf7");
	
	$("table.tablewide tr:even td").css("background-color", "#e4ecff");
	$("table.tablewide tbody td:first-child").css("border-left", "2px solid #e7ebf7");
	$("table.tablewide tbody td:last-child").css("border-right", "2px solid #e7ebf7");
	
	$("ul.nav").superfish({
		delay:100,
		animation: {height:'show'},
		speed:'fast',
		autoArrows:false,
		onShow: showMenu,
		onHide: hideMenu
	});
	
	$('div.required label').append('<span style="color:#ff0000;">*</span>');
	
	$('#category_select').change(function(){
	  $('#category_form').submit();
	  return false;
	});
	
	$('.commit').click(function(){
	  $(this).hide();
	  $('.commit-message').show();
	});
	
	$('#number_of_authors').change(function(){
	  var num = $(this).val();
	  $('.authorEntries').hide();
	  for(var i=1;i<=num;i++) {
		  $('#author'+i).slideDown();
	  }
	});
	
	$('#same_billing').click(function(){
		if(this.checked) {
			var name;
			var othername;
			$('table#billing-info input').each(function() {
				name = $(this).attr('id');
				othername = name.replace("billing_","");
				if(name.indexOf("billing_") != -1) {
					$(this).val($('#'+othername).val());
				}
			});
		}
	});
	
}); 

function showMenu() {
	if($(this).find('a:first').text() == 'Courses') {
		$('.numbers').hide();
		$('.pause').hide();
	}
}

function hideMenu() {
	$('.numbers').show();
	$('.pause').show();
}
