// JavaScript Document


$(function() {
		   
		   
	$("#year").live('change', function() {
		$year = $(this).val();
		$type = $(this).attr("title");
		$("#download_list").html("").addClass("loading");
		$.ajax({
			type: "POST",
			url:"ajax.php",
			data: "command=year_sort&year="+$year+"&type="+$type,
			success: function(data) {				
				$("#resultDiv").html(data);
				$("#download_list").removeClass("loading").fadeIn(500);
			}
		});
	});
	
	$("#newsletter_year").live('change', function() {
		$year = $(this).val();
		$type = $(this).attr("title");
		$("#newsletter_list").html("").addClass("loading");
		$.ajax({
			type: "POST",
			url:"ajax.php",
			data: "command=year_sort&year="+$year+"&type="+$type,
			success: function(data) {				
				$("#newsletterResult").html(data);
				$("#newsletter_list").removeClass("loading").fadeIn(500);
			}
		});
	});
	
	$("#employee_year").live('change', function() {
		$year = $(this).val();
		$("#newsletter_list").html("").addClass("loading");
		$.ajax({
			type: "POST",
			url:"ajax.php",
			data: "command=year_sort&year="+$year+"&type="+$type,
			success: function(data) {				
				$("#newsletterResult").html(data);
				$("#newsletter_list").removeClass("loading").fadeIn(500);
			}
		});
	});
	
	$(".pagination > a").live('click', function() {
		if(!$(this).is(".active")) {	
			if($("#year").length == 0) { $year="" } else { $year = $("#year").val() }
			$alt = $(this).attr("rel").split(",");
			$type = $alt[0];
			$pageno = $alt[1];
			$("#download_list").html("").addClass("loading");
			$.ajax({
				type: "POST",
				url:"ajax.php",
				data: "command=pagination&year="+$year+"&type="+$type+"&pageno="+$pageno,
				success: function(data) {
					$("#resultDiv").html(data);
					$("#download_list").removeClass("loading").fadeIn(500);
				}
			});
		}
		return false;
	});
	
	
	
	$("a.empMenu").click(function() {
		$("#cornerInnerLinks").slideToggle('medium'); 
	});
	
	$("#corner_menu li").hover(function() {
		  $(this).find("div.corner_menu_links").show();
	}, function() {
		  $(this).find("div.corner_menu_links").hide();	
	});
	
	
});
