
$(document).ready(initSkin);

function initSkin(){
	$("table.tablalistado").each(addTableScript);
}

/* comportamientos para tablas */
function addTableScript(){
	$("td", this).mouseover(function (){
		$("td", $(this).parent()).each(function (){
			$(this).addClass("hover");
		});
	});
	$("td", this).mouseout(function (){
		$("td", $(this).parent()).each(function (){
			$(this).removeClass("hover");
		});
	});
}


function showMsgAlert(data){
	$("#mensaje span").html(data.msg);
	$("#mensaje .prompt").hide();
	$(".black_overlay").hide();
	if (data.prompt){
		$(".black_overlay").show();
		$("#mensaje .prompt").show();
		$("#mensaje #_aceptar").hide();
		$("#mensaje #_cancelar").hide();
		if (data.callback_accept){
			$("#mensaje #_aceptar").click(function (){
				hideMsgAlert();			
				data.callback_accept();
			});
			$("#mensaje #_aceptar").show();
		}
		if (data.callback_cancel){
			$("#mensaje #_cancelar").click(function (){
				hideMsgAlert();			
				data.callback_cancel();
			});
			$("#mensaje #_cancelar").show();
		}
	}else{
		setTimeout("hideMsgAlert();",3000);
	}
	if (data.style){
		$("#mensaje").removeClass();
		$("#mensaje").addClass("type"+data.style);
	}
	$("#mensaje").show();
	$("#mensaje").css("top", "-300px");
	$("#mensaje").animate({top: "0", "opacity": 1}, 500, "swing");	
}

function hideMsgAlert(){
	$(".black_overlay").fadeOut(100);
	$("#mensaje").animate({top: "-50px", "opacity": 0}, 500, "swing");		
}

