/*SOLO NUMEROS*/
	function solonumeros(evento)
	{
	//	alert("validar solonumeros");
	  //ejemplo <input type="text" onkeypress="return solonumeros(event)" />
	  // key = 35 (Fin)
	  // Key = 36 (Inicio)
	  // Key = 46 (Supr)  
	  
	  var key = evento.keyCode ? evento.keyCode : evento.which;
	  if (key>32){
	   if(key>=48 && key<= 57 || key==46 || key==35 || key==36){
		return
	   }else{
		return false;
	  }
	 }
	}
/*ABRIR O CERRAR FILAS, IFRAMES, ETC*/
	function abrir_cerrar(nombre,cerrar)
	{
		/*
		nombre : corresponde al nombre de la fila o iframe que queremos que se expanda
		cerrar : corresponde al nombre de la fila o iframe que queremos cerrar al momento de abrir
		todo   : se cerraran todas las filas o iframes que poseean la clase abrir luego se brira nombre
		*/
		var clase=document.getElementById(nombre).className;
		if(clase=="abierto")
		{document.getElementById(nombre).className="cerrado";}
		else
		{document.getElementById(nombre).className="abierto";}
		
		if(cerrar!=""){document.getElementById(cerrar).className="cerrado";}
	}
/*OTORGAR FOCO A FILAS*/
	function color_grid_foco(nombre)
	{
		old_color=document.getElementById(nombre).className;
		document.getElementById(nombre).className="tr_lista_foco_mano";
	}
	function color_grid_focolost(nombre){document.getElementById(nombre).className=old_color;}

	function color_grid_foco_cotizacion(nombre)
	{
		old_color=document.getElementById(nombre).className;
		document.getElementById(nombre).className="tr_lista_foco_mano_cotizacion";
	}
	function color_grid_focolost_cotizacion(nombre){document.getElementById(nombre).className=old_color;}

/*OTORGAR FOCO A DIV CONTENEDOR DE IMAGENES*/
	function color_foco(nombre){document.getElementById(nombre).className='margen_img_FOCO';}
	function color_focolost(nombre){document.getElementById(nombre).className='margen_img';}
	
/*ABRIR POPUP CON DETALLE DE LA IMAGEN*/
	function popup_detalle(id_prod)
	{
			var dir;
			dir = "ADM/MODULO/Catalogo/detalle/galeria.php?ID="+id_prod;
			popup=window.open(dir,"popup_detalle","toolbar=0,width=790, height=580, scrollbars=0,left=1,top=0,resizable=0");
			popup.focus();
	}
	
/*validador de envio de datos de formulario registro*/
	function validar_registro()
	{
		if(window.document.getElementById('nombre_reg').value=="")
		{alert("El campo nombre es obligatorio");window.document.getElementById('nombre_reg').focus();return;}
		
		if(window.document.getElementById('rut_reg').value=="")
		{alert("El campo rut es obligatorio");window.document.getElementById('rut_reg').focus();return;}
		
		if(window.document.getElementById('digito_reg').value=="")
		{alert("El campo digito es obligatorio");window.document.getElementById('digito_reg').focus();return;}
		
		if(window.document.getElementById('email_reg').value=="")
		{alert("El campo email es obligatorio");window.document.getElementById('email_reg').focus();return;}
		var MAIL = validaMail(window.document.getElementById('email_reg'));
		if(MAIL==1){return;}
		
		if(window.document.getElementById('fono_reg').value=="")
		{alert("El campo fono es obligatorio");window.document.getElementById('fono_reg').focus();return;}
		
		if(window.document.getElementById('direccion_reg').value=="")
		{alert("El campo direccion es obligatorio");window.document.getElementById('direccion_reg').focus();return;}
		
		if(window.document.getElementById('pais_reg').value=="")
		{alert("El campo pais es obligatorio");window.document.getElementById('pais_reg').focus();return;}
		
		if(window.document.getElementById('ciudad_reg').value=="")
		{alert("El campo ciudad es obligatorio");window.document.getElementById('ciudad_reg').focus();return;}
		
		if(window.document.getElementById('comuna_reg').value=="")
		{alert("El campo comuna es obligatorio");window.document.getElementById('comuna_reg').focus();return;}
		
		if(window.document.getElementById('usuario_reg').value=="")
		{alert("El campo usuario es obligatorio");window.document.getElementById('usuario_reg').focus();return;}
		
		if(window.document.getElementById('password_reg').value=="")
		{alert("El campo password es obligatorio");window.document.getElementById('password_reg').focus();return;}
		
		window.document.getElementById('formulario').submit();
	}
