$("#tabbar-div span").mouseover(function(){
	if ($(this).attr('class') == "tab-back"){
		$(this).attr('class',"tab-hover");
	}	
});

$("#tabbar-div span").mouseout(function(){
	if ($(this).attr('class') == "tab-hover"){
		$(this).attr('class',"tab-back");
	}	
});


$("#tabbar-div span").click(function(){
	var obj = this;
	if ($(this).attr('class') == "tab-front" || $(this).attr('class') == '' || obj.tagName.toLowerCase() != 'span'){
		return;
	}else{
		objTable = $(this).attr('id').substring(0, $(this).attr('id').lastIndexOf("-")) + "-table";

		$("table").each(function(){
			if ($(this).attr('id') == objTable){
				$(this).show();
			}else{
				var tblId = $(this).attr('id');
				if (tblId != undefined && tblId.indexOf('-table')>0){
					$(this).hide();
				}
			}
		});

		$("#tabbar-div").find("span").each(function(){
			$(this).attr('class',"tab-back");
		});

		$(obj).attr('class',"tab-front");
	}
});
