$("#txtUsuario").bind("focus",function(){ if($(this).val() == "Usuario"){ $(this).val(""); } })
			    .bind("blur",function(){ if($(this).val() == ""){ $(this).val("Usuario"); } });
				

$("#txtClave").bind("focus",function(){ if($(this).val() == "*****"){ $(this).val(""); } })
			  .bind("blur",function(){ if($(this).val() == ""){ $(this).val("*****"); } });


$('#btnIngresar').button();

$('#btnIngresar').click(function(){

	var data = $('#frmLogin').serialize();
	$.post(
		'app-code/login-code.php',
		data,
		function(data){
			if(data != ""){
				$('#dvMensajeLogin').html(data).show();
			}else{
				$("#dvDatosUsuarios").show();
				$("#frmLogin").hide();
			}
		},
		'html'
	);
});



$(document).ready(function(){

	$('#ajaxBusy').dialog({
		autoOpen:false,
		modal:true,
		resizable: false,
		dialogClass: "loading-dialog",
		closeOnEscape:false,
		draggable: false,
		width:215,
		height:45
	});

	$("ul.subMenu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subMenu*)
	$("ul.ddMenu li").click(function() { //When trigger is clicked...

		//Following events are applied to the subMenu itself (moving subMenu up and down)
		$(this).parent().find("ul.subMenu").slideDown('fast').show(); //Drop down the subMenu on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subMenu").slideUp('slow'); //When the mouse hovers out of the subMenu, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)

		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
		});
		
});



// Ajax activity indicator bound to ajax start/stop document events

$(document).ajaxStart(function(){ 
	//$('#ajaxBusy').dialog("open"); 
}).ajaxStop(function(){ 
	//$('#ajaxBusy').dialog("close");
}).ajaxError(function(event, request, settings) {
	//$('#ajaxBusy').dialog("close");
	alert(request.responseText);
});