/*VALIDAR ENVIO DE CONTACTO*/
	function enviar_contacto()
	{
		if(window.document.getElementById('nombre').value=="")
		{alert("El campo nombre es obligatorio");window.document.getElementById('nombre').focus();return;}
		
		if(window.document.getElementById('email').value=="")
		{alert("El campo email es obligatorio");window.document.getElementById('email').focus();return;}
		
		if(window.document.getElementById('comentario').value=="")
		{alert("El campo comentario es obligatorio");window.document.getElementById('comentario').focus();return;}
		
		if(window.document.getElementById('producto1').value=="")
		{alert("Necesita ingresar 1 artículo al menos");window.document.getElementById('producto1').focus();return;}
		
		if(window.document.getElementById('cantidad1').value=="")
		{alert("Necesita ingresar 1 cantidad al menos");window.document.getElementById('cantidad1').focus();return;}
		
		var MAIL = validaMail(window.document.getElementById('email'));
		if(MAIL==1){return;}
		
		window.document.getElementById('form_contactos').submit();
	}
/*VALIDAMOS EMAIL*/
	function validaMail(obj)
	{
		var correo = obj.value;
		if (correo == "" || correo == "undefined") { return 0; }
		var listcorreo = correo.split(";");
		var campo = "";
		for (i=0; i < listcorreo.length; i++) 
		{
			campo = listcorreo[i];
			if(campo != "")
			{
				if ( campo.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig) ) 
				{ 
					alert("El correo electronico "+campo+" no es valido. \n\n Debe escribirlo de esta forma: nombre@servidor.dominio");
					obj.focus();
					obj.select();
					return 1;
				}
			}
		}
		return 0;
	}
/*CARGAMOS EL COMBO CON LAS COMUNAS*/
	function cargar_comuna(cod)
	{
		var sreq	= "xml_comuna.php?COD="+cod;
		var mixml 	= xmlgetdata(sreq);
		var maxelement = mixml.getElementsByTagName('item').length;	
		document.getElementById('comuna_reg').options.length = 0;
		for(i = 0; i < maxelement; i++)
		{ 
			value = mixml.getElementsByTagName('value')[i].firstChild.nodeValue;
			texto = mixml.getElementsByTagName('texto')[i].firstChild.nodeValue;
			opcion = new Option(texto, value); 
			document.getElementById('comuna_reg').options[i+1] = opcion; 
		}
	}
	
/*ABRIR POPUP CONFIGURABLE*/
	/**
	url = determina la ruta del archivo que se quiere abrir en el popup, URL DEBE ESTA PRESENTE EN SU PROYECTO
	ancho = define el ancho de la pagina
	alto = define el alto de la imagen
	full = si full es = a 1, el popup se abrira a pantalla completa.... si es cero o blanco se abrira al tamaño que determina ancho y alto
	centrado = si centrado es = a 1, el popup se centrara en tu pantalla.... si es cero o blanco se abrira en el top de la pantalla
	scrollb= 1 = con popup con scroll...si es cero o blanco estara desabilitado
	resize= 1 popup que se puede agrandar...si es cero o blanco estara desabilitado
	*/
	function popup_configurable(url,ancho,alto,full,centrado,scrollb,resize)
	{
		var popup;
		var left_point;
		var top_point;
		var screen_height 	= screen.height;	/*ENTREGA EL ALTO DE SU PANTALLA*/
		var screen_width 	= screen.width; 	/*ENTREGA EL ANCHO DE SU PANTALLA*/
		
		/*VALIDAMOS SI EL POPUP CONTARA CON PROPIEDADES*/
			if(scrollb!=1){scrollb=0;}
			if(resize!=1){resize=0;}
			
		/*ABRIMOS EL POPUP*/
			popup=window.open(url,"pop","width="+ancho+",height="+alto+",scrollbars="+scrollb+",resizable="+resize);
			popup.focus();
		
		/*VALIDAMOS SI SE DEBE CENTRAR EL POPUP, SINO QUEDARA SIEMPRE EN EL TOP=0 LEFT=0*/
			if(centrado==1)
			{
				ancho	= ancho*1;
				alto	= alto*1;
				left_point = parseInt(screen.availWidth/2.0)-(ancho/2.0);
				top_point = parseInt(screen.availHeight/2.0)-(alto/2.0);
				popup.moveTo(left_point,top_point);
			}
			else{popup.moveTo(0,0);}
			
			
	
			
		/*DEJAMOS EL POPUP FULLSCREAM*/
			if(full==1){popup.resizeTo(parseInt(screen.availWidth),parseInt(screen.availHeight));}
	}    