/**
*Procedimientos y funciones de uso general
*
*/
var nav4 = window.event ? true : false;

jQuery( document ).ready(function(){
	

	 //solo numeros
	$( "input.onlynumber" ).keypress(function( evt ){
		var key = nav4 ? evt.keyCode : evt.which;
		return /[\d]/.test( String.fromCharCode( key ) );
	});
	
	//monetario
	$( "input.money" ).keyup(function(){
		this.value = number_format( this.value );
	});
	
	//solo letras
	$( "input.onlyword" ).keypress(function(){
		var key = nav4 ? evt.keyCode : evt.which;
		return /[\w]/.test( String.fromCharCode( key ) );
	});
	
	
	//link del listado de empresas
	$("#IDCategoriajaja").change(function () {
		var IDCategoria = $(this).val();
		console.log("IDCategoria" + IDCategoria);
		var LENGUAJE = $("#LENGUAJE").val();
		$.ajax({
			   type: "POST",
			   url: "ajax/CargaCategorias.php",
			   data: "IDCategoria="+IDCategoria+"&LENGUAJE="+LENGUAJE,
			   dataType: "json",
			
			   success: function(msg){
					$("#IDSubCategoria").removeOption(/./);
					$("#IDSubCategoria").addOption(msg, true);
					setTimeout( function(){$( "#volatilnotif" ).fadeOut( "slow" )} , 600 );
			   }
		});
	});
	



	
	//addNotify();
	/*
	$( "#volatilnotif" ).html( "Items Borrados!" );

	setTimeout( function(){$( "#volatilnotif" ).fadeOut( "slow" )} , 600 );
	*/
	
});

function addNotify()
{
	if( !window.contactonotify )
	{
		window.contactonotify = $( '<div id="volatilnotif" class="mensaje_notify info_notify">Obteniendo datos...</div>' )
					.css({ 
							"position":"absolute",
							"top" : "300px",
							"left" : "650px",
							"width" : "300px"
				}).get();
				
		$( document.body ).append( window.contactonotify );
	}
	else
		$( window.contactonotify ).show();
	
	setTimeout( function(){$( "#volatilnotif" ).fadeOut( "slow" )} , 600 );
		
}