<!--

function ventanaexpedientes(pagina,llarg,ample,barra){
   var propietats="toolbar=0, location=0, directories=0, menuBar="+barra+", resizable=0, left=25, top=25, scrollbars="+barra+", width="+ample+", height="+llarg;
   window.open(pagina, 'expedientes', propietats);
}


function tabular(tab,nombretab)
{
	for(i=0;i<10;i++)
		{
			num=i+1;
			if(document.getElementById('cont'+nombretab+num))
				{
					document.getElementById('cont'+nombretab+num).className='invisible';
					document.getElementById('link'+nombretab+num).className='noselect';
				}
		}	
	document.getElementById('cont'+tab).className='visible';
	document.getElementById('link'+tab).className='select';
}
function quetab(nombretab)
{
	enviado=location.href.split("#");
	temptab=enviado[1];
	
		
		
		if(document.getElementById('cont'+temptab))
		{
			if(temptab.substr(0,(temptab.length-1))==nombretab)
				{
					tab=temptab;
				}
			else
				{
					tab=nombretab+'1';
				}
		}
		else
		{
			tab=nombretab+'1';
		}
	
	return tab
}

function startab(nombretab)
{
	tabular(quetab(nombretab),nombretab);
}



//Código para asignar a un input oculto llamado accion el valor de 'Borrar'.
//----------------------------------
function BorrarDetalleCarro(i)
{ 
    
	if ( confirm("¿Estas seguro que quieres eliminarlo?") )
		
	{ 
       document.forms.listacesta.borrardetallecarro.value=i;
	   document.forms.listacesta.submit() 
    }
}
//----------------------------------

function BorrarDato(idform,idcampo,idborrar)
{ 
    
	if ( confirm("¿Estas seguro que quieres eliminarlo?") )
		
	{ 
       document.forms[idform].elements[idcampo].value=idborrar;
	   //document.getElementById(idcampo).value=idborrar;
	   document.getElementById(idform).submit() 
    }
}


//Código para asignar a un input oculto llamado accion el valor de 'Borrar'.
//----------------------------------
function BorrarPresupuesto(i)
{ 
    
	if ( confirm("¿Estas seguro que quieres eliminarlo?") )
		
	{ 
       document.forms.listadopresupuestos.borrarpresupuesto.value=i;
	   document.forms.listadopresupuestos.submit() 
    }
}
//----------------------------------

//Código para asignar a un input oculto llamado accion el valor de 'Borrar'.
//----------------------------------
function BorrarRegistroGrid(IDDATOS, TABLA)
{ 
    
	if ( confirm("¿Estas seguro que quieres eliminarlo?") )
		
	{ 
		self.location.href = '?IDDATOS='+IDDATOS+'&TB='+TABLA+'&ACCION=dformulario';
    }
}
//----------------------------------

var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function obtenerValorCampo(nombreCampo){

	//Misión:
	//	Función encargada de devolver el valor de alguno de los campos del formulario.
	//
	//Parámetros entrada:
	//	* nombreCampo : nombre del campo cuyo valor se desea obtener.
	//
	//Parámetros salida:
	//	* Valor del campo.
	
	if (ns6)
		return document.getElementById([nombreCampo]).value;
	else	
		return document.all[nombreCampo].value;
	
}

function establecerValorCampo(nombreCampo, valor){

	//Misión:
	//	Función encargada de establecer el valor de alguno de los campos del formulario.
	//
	//Parámetros entrada:
	//	* nombreCampo : nombre del campo cuyo valor se desea modificar.
	//	* valo : valor que se desea guardar en el campo indicado.
	
	if (ns6)
		document.getElementById([nombreCampo]).value = valor;
	else	
		document.all[nombreCampo].value = valor;
	
	return true;
	
}

function masCantidad(strCampoCantidad, strCampoMultiplo){

	//Misión:
	//	Función encargda de incrementar el número de unidades del artículo indicado.
	//
	//Parámetros entrada:
	//	* strCampoCantidad : nombre del campo que guarda la cantidad actual del artículo 
	//		cuya cantidad se desea incrementar.
	//	* strCampoMultiplo : nombre del campo que guarda el dato 'múltiplo' del artículo
	//		cuya cantidad se desea incrementar.
		

	//Declaración de variables empleadas.
	var lngCantidad; //Cantidad actual del artículo.
	var lngMultiplo; //Valor múltiplo del artículo.
		
	
	//Obtenemos el valor múltiplo del artículo.
	lngMultiplo = Number(obtenerValorCampo(strCampoMultiplo));
	if (lngMultiplo < 1) lngMultiplo = 1;

	//Calculamos la nueva cantidad.	
	lngCantidad = Number(obtenerValorCampo(strCampoCantidad));
	if (lngCantidad < 99)
		establecerValorCampo(strCampoCantidad ,lngCantidad + lngMultiplo);
	
	//Actualizamos la cesta.
	if (x == null){
		x = setTimeout("document.listacesta.submit();", 500);
	}else{
		clearTimeout(x);
		x = setTimeout("document.listacesta.submit();", 500);
	}
	
}

