/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){

	$.ajax({ url: BASEURL + "posts/latestvote", success: function(html) {
		$("#content_votelst").empty().append(html);
	}
	});

	$(".tabmenu > li").click(function(e){
		switch(e.target.id){
			case "votelst":
				//change status & style menu
				$("#votelst").addClass("tabactive");
				$("#votetopday").removeClass("tabactive");
				$("#votetopweek").removeClass("tabactive");
				
				$.ajax({ url: BASEURL + "posts/latestvote", success: function(html) {
					$("#content_votelst").empty().append(html);
				}
				});
				
				//display selected division, hide others
				$("div.votelst").fadeIn();
				$("div.votetopday").css("display", "none");
				$("div.votetopweek").css("display", "none");
			break;
			case "votetopday":
				//change status & style menu
				$("#votelst").removeClass("tabactive");
				$("#votetopday").addClass("tabactive");
				$("#votetopweek").removeClass("tabactive");
				
				$.ajax({ url: BASEURL + "posts/topvotetoday", success: function(html) {
					$("#content_votetopday").empty().append(html);
				}
				});
				
				//display selected division, hide others
				$("div.votetopday").fadeIn();
				$("div.votelst").css("display", "none");
				$("div.votetopweek").css("display", "none");
			break;
			case "votetopweek":
				//change status & style menu
				$("#votelst").removeClass("tabactive");
				$("#votetopday").removeClass("tabactive");
				$("#votetopweek").addClass("tabactive");
				
				$.ajax({ url: BASEURL + "posts/topvoteweek", success: function(html) {
					$("#content_votetopweek").empty().append(html);
				}
				});
				
				//display selected division, hide others
				$("div.votetopweek").fadeIn();
				$("div.votelst").css("display", "none");
				$("div.votetopday").css("display", "none");
			break;
		}
		//alert(e.target.id);
		return false;
	});
});
