/**
*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 ) );
	});
	
	$( "form.formvalida" ).submit(function(){ 
		
		 return EvaluaReg( this );
	});
	
	//Enviar forularios intocable
	$(".EnviaForm").click(function(){
		$( "#" + $(this).attr("rel") ).submit();
		return false;
	});
	

	$("#box-galeria .contimg").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		scroll: 1,
		visible: 5,
		speed:800,
		circular: "false"

	});
	
	
	$("#content_img_proyect").jCarouselLite({
		btnNext: ".nextp",
		btnPrev: ".prevp",
		scroll: 1,
		visible: 6,
		speed:800,
		circular: "false"

	});
	
	$("#content_img_area").jCarouselLite({
		btnNext: ".nexta",
		btnPrev: ".preva",
		scroll: 1,
		visible: 6,
		speed:800,
		circular: "false"

	});
	
	//menu
	$(".btn_menu").click(function(){
		$(".ok ul").hide();
		$(this).parent( ).children("ul").toggle("900");
	});
	
	//Enviar forularios intocable
	$(".btnProyecto").click(function(){
		$( ".borde" ).hide();
		$( "#" + $(this).attr("rel") ).show("slow");
		$(".btnProyecto").removeClass("current");
		$(this).addClass("current");
		
		
		return false;
	});

	//Enviar forularios intocable
	$(".btnVias").click(function(){
		$( ".borde" ).hide();
		$( "#contentAcceso").show("slow");
		return false;
	});
	$(".btnSitios").click(function(){
		$( ".borde" ).hide();
		$( "#contentSitios").show("slow");
		return false;
	});

	
	$(".btnFotoP").click(function(){
		
		var ruta = $(this).children("img").attr("src");
		$("#PFotoPrincipal").attr( "src", ruta );
		return false;
		
	});


	$(".btnFotoPArea").click(function(){
		
		var ruta = $(this).children("img").attr("src");
		$("#PFotoPrincipalArea").attr( "src", ruta );
		return false;
		
	});

	
	$('.bannerhome').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	$('#fotosProyecto').simpleslider({
		speed			: 500,
		transition		: 'fade',
		auto			: true,
		navigation		: false,
		buttons : false
	});
	
	
	
});

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 );
	
}