function menosCantidad(strCampoCantidad, strCampoMultiplo){

	//Misión:
	//	Función encargada de decrementar las unidades del artículo indicado.
	//
	//Parámetros entrada:
	//	* strCampoCantidad : campo que guarda la cantidad actual del artículo.
	//	* strCampoMultiplo : campo que guarda el dato múltiplo del artículo.
	
	
	//Declaración de variables empleadas.
	var lngCantidad; //Cantidad actual del artículo.
	var lngMultiplo; //Valor múltiplo del artículo.

	
	//Obtenemos el valor múltiplo del artículo.
	lngMultiplo = Number(obtenerValorCampo(strCampoMultiplo));
	if (lngMultiplo < 1) lngMultiplo = 1;

	//Calculamos la nueva cantidad.
	lngCantidad = Number(obtenerValorCampo(strCampoCantidad));
	if (lngCantidad > 1){
		
		lngCantidad = lngCantidad - lngMultiplo;
		if (lngCantidad < 0) lngCantidad = 0;
	
		establecerValorCampo(strCampoCantidad, lngCantidad);
	}
	
	//Actualizamos la cesta.
	if (x == null){
		x = setTimeout("document.listacesta.submit();", 500);
	}else{
		clearTimeout(x);
		x = setTimeout("document.listacesta.submit();", 500);
	}

}
function ValidaCantidad(cantidad_botellas,objeto_texto){
	var cantidad_modif = objeto_texto.value;
	var division;

	if ( isNaN(cantidad_modif)){
		alert("Debe de introducir una cantidad numérica.");
		objeto_texto.value = cantidad_botellas;
		objeto_texto.focus();
		return false;
	}
	division = cantidad_modif/cantidad_botellas;
	division = new String(division);
	// Comprobamos que ha introducido una cantidad múltiplo de la  cantidad de embalaje
	if ( !isInt(division)){
		alert("La cantidad del producto deber ser múltiplo de "+ cantidad_botellas + ".");
		objeto_texto.focus();
		return false;
	}
}
function actualizar()		{
	document.listacesta.submit();
}
var x;



//##################################### Para ver imagenes en popup #############################


var offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var currentimageheight = 650;	// maximum image size.

if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
}

function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function showtrail(imagename,title,description,showthumb,height){

	if (height > 0){
		currentimageheight = height;
	}

	document.onmousemove=followmouse;

	newHTML = '<div id=ventanaimagen><div style="padding: 5px; background-color: #FFF; border: 1px solid #888;">';
	newHTML = newHTML + '<div id=titulo><font>' + title + '</font></div>';
	newHTML = newHTML + description + '<br/>';

	if (showthumb > 0){
		newHTML = newHTML + '<div align="center" style="padding: 8px 2px 2px 2px;"><img src="' + imagename + '" border="0"></div>';
	}

	newHTML = newHTML + '</div></div>';

	gettrailobjnostyle().innerHTML = newHTML;

	gettrailobj().visibility="visible";

}
function gettrailobj2(){
if (document.getElementById)
return document.getElementById("popup").style
else if (document.all)
return document.all.trailimagid.style
}
function gettrailobjnostyle2(){
if (document.getElementById)
return document.getElementById("popup")
else if (document.all)
return document.all.trailimagid
}

function showtrail2(url){

	document.onmousemove=followmouse2;
	ocultarselects();
	abrircontenidoajax(url);
	document.getElementById('popup').style.width="500px";
	gettrailobj2().visibility="visible";

}
function gettrailobj3(){
if (document.getElementById)
return document.getElementById("popup").style
else if (document.all)
return document.all.trailimagid.style
}
function gettrailobjnostyle3(){
if (document.getElementById)
return document.getElementById("popup")
else if (document.all)
return document.all.trailimagid
}
function showtrail3(imagename,title,description,showthumb,height){

	if (height > 0){
		currentimageheight = height;
	}
	document.getElementById('popup').style.width="200px";
	document.onmousemove=followmouse3;

	newHTML = ' ';
	newHTML = newHTML + '<div id=titulo><font>' + title + '</font></div>';
	newHTML = newHTML + '<div id=texto><font>' +description + '</font></div><br/>';

	if (showthumb > 0){
		newHTML = newHTML + '<div align="center" style="padding: 8px 2px 2px 2px;"><img src="' + imagename + '" border="0"></div>';
	}

	newHTML = newHTML + ' ';

	gettrailobjnostyle3().innerHTML = newHTML;

	gettrailobj3().visibility="visible";

}
function hidetrail3(){
	gettrailobj3().visibility="hidden"
	document.onmousemove=""
	gettrailobj3().left="-500px"
	gettrailobjnostyle3().innerHTML="<br/><br/><br/><div align='center'><img src='../Imagenes/cargando.gif'/></div><br/><br/><br/>";
}

function hidetrail2(){
	gettrailobj2().visibility="hidden"
	document.onmousemove=""
	gettrailobj2().left="-500px"
	mostrarselects();
	document.getElementById('popup').style.width="300px";
	gettrailobjnostyle2().innerHTML="<br/><br/><br/><div align='center'><img src='../Imagenes/cargando.gif'/></div><br/><br/><br/>";
}


function hidetrail(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-500px"
	gettrailobjnostyle().innerHTML="<br/><br/><br/><div align='center'><img src='../Imagenes/cargando.gif'/></div><br/><br/><br/>";

}

