<!--Enlaza																									-->
<!--******************************************************************************************************* -->

function enlaza (index)
{
	
	<!-- Definición de variables privadas ***************************** -->
	var bucle;
	p_formid = index;
	
			  
	<!-- Bucle principal ********************************************** -->
	<!-- ************************************************************** -->
	<!-- Recorre un bucle a través de todos los objetos del formulario  -->
	<!-- y activa sus eventos 								   -->
	<!-- ************************************************************** -->
	
	for (bucle=0; bucle < document.forms[index].elements.length; bucle++)
	{
		
		<!-- Cajas de texto ****************************************** -->

		if (document.forms[index].elements[bucle].type == 'text')
		{
			document.forms[index].elements[bucle].onclick = seleccion; 
			document.forms[index].elements[bucle].onblur = lostfocus;
			document.forms[index].elements[bucle].onfocus = gotfocus;
		}
	}
}



<!-- On Blur ****************************************************** -->
<!-- ************************************************************** -->
		
function lostfocus()
{
	
	if (window.event.srcElement.name.split("___")[3] == '1')
	{
		if (window.event.srcElement.value == '')
		{
			window.event.srcElement.className='FRM_Field_Error';
		}
		else
		{
			window.event.srcElement.className='FRM_Field';
		}
	}
	else
	{
		window.event.srcElement.className='FRM_Field';		
	}
}
		

<!-- ************************************************************** -->
<!-- On Focus ***************************************************** -->
<!-- ************************************************************** -->

function gotfocus()
{
	window.event.srcElement.className='FRM_Field_Focus';
}

function seleccion()
{
	window.event.srcElement.focus();
}



<!--Pop_UP 																									-->
<!--******************************************************************************************************* -->

var ventana=false;

function Pop_UP(url, ancho, alto, titulo)
{
	
	if (typeof ventana.document == "object") {ventana.close()}	
	LeftPosition = (screen.width) ? (screen.width-ancho)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-alto)/2 : 0;
	
	destino = "imagen.php?ruta=" + url + "&titulo=" + titulo;
	ventana = window.open(destino, "Imagen", "status = 1, left = " + LeftPosition + ", top = " + TopPosition + ", height = " + alto + ", width = " + ancho + ", resizable = 0" )
}



<!--Muestra Calendario 																					    -->
<!--******************************************************************************************************* -->

var ventanaCalendario=false
var ventanaCatalogo=false

function muestraCalendario(ruta, formulario_destino, campo_destino, fecha_ini, fecha_fin, defecto)
{
	if (typeof ventanaCalendario.document == "object")
	{
		ventanaCalendario.close()
	}
	
	ventanaCalendario = window.open(ruta + "modulo_calendario.php?formulario=" + formulario_destino + "&nomcampo=" + campo_destino + "&fecha_min="+fecha_ini+"&fecha_max="+fecha_fin+"&defecto="+defecto,"calendario","width=300,height=300,left=100,top=100,scrollbars=no,menubars=no,statusbar=NO,status=NO,resizable=YES,location=NO")
}


function solonumeros()
{
	var key=window.event.keyCode;
	
	
	
	if (key < 48 || key > 57)
	{
		if (key != 46 && key != 44)
		{
			window.event.keyCode=0;
		}
	}
}


<!-- Funciones JavaScript ************************************************************************************** -->
function soloprecio()
{
	var key=window.event.keyCode;
	
	
	
	if (key < 48 || key > 57)
	{
		if (key != 46)
		{
			window.event.keyCode=0;
		}
	}
}


function eMovie(pelicula,ancho,alto,as,l)
{
document.write('<embed src="'+pelicula+'" width="'+ancho+'" height="'+alto+'" autostart='+as+' loop='+l+'></embed>');
}


function eFlash(pelicula,variables,ancho,alto,id,wmode,align)
{
	
	if (align!='')
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" align="' + align + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'" title="Men&uacute; de navegaci&oacute;n">');
	}
	else
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ancho+'" height="'+alto+'" title="Men&uacute; de navegaci&oacute;n">');
	}
	
	
	document.write('<param name="movie" value="'+pelicula+'?'+variables+'" />');
	document.write('<param name="quality" value="high" />');
	
	
	if (wmode!='')
	{
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed src="'+pelicula+'?'+variables+'" wmode="transparent" width="'+ancho+'" height="'+alto+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
	}
	else
	{
		document.write('<embed src="'+pelicula+'?'+variables+'" width="'+ancho+'" height="'+alto+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>');
	}
	document.write('</object>');
}
