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


<!--Pop_UP_Galeria***************************************************************************************** -->
<!--******************************************************************************************************* -->


var ventana_pop=false;

function Pop_UP_Galeria(url, ancho, alto, titulo, pie, imagen)
{
	
	if (typeof ventana_pop.document == "object") {ventana_pop.close()}	
	LeftPosition = (screen.width) ? (screen.width-ancho)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-alto)/2 : 0;
	
	destino = "galeria_imagen.php?url=" + url + "&titulo=" + titulo + "&pie=" + pie + "&imagen=" + imagen;
	ventana_pop = window.open(destino, "Imagen", "status = 1, left = " + LeftPosition + ", top = " + TopPosition + ", height = " + alto + ", width = " + ancho + ", resizable = 0" )
	
}

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid)
{
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
	page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
	try {
	page_request = new ActiveXObject("Msxml2.XMLHTTP")
	} 
	catch (e){
	try{
	page_request = new ActiveXObject("Microsoft.XMLHTTP")
	}
	catch (e){}
	}
	}
	else
	return false
	page_request.onreadystatechange=function(){
	loadpage(page_request, containerid)
	}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpage(page_request, containerid)
{
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs()
{
	if (!document.getElementById)
	return
	for (i=0; i<arguments.length; i++)
	{
		var file=arguments[i]
		var fileref=""
		if (loadedobjects.indexOf(file)==-1)
		{ //Check to see if this object has not already been added to page before proceeding
			if (file.indexOf(".js")!=-1)
			{ //If object is a js file
				fileref=document.createElement('script')
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			}
			else if (file.indexOf(".css")!=-1)
			{ //If object is a css file
				fileref=document.createElement("link")
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!=""){
		document.getElementsByTagName("head").item(0).appendChild(fileref)
		loadedobjects+=file+" " //Remember this object as being already added to page
		}
	}
}