function followmouse3(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}
	
	//
	
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 200){
			xcoord = e.pageX - xcoord - 200; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 20)){
			ycoord += e.pageY - Math.max(0,(20 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 200){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 200; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 20)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(20 + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj3().left=xcoord+"px"
	gettrailobj3().top=ycoord+"px"

}

function followmouse2(e){
var offsetfrommouse=[15,25]; 
//image x,y offsets from cursor position in pixels. Enter 0,0 for no offsetvar 
displayduration=5; 
//duration in seconds image should remain visible. 0 for always.var 
defaultimageheight = 300;   // maximum image size.var 
defaultimagewidth = 500;   // maximum image size.
var xcoord=offsetfrommouse[0]   
var ycoord=offsetfrommouse[1]   
var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15   
var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)   
if (typeof e != "undefined"){
      if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){    
	  xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor    
	  } else {         xcoord += e.pageX;      }     
	  if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){ 
	  ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));      } else {         ycoord += e.pageY;      }  
	  } else if (typeof window.event != "undefined"){      if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){     
	  xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor    
	  } else {         xcoord += truebody().scrollLeft+event.clientX      }     
	  if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
	  ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));    
	  } else {         ycoord += truebody().scrollTop + event.clientY;      } 
	  }

	gettrailobj2().left=xcoord+"px"
	gettrailobj2().top=ycoord+"px"

}
function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}
	
	//
	
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 380){
			xcoord = e.pageX - xcoord - 650; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 210)){
			ycoord += e.pageY - Math.max(0,(210 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 380){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 650; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 210)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(210 + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}

//Ocultar selects, embeds y objetos
function ocultarselects()
{
	var selectElems=document.getElementsByTagName('select');
	for(var i = 0; i < selectElems.length; ++i) 
	{
		selectElems[i].style.visibility = 'hidden';
	}
	var objectElems=document.getElementsByTagName('object');
	for(var i = 0; i < objectElems.length; ++i) 
	{
		objectElems[i].style.visibility = 'hidden';
	}
	var embedElems=document.getElementsByTagName('embed');
	for(var i = 0; i < embedElems.length; ++i) 
	{
		embedElems[i].style.visibility = 'hidden';
	}
}
//mostrar selects, embeds y objetos
function mostrarselects()
{
	var selectElems=document.getElementsByTagName('select');
	for(var i = 0; i < selectElems.length; ++i) 
	{
		selectElems[i].style.visibility = 'visible';
	}
	var objectElems=document.getElementsByTagName('object');
	for(var i = 0; i < objectElems.length; ++i) 
	{
		objectElems[i].style.visibility = 'visible';
	}
	var embedElems=document.getElementsByTagName('embed');
	for(var i = 0; i < embedElems.length; ++i) 
	{
		embedElems[i].style.visibility = 'visible';
	}
}

//averiguar el ancho y alto del navegador
function getViewportSize() { 
var x, y; 
if (self.innerHeight) { // MOS 
y = self.innerHeight; 
x = self.innerWidth; 
} else if (document.documentElement && document.documentElement.clientWidth) { // IE6 Strict 
x = document.documentElement.clientWidth; 
y = document.documentElement.clientHeight; 
} else if (document.body.clientHeight) { // IE quirks 
y = document.body.clientHeight; 
x = document.body.clientWidth; 
} 
return {x: x, y: y}; 
} //getViewportSize().x para visualizar


function Borrar(i)
{ 
    
	if ( confirm("¿Estas seguro que quieres eliminarlo?") )
		
	{ 
       document.forms.formulario.idborrar.value=i;
	   document.forms.formulario.submit() 
    }
}
function Verificar(i)
{ 
    
	if ( confirm("¿Estas seguro que quieres Verificarlo?") )
		
	{ 
       document.forms.formulario.verificar.value=i;
	   document.forms.formulario.submit() 
    }
}
function Editar(i)
{ 
       document.forms.formulario.ideditar.value=i;
	   document.forms.formulario.submit() 
}
function Editar2(i,c)
{ 
       document.forms.formulario.ideditar.value=i;
       document.forms.formulario.comodin.value=c;
	   document.forms.formulario.submit() 
}
function Nuevo()
{ 
       document.forms.formulario.nuevo.value=1;
	   document.forms.formulario.submit() 
}
function IndiceUp(i)
{ 
       document.forms.formulario.idup.value=i;
	   document.forms.formulario.submit() 
}
function IndiceDown(i)
{ 
       document.forms.formulario.iddown.value=i;
	   document.forms.formulario.submit() 
}


function abrirventanaajax(url,id){
	ocultarselects();
	espacio=(getViewportSize().x-700)/2;
	if (document.getElementById)
	{
		document.getElementById("ventanaajax").className='ventanacentro';
		document.getElementById('ventanaajax').style.left=espacio;
		document.getElementById('tapar').className='fondotodo';
		document.getElementById('tapar').style.height=document.getElementById('todo2').offsetHeight;
		abrirurlajax(url,id);
		
		//document.getElementById('ventanaajax').innerHTML=buscador;
	}
	else if (document.all)
	{
		document.all.ventanaajax
		document.all.ventanaajax.className='ventanacentro';
		document.all.ventanaajax.style.left=espacio;
		document.all.tapar.className='fondotodo';
		document.all.tapar.height=document.all.body.height;
		abrirurlajax(url,id);
		//document.all.ventanaajax.innerHTML=buscador;
	}
}
function cerrarventana()
	{
		mostrarselects();
		if (document.getElementById)
		{
			document.getElementById('ventanaajax').className='invisible';
			document.getElementById('tapar').className='invisible';
		}
		else if (document.all)
		{
			document.all.ventanaajax.className='invisible';
			document.all.tapar.className='invisible';
		}
	}
function cerrarventanaadmin()
	{
		mostrarselects();
		if (document.getElementById)
		{
			document.getElementById('ventanaajax').className='invisible';
			document.getElementById('tapar').className='invisible';
		}
		else if (document.all)
		{
			document.all.ventanaajax.className='invisible';
			document.all.tapar.className='invisible';
		}
		location.reload(false);
	}
function abrirurlajax(url,id)
	{// obtener contenido del buscador
	
	if (window.XMLHttpRequest)
	{
	var req3=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
	var req3=new ActiveXObject("Microsoft.XMLHTTP");
	}
		req3.open("GET",url + "?ID="+id,false);
		req3.send(null);
	
		if (document.getElementById)
		{
		document.getElementById('ventanaajax').innerHTML=req3.responseText;
		}
		else if(document.all)
		{
		document.all.ventanaajax.innerHTML=req3.responseText;
		}
	}

function mostrar123(nombre)
{
	if (document.getElementById)
	{
		document.getElementById('1_'+nombre).className='invisible';
		document.getElementById('2_'+nombre).className='visible';
		document.getElementById('3_'+nombre).className='visible';
	}
}
function ocultar123(nombre)
{
	if (document.getElementById)
	{
		document.getElementById('1_'+nombre).className='visible';
		document.getElementById('2_'+nombre).className='invisible';
		document.getElementById('3_'+nombre).className='invisible';
	}
}	

/* ######################   Calendario ##########################  */

	// Flooble Dynamic  Calendar. 
	// Copyright (c) 2004 by Animus Pactum Consulting Inc.
	//---------------------------------------------------------------------
	// You may use this code freely on your site as long as you do not make
	// modifications to it other than editing the stylesheet settings to 
	// make it fit your design. You may not remove this notice or any links
	// to flooble.com.
	// More information about this script is available at
	//    http://www.flooble.com/scripts/calendar.php
	//--Global Stuff-------------------------------------------------------
	var fc_ie = false;
	if (document.all) { fc_ie = true; }
	
	var calendars = Array();
	var fc_months = Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
	var fc_openCal;

	var fc_calCount = 0;
	
	function getCalendar(fieldId) {
		return calendars[fieldId];
	}
	
	function displayCalendarFor(fieldId) {
		var formElement = fc_getObj(fieldId);
		displayCalendar(formElement);
	}
	
	function displayCalendar(formElement) {
		if (!formElement.id) {
			formElement.id = fc_calCount++;
		} 
		var cal = calendars[formElement.id];
		if (typeof(cal) == 'undefined') {
			cal = new floobleCalendar();
			cal.setElement(formElement);
			calendars[formElement.id] = cal;
		}
		if (cal.shown) {
			cal.hide();
		} else {
			cal.show();
		}
	}
	
	function display3FieldCalendar(me, de, ye) {
		if (!me.id) { me.id = fc_calCount++; }
		if (!de.id) { de.id = fc_calCount++; }
		if (!ye.id) { ye.id = fc_calCount++; }
		var id = me.id + '-' + de.id + '-' + ye.id;
		var cal = calendars[id];
		if (typeof(cal) == 'undefined') {
			cal = new floobleCalendar();
			cal.setElements(me, de, ye);
			calendars[id] = cal;
		}
		if (cal.shown) {
			cal.hide();
		} else {
			cal.show();
		}
	}

	//--Class Stuff--------------------------------------------------
	function floobleCalendar() {
		// Define Methods
		this.setElement = fc_setElement;
		this.setElements = fc_setElements;
		this.parseDate = fc_parseDate;
		this.generateHTML = fc_generateHTML;
		this.show = fc_show;
		this.hide = fc_hide;
		this.moveMonth = fc_moveMonth;
		this.setDate = fc_setDate;
		this.formatDate = fc_formatDate;
		this.setDateFields = fc_setDateFields;
		this.parseDateFields = fc_parseDateFields;
		
		this.shown = false;
	}
	
	function fc_setElement(formElement) {
		this.element = formElement;
		this.format = this.element.title;
		this.value = this.element.value;
		this.id = this.element.id;
		this.mode = 1;
	}
	
	function fc_setElements(monthElement, dayElement, yearElement) {
		this.mElement = monthElement;
		this.dElement = dayElement;
		this.yElement = yearElement;
		this.id = this.mElement.id + '-' + this.dElement.id + '-' + this.yElement.id;
		this.element = this.mElement;
		if (fc_absoluteOffsetLeft(this.dElement) < fc_absoluteOffsetLeft(this.element)) {
			this.element = this.dElement;
		}
		if (fc_absoluteOffsetLeft(this.yElement) < fc_absoluteOffsetLeft(this.element)) {
			this.element = this.yElement;
		}
		if (fc_absoluteOffsetTop(this.mElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.mElement;
		}
		if (fc_absoluteOffsetTop(this.dElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.dElement;
		}
		if (fc_absoluteOffsetTop(this.yElement) > fc_absoluteOffsetTop(this.element)) {
			this.element = this.yElement;
		}

		this.mode = 2;
	}
	
	function fc_parseDate() {
		if (this.element.value) {
			this.date = new Date();
			var out = '';
			var token = '';
			var lastCh, ch;
			var start = 0;
			lastCh = this.format.substring(0, 1);
			for (i = 0; i < this.format.length; i++) {
				ch = this.format.substring(i, i+1);
				if (ch == lastCh) { 
					token += ch;
				} else {
					fc_parseToken(this.date, token, this.element.value, start);
					start += token.length;
					token = ch;
				}
				lastCh = ch;
			}
			fc_parseToken(this.date, token, this.element.value, start);
		} else {
			this.date = new Date();
		}
		if ('' + this.date.getMonth() == 'NaN') {
			this.date = new Date();
		}
	}	
	
	function fc_parseDateFields() {
		this.date = new Date();
		if (this.mElement.value) this.date.setMonth(fc_getFieldValue(this.mElement) - 1);
		if (this.dElement.value) this.date.setDate(fc_getFieldValue(this.dElement));
		if (this.yElement.value) this.date.setFullYear(fc_getFieldValue(this.yElement));
		if ('' + this.date.getMonth() == 'NaN') {
			this.date = new Date();
		}
	}
	
	function fc_setDate(d, m, y) {
		this.date.setYear(y);
		this.date.setMonth(m);
		this.date.setDate(d);
		if (this.mode == 1) {
			this.element.value = this.formatDate();
		} else {
			this.setDateFields();
		}
		this.hide();
	}
	
	function fc_setDateFields() {
		fc_setFieldValue(this.mElement, fc_zeroPad(this.date.getMonth() + 1));
		fc_setFieldValue(this.dElement, fc_zeroPad(this.date.getDate()));
		fc_setFieldValue(this.yElement, this.date.getFullYear());
	}
	
	function fc_formatDate() {
		var out = '';
		var token = '';
		var lastCh, ch;
		lastCh = this.format.substring(0, 1);
		for (i = 0; i < this.format.length; i++) {
			ch = this.format.substring(i, i+1);
			if (ch == lastCh) { 
				token += ch;
			} else {
				out += fc_formatToken(this.date, token);
				token = ch;
			}
			lastCh = ch;
		}
		out += fc_formatToken(this.date, token);
		return out;
	}
	
	function fc_show() {
		if (typeof(fc_openCal) != 'undefined') { fc_openCal.hide(); }
	
		if (this.mode == 1) {
			this.parseDate();
		} else {
			this.parseDateFields();
		}
		this.showDate = new Date(this.date.getTime());
		if (typeof(this.div) != 'undefined') {
			this.div.innerHTML = this.generateHTML();
		}
		
		if (typeof(this.div) == 'undefined') {
			this.div = document.createElement('DIV');
			this.div.style.position = 'absolute';
			this.div.style.display = 'none';
			this.div.className = 'fc_main';
			this.div.innerHTML = this.generateHTML();
			this.div.style.left = fc_absoluteOffsetLeft(this.element);
			this.div.style.top = fc_absoluteOffsetTop(this.element) + this.element.offsetHeight + 1;
			document.body.appendChild(this.div);
		}
		this.div.style.display = 'block';
		this.shown = true;
		fc_openCal = this;
	}
	
	function fc_generateHTML() {
		var html = '<TABLE><TR><TD CLASS="fc_head" COLSPAN="6"><DIV STYLE="float: right"><a class="fc_head" href="http://www.flooble.com/scripts/calendar.php" target="_blank">©</a></DIV>CALENDAR:</TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').hide();"><B>X</B></TD></TR>';
		html += '<TR><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(-12);"><B><<</B></TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(-1);"><B><</B></TD><TD COLSPAN="3" CLASS="fc_wk">' + fc_months[this.showDate.getMonth()] + ' ' + fc_getYear(this.showDate) + '</TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(1);"><B>></B></TD><TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').moveMonth(12);"><B>>></B></TD></TR>';
		html += '<TR><TD WIDTH="14%" CLASS="fc_wk">Mo</TD><TD WIDTH="14%" CLASS="fc_wk">Tu</TD><TD WIDTH="14%" CLASS="fc_wk">We</TD><TD WIDTH="14%" CLASS="fc_wk">Th</TD><TD WIDTH="14%" CLASS="fc_wk">Fr</TD><TD class="fc_wknd" WIDTH="14%">Sa</TD><TD class="fc_wknd" WIDTH="14%">Su</TD></TR>';
		html += '<TR>';
		var dow = 0;
		var i, style;
		var totald = fc_monthLength(this.showDate);
		for (i = 0; i < fc_firstDOW(this.showDate); i++) {
			dow++;
			html += '<TD> </TD>';
		}
		for (i = 1; i <= totald; i++) {
			if (dow == 0) { html += '<TR>'; }
			if (this.showDate.getMonth() == this.date.getMonth() && this.showDate.getYear() == this.date.getYear() && this.date.getDate() == i) { 
				style = ' style="font-weight: bold;"';
			} else {
				style = '';
			}
			html += '<TD CLASS="fc_date" onMouseover="this.className = \'fc_dateHover\';" onMouseout="this.className=\'fc_date\';" onClick="getCalendar(\'' + this.id + '\').setDate(' + i + ', ' + this.showDate.getMonth() + ', ' + this.showDate.getFullYear() + ');" ' + style + '>' + i + '</TD>';
			dow++;
			if (dow == 7) {
				html += '</TR>';
				dow = 0;
			}
		}
		if (dow != 0) {
			for (i = dow; i < 7; i++) {
				html += '<TD> </TD>';
			}
		}
		html +='</TR>';
		html += '</TABLE>';
		return html;
	}
	
	function fc_hide() {
		if (this.div != false) {
			this.div.style.display = 'none';
		}
		this.shown = false;
		fc_openCal = undefined;
	}
	
	function fc_moveMonth(amount) {
		var m = this.showDate.getMonth();
		var y = fc_getYear(this.showDate);
		if (amount == 1)  {
			if (m == 11)  {
				this.showDate.setMonth(0);
				this.showDate.setYear(y + 1);
			} else {
				this.showDate.setMonth(m + 1);
			}
		} else if (amount == -1)  {
			if (m == 0)  {
				this.showDate.setMonth(11);
				this.showDate.setYear(y - 1);
			} else {
				this.showDate.setMonth(m - 1);
			}
		} else if (amount == 12) {
			this.showDate.setYear(y + 1);
		} else if (amount == -12) {
			this.showDate.setYear(y - 1);
		}
		this.div.innerHTML = this.generateHTML();
	}
	
	//--Utils-------------------------------------------------------------
	function fc_absoluteOffsetTop(obj) {
     	var top = obj.offsetTop;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		top += parent.offsetTop;
     		parent = parent.offsetParent;
     	}
     	return top;
     }
     
     function fc_absoluteOffsetLeft(obj) {
     	var left = obj.offsetLeft;
     	var parent = obj.offsetParent;
     	while (parent != document.body) {
     		left += parent.offsetLeft;
     		parent = parent.offsetParent;
     	}
     	return left;
     }
     
     function fc_firstDOW(date) {
     	var dow = date.getDay();
     	var day = date.getDate();
 		if (day % 7 == 0) return dow;
     	return (7 + dow - (day % 7)) % 7; 
     }
     
     function fc_getYear(date) {
     	var y = date.getYear();
     	if (y > 1900) return y;
     	return 1900 + y;
     }
     
     function fc_monthLength(date) {
		var month = date.getMonth();
		var totald = 30;
		if (month == 0 
			|| month == 2
			|| month == 4
			|| month == 6
			|| month == 7
			|| month == 9
			|| month == 11) totald = 31;
		if (month == 1) {
			var year = date.getYear();
			if (year % 4 == 0 && (year % 400 == 0 || year % 100 != 0))
		 		totald = 29;
			else
				totald = 28;
		}
		return totald;
     }
     
     function fc_formatToken(date, token) {
		var command = token.substring(0, 1);
		if (command == 'y' || command == 'Y') {
			if (token.length == 2) { return fc_zeroPad(date.getFullYear() % 100); }
			if (token.length == 4) { return date.getFullYear(); } 
		}
		if (command == 'd' || command == 'D') {
			if (token.length == 2) { return fc_zeroPad(date.getDate()); }
		}
		if (command == 'm' || command == 'M') {
			if (token.length == 2) { return fc_zeroPad(date.getMonth() + 1); }
			if (token.length == 3) { return fc_months[date.getMonth()]; } 
		}
		return token;
     }
     
     function fc_parseToken(date, token, value, start) {
		var command = token.substring(0, 1);
		var v;
		if (command == 'y' || command == 'Y') {
			if (token.length == 2) { 
				v = value.substring(start, start + 2);
				if (v < 70) { date.setFullYear(2000 + parseInt(v)); } else { date.setFullYear(1900 + parseInt(v)); } 
			}
			if (token.length == 4) { v = value.substring(start, start + 4); date.setFullYear(v);} 
		}
		if (command == 'd' || command == 'D') {
			if (token.length == 2) { v = value.substring(start, start + 2); date.setDate(v); }
		}
		if (command == 'm' || command == 'M') {
			if (token.length == 2) { v = value.substring(start, start + 2); date.setMonth(v - 1); }
			if (token.length == 3) { 
				v = value.substring(start, start + 3);
				var i;
				for (i = 0; i < fc_months.length; i++) {
					if (fc_months[i].toUpperCase() == v.toUpperCase()) { date.setMonth(i); }
				}
			} 
		}
     }
     
     function fc_zeroPad(num) {
		if (num < 10) { return '0' + num; }
		return num;
     }

	function fc_getObj(id) {
		if (fc_ie) { return document.all[id]; } 
		else { return document.getElementById(id);	}
	}

      function fc_setFieldValue(field, value) {
                if (field.type.substring(0,6) == 'select') {
                        var i;
                        for (i = 0; i < field.options.length; i++) {
                                if (fc_equals(field.options[i].value, value)) {
                                        field.selectedIndex = i;
                                }
                        }
                } else {
                        field.value = value;
                }
      }

      function fc_getFieldValue(field) {
                if (field.type.substring(0,6) == 'select') {
                        return field.options[field.selectedIndex].value;
                } else {
                        return field.value;
                }
      }
      
      function fc_equals(val1, val2) {
      		if (val1 == val2) return true;      		
      		if (1 * val1 == 1 * val2) return true;
      		return false;
      }
     
     
	 /*###########################################################################*/
	 /*###########  ABRIR UNA Página en AJAX ################################################*/
	 
	 
	 function abrircontenidoajax(url,nombreobjeto) {

        http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // Ver nota sobre esta linea al final
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Falla :( No es posible crear una instancia XMLHTTP');
            return false;
        }
        http_request.onreadystatechange = alertContents;
        http_request.open('GET', url, true);
        http_request.send(null);
    }

    function alertContents() {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
              gettrailobjnostyle2().innerHTML=http_request.responseText;
			
            } else {
                alert('Hubo problemas con la petición.');
            }
        }

    }

function xGetElementById(e) {
  if(typeof(e)!="string") return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}

function ocultar(nombre)
{
	xGetElementById(nombre).className='invisible';
}
function mostrar(nombre)
{
	xGetElementById(nombre).className='visible';
}
function cambiarclase(nombre,clase)
{
		xGetElementById(nombre).className=clase;
}


function comp_mail(texto){

    var mailres = true;            
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-";
    
    var arroba = texto.indexOf("@",0);
    if ((texto.lastIndexOf("@")) != arroba) arroba = -1;
    
    var punto = texto.lastIndexOf(".");
                
     for (var contador = 0 ; contador < texto.length ; contador++){
        if (cadena.indexOf(texto.substr(contador, 1),0) == -1){
            mailres = false;
            break;
     }
    }

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1))
     mailres = true;
    else
     mailres = false;
                
   return mailres;
}

     
   function MailLink (usuario, dominio, tld, texto) {  
    //codifica los caracteres mas significativos  
   var arroba = '@'  
    var punto = '.'  
     
    //utiliza variables para ocultar las palabras clave  
    var etiqueta = 'ma' + '' + 'il'  
    var dospuntos = 'to:'  
    var localizador = usuario  
    localizador = localizador + arroba + dominio  
    localizador = localizador + punto + tld  
     
    //escribe en enlace  
    document.write('<a href="' + etiqueta + dospuntos + localizador + '">' + texto + '</a>')  
   }  

   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   /////////* inicio formulario contacto */
	// MOSTRAR FORMULARIO
	if(navigator.appName == "Netscape"){
		function mostrar_ocultar(){
			if(urlActual().match("contacto") != null || urlActual().match("informacion-de-contacto") != null || urlActual().match("ayuda-y-soporte") != null || urlActual().match("diseno-web") != null || urlActual().match("dominios-tel") != null){
				cargarVacio();
				document.location.href="/corporativo/contacto";
				return;
			}
			
			maxInterval=0;
			minInterval=0;
			if(document.getElementById('micontactoform').style.display == "none"){
				opfx = 0.1;
				document.getElementById('micontactoform').style.opacity = opfx;
				document.getElementById('micontactoform').style.display = "";
				maxInterval=window.setInterval("maxOpacidad()", 100);
			}else{
				opfx = 1;
				minInterval=window.setInterval("minOpacidad()", 100);
			}
			
		}
		function maxOpacidad(){
			if(opfx <= 1){
				opfx = opfx + 0.25;
				document.getElementById('micontactoform').style.opacity = opfx;
			}else{
				maxInterval=window.clearInterval(maxInterval);
			}
		}
		function minOpacidad(){
			if(opfx >= 0){
				opfx = opfx - 0.25;
				document.getElementById('micontactoform').style.opacity = opfx;
			}else{
				minInterval=window.clearInterval(minInterval);
				document.getElementById('micontactoform').style.display="none";
			}
		}
	} // if Netscape
	if(navigator.appName == "Microsoft Internet Explorer"){
		function mostrar_ocultar(){
			if(urlActual().match("contacto") != null || urlActual().match("informacion-de-contacto") != null || urlActual().match("ayuda-y-soporte") != null || urlActual().match("diseno-web") != null || urlActual().match("dominios-tel") != null){
				cargarVacio();
				document.location.href="/corporativo/contacto";
				return;
			}

			cadena_version = navigator.appVersion;
			pos_version = navigator.appVersion.indexOf("MSIE");
			cadena_version = cadena_version.substr(pos_version,8);
			version = cadena_version.substr(5,3);
			if(version == "8.0"){ // sin efecto Alpha // Explorer 8.0
				if(document.getElementById('micontactoform').style.display == "none"){
					document.getElementById('micontactoform').style.display = "";
				}else{
					document.getElementById('micontactoform').style.display = "none";
				}
			}else{
				maxInterval=0;
				minInterval=0;
				if(document.getElementById('micontactoform').style.display == "none"){
					opie = 10;
					document.getElementById("micontactoform").filters.item("DXImageTransform.Microsoft.Alpha").Opacity = opie;
					document.getElementById('micontactoform').style.display = "";
					maxInterval=window.setInterval("maxOpacidad()", 100);
				}else{
					opie = 100;
					minInterval=window.setInterval("minOpacidad()", 100);
				}
			}
		}
		function maxOpacidad(){
			if(opie <= 100){
				opie = opie + 25;
				document.getElementById("micontactoform").filters.item("DXImageTransform.Microsoft.Alpha").Opacity = opie;
			}else{
				maxInterval=window.clearInterval(maxInterval);
			}
		}
		function minOpacidad(){
			if(opie >= 0){
				opie = opie - 25;
				document.getElementById("micontactoform").filters.item("DXImageTransform.Microsoft.Alpha").Opacity = opie;
			}else{
				minInterval=window.clearInterval(minInterval);
				document.getElementById('micontactoform').style.display="none";
			}
		}
	} // Explorer 6.0 - 7.0
	// FIN MOSTRAR FORMULARIO
	
	// rollovers campos formulario
	function over(id){
		document.getElementById(id).style.background="#fff";
		document.getElementById(id).style.color="#3e8313";
	}
	function out(id){
		document.getElementById(id).style.background="#e0e0e0";
		document.getElementById(id).style.color="#666";
	}
	// fin rollovers campos formulario
	
	// vaciar campos al pulsar en ellos y llenarlos al soltarlos vacios
	function vaciar(id){
		switch (id){
			case "nombre":
				if(document.getElementById(id).value == "Nombre y Apellidos...")document.getElementById(id).value="";
				break;
			case "email":
				if(document.getElementById(id).value == "Email...")document.getElementById(id).value="";
				break;
			case "telefono":
				if(document.getElementById(id).value == "Teléfono...")document.getElementById(id).value="";
				break;
			case "empresa":
				if(document.getElementById(id).value == "Empresa...")document.getElementById(id).value="";
				break;
			case "provincia":
				if(document.getElementById(id).value == "Provincia...")document.getElementById(id).value="";
				break;
			case "cargo":
				if(document.getElementById(id).value == "Cargo...")document.getElementById(id).value="";
				break;
			
			
			case "form_email_alta":
				if(document.getElementById(id).value == "Email...")document.getElementById(id).value="";
				break;
			case "form_email_baja":
				if(document.getElementById(id).value == "Email...")document.getElementById(id).value="";
				break;
		}
		//document.getElementById(id).value="";
	}
	function llenar(id,valor){
		if(document.getElementById(id).value==""){
			document.getElementById(id).value=valor;
		}
	}
	// fin vaciar campos al pulsar en ellos y llenarlos al soltarlos vacios
	
	function ValidarForm(form) {
		var form = document.forms[form.id];
		var errors='';
		var nom = form.nombre.value;
		var com = form.comentarios.value;
		var nom_valido=nom.match(/[^a-zA-Z áéíóúüÁÉÍÓÚÜÑñÇç·.]/);
		var com_valido=com.match(/[^a-zA-Z0-9 áéíóúüÁÉÍÓÚÜÑñÇç·.()-_\n][\n]/);
		
		if (form.nombre.value == "" || nom_valido != null || form.nombre.value == "Nombre y Apellidos..."){
			document.getElementById("f_nombre").style.background = "#fec141";
			errors = true;
		}else{
			document.getElementById("f_nombre").style.background = "";
		}
		if ((form.email.value == "")||(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.email.value)))){
			document.getElementById("f_email").style.background = "#fec141";
			errors = true;
		}else{
			document.getElementById("f_email").style.background = "";
		}
		if (form.telefono.value == ""){
			document.getElementById("f_telefono").style.background = "#fec141";
			errors = true;
		}else{
			// Puede empezar con + o con un numero
			elemOk1 = form.telefono.value.substr(0,1) == "+" || !isNaN(form.telefono.value.substr(0,1));
			// Tiene entre 9 y 20 caracteres
			elemOk2 = form.telefono.value.length >= 9 && form.telefono.value.length <= 20;
			// Todos los caracteres son numeros excepto el primero que podia ser un +
			for(j=1;j<form.telefono.value.length;j++){
				if(form.telefono.value.substr(j,1) == " " || !isNaN(form.telefono.value.substr(j,1))){
					elemOk3 = true;
				}else{
					elemOk3	= false;
					break;
				}
			}
			elemOk = elemOk1 && elemOk2 && elemOk3;
		}
		if (!elemOk) {
			document.getElementById("f_telefono").style.background = "#fec141";
			errors = true;
		} else {
			document.getElementById("f_telefono").style.background = "";
		}
			
		
		if (form.provincia.value == "" || form.provincia.value == "Provincia..."){
			document.getElementById("f_provincia").style.background = "#fec141";
			errors = true;
		}else{
			document.getElementById("f_provincia").style.background = "";
		}
		if ((form.comentarios.value == "")||(com_valido != null)){
			document.getElementById("f_comentarios").style.background = "#fec141";
			document.getElementById("f_comentarios").style.color = "#ffffff";
			errors = true;
		}else{
			document.getElementById("f_comentarios").style.background = "";
			document.getElementById("f_comentarios").style.color = "";
		}
		
		if (form.acepta.checked == false){
			document.getElementById("f_acepta").style.background = "#fec141";
			document.getElementById("f_acepta").style.color = "#ffffff";
			errors = true;
		}else{
			document.getElementById("f_acepta").style.background = "";
			document.getElementById("f_acepta").style.color = "";
		}

		if (errors) {
			return false;
		}else{
			cargarContenidoContactoOk(form);
		}
	}
	function nuevoAjax(){
		var xmlhttp=false;
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		}
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		return xmlhttp;
	}
	function cargarContenidoContactoOk(form){
	
		t2 = document.getElementById("nombre").value;
		t3 = document.getElementById("email").value;
		t4 = document.getElementById("telefono").value;
		t5 = document.getElementById("empresa").value;
		t6 = document.getElementById("provincia").value;
		t7 = document.getElementById("comentarios").value;
		t14 = form.acepta.checked;
		t15 = document.getElementById("formulario").value;
		if(document.getElementById("formulario").value == "Cabecera"){
			id = document.getElementById('contaj_cab');
		}else{
			id = document.getElementById('contaj');
			if(document.getElementById("formulario").value == "Legal"){
				t16 = document.getElementById("cargo").value;
				t17 = form.chk_mcomunitaria.checked;
				t18 = form.chk_mnacional.checked;
				t19 = form.chk_minternacional.checked;
				t20 = form.chk_pdatos.checked;
				t21 = form.chk_psoftware.checked;
				t22 = form.chk_pweb.checked;
				t23 = form.chk_auditoria.checked;
			}else if(document.getElementById("formulario").value == "Dominios tel"){
				t16 = document.getElementById("dominio").value;
			}
		}
		ajax=nuevoAjax();
		ajax.open("POST", "/marketing/formContactHome/f_contactoOk.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				id.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; text/html; charset=iso-8859-1");
		
		if(document.getElementById("formulario").value == "Legal"){
			ajax.send("motivo="+t1+"&nombre="+t2+"&email="+t3+"&telefono="+t4+"&empresa="+t5+"&provincia="+t6+"&comentarios="+t7+"&codigo="+t8+"&agente="+t9+"&seccion="+t10+"&idioma="+t11+"&charset="+t12+"&dpto="+t13+"&acepta="+t14+"&formulario="+t15+"&cargo="+t16+"&chk_mcomunitaria="+t17+"&chk_mnacional="+t18+"&chk_minternacional="+t19+"&chk_pdatos="+t20+"&chk_psoftware="+t21+"&chk_pweb="+t22+"&chk_auditoria="+t23);
		}else if(document.getElementById("formulario").value == "Dominios tel"){
			ajax.send("motivo="+t1+"&nombre="+t2+"&email="+t3+"&telefono="+t4+"&empresa="+t5+"&provincia="+t6+"&comentarios="+t7+"&codigo="+t8+"&agente="+t9+"&seccion="+t10+"&idioma="+t11+"&charset="+t12+"&dpto="+t13+"&acepta="+t14+"&formulario="+t15+"&dominio="+t16);
		}else{
			ajax.send("motivo="+t1+"&nombre="+t2+"&email="+t3+"&telefono="+t4+"&empresa="+t5+"&provincia="+t6+"&comentarios="+t7+"&codigo="+t8+"&agente="+t9+"&seccion="+t10+"&idioma="+t11+"&charset="+t12+"&dpto="+t13+"&acepta="+t14+"&formulario="+t15);
		}
		
	}
	function cargarContenidoContactoError(){
		t1 = document.getElementById("motivo").value;
		t2 = document.getElementById("nombre").value;
		t3 = document.getElementById("email").value;
		t4 = document.getElementById("telefono").value;
		t5 = document.getElementById("empresa").value;
		t6 = document.getElementById("provincia").value;
		t7 = document.getElementById("comentarios").value;
		t8 = document.getElementById("seccion").value;
		if(document.getElementById("formulario").value == "Cabecera"){
			id = document.getElementById('contaj_cab');
		}else{
			id = document.getElementById('contaj');
		}
		ajax=nuevoAjax();
		ajax.open("POST", "/marketing/formContactHome/f_contacto.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				id.innerHTML = ajax.responseText
			}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; text/html; charset=iso-8859-1");
		ajax.send("motivo="+t1+"&nombre="+t2+"&email="+t3+"&telefono="+t4+"&empresa="+t5+"&provincia="+t6+"&comentarios="+t7+"&seccion="+t8);
	}
	function cargarContenidoContacto(){
		id = document.getElementById('contaj_cab');
		ajax=nuevoAjax();
		ajax.open("POST", "/marketing/formContactHome/f_contacto.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				id.innerHTML = ajax.responseText
			}
		}
		ajax.send(null);
	}
	function cargarVacio(){	
		id = document.getElementById('contaj_cab');
		ajax=nuevoAjax();
		ajax.open("POST", "/marketing/formContactHome/f_contactoVacio.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				id.innerHTML = ajax.responseText
			}
		}
		ajax.send(null);
	}
	random_img=0;
	function cargarContenidoImgSec(){
	   id = document.getElementById('img-php');
		random_img++;
	   ajax=nuevoAjax();
	   ajax.open("POST","/marketing/formContactHome/f_contactoImgSec.php",true);
	   ajax.onreadystatechange=function() {
		  if (ajax.readyState==4) {
			 id.innerHTML = ajax.responseText;
		   }
	   }
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; text/html; charset=iso-8859-1");
		ajax.send("random_img="+random_img);
	}
		/* fin formulario contacto */

   function abrirurlajax2(url,id,ventana)
	{// obtener contenido del buscador
	
	if (window.XMLHttpRequest)
	{
	var req3=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
	var req3=new ActiveXObject("Microsoft.XMLHTTP");
	}
		req3.open("GET",url + "?ID="+id,false);
		req3.send(null);
	
		xGetElementById(ventana).innerHTML=req3.responseText;
	}
   
   
   
   //flash
   
   var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
	var version;
	var axo;
	var e;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}
	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}
	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }
  document.write(str);
}
function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    
    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
   
   
   
-->
