// User defined Variables *** The values may be changed on the variable below TEEEESSSSSTTTTTTTTTTT
var PREV_COLOR 		= "#000000";		//Color - color the previous arrow
var NEXT_COLOR 		= "#000000";		//Color - color for the next arrow
var MONTH_BGCOLOR 	= "#CCCCCC";		//Background Color - color for the Month heading
var WEEK_BGCOLOR 	= "#CCCCCC";		//Background Color - color for the Weekday headings
var DAY_BGCOLOR 	= "#E2E2E2";		//Background Color - color for the Days
var CUR_DAY_BGCOLOR	= "#AE9291";		//Background Color - color for the Current Day
var PNI_MOCOLOR 	= "#E2E2E2";		//Background Rollover Color - color to change the previous/next button background 
var DAY_MOCOLOR 	= "#CCCCCC";		//Background Rollover Color - color to change the Days background 
var HDR_FNT_COLOR 	= "#000000";		//Font Color - color for the Month and Weekday headings font
var DAY_FNT_COLOR 	= "#000000";		//Font Color - color for the Days font
var CAL_BOR_COLOR 	= "#000000";		//Border Color - color for the border around the calendar
var WEEK_BOR_COLOR	= "#C0C0C0";		//Border Color - color for the border around the Weekday headings
var DAY_BOR_COLOR 	= "#CCCCCC";		//Border Color - color for the border around the Days

/************************************************************
*				TDS Date Picker				*
*										*
*	Created By:		Tom Smith	tsmith@tdscode.com		*
*	Created Date:	10/25/2000						*
*										*
*	Modified By:	Tom Smith						*
*	Modified Date:	02/06/2003						*
*	Modified Description:							*
*		Updated a problem with the change month.  This occurred	*
*		when the current date was larger than the next months.	*
*		Example: Today 1-31-2003 would fail when going to Feb	*
*		because Feb only had 28 days.  Also fixed the leap year	*
*		problem. Thanks to Bonny Silva for finding these bugs.	*
*************************************************************
*	For updated releases/changes visit www.tdscode.com		*
*										*
*	This code may be used freely as long as this header is 		*
*	displayed at the top of this file.					*
*										*
*	The calendar was designed for Netscape 4.x - higher	and		*
*	Internet Explorer 4.x - higher.						*
*										*
*	For instructions on using the calendar in visit 				*
*	www.tdscode.com.  Comments and suggestions are welcome.	*
************************************************************/

//Global Variables

//Define the different browser types that are supported
var NS4 = (navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4);
var NS6 = (navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==5);
var IE4 = document.all;

var agente = navigator.userAgent.toLowerCase();
var op = (agente.indexOf('opera') > -1) ? 1 : 0
var ie = (agente.indexOf('msie') > -1 && !op) ? 1 : 0
var ff = (agente.indexOf('firefox') > -1 && !ie) ? 1 : 0

//Calendar objects
var calNS4;
var calNS6;
var calIE4;

//Holding Variables
var CALENDAR_HTML = "";
var DISPLAY_DATE = "";
var CURRENT_DATE_FIELD = "";
var FORMULARIO = "";
var HLD_DIV = "";
var BUILT = "no";
var SEPARADOR = '-';  // [LFV Omnisoft] Valor por defecto para el separador de la fecha

//End of Global Variables


//Write out the style sheets
document.write("<style>");
document.write(".txtDay { font-size: 9px; color: " + DAY_FNT_COLOR + "; font-family: arial; text-decoration: none;}");
document.write(".txtMonth { font-size: 11px; color: " + HDR_FNT_COLOR + "; font-family: arial; text-decoration: none;}");
document.write(".tblCalendar { border: 1px solid " + CAL_BOR_COLOR + "; }");
document.write(".tdMonth { padding: 2px; }");
document.write(".tdDayW { padding: 2px; border: 1px solid " + WEEK_BOR_COLOR + "; }");
document.write(".tdDay { padding: 2px; border: 1px solid " + DAY_BOR_COLOR + "; }");
document.write(".btnPrev { font-size: 14px; color: " + PREV_COLOR + "; font-family: verdana; font-weight:bold; text-decoration: none; underline : none}");
document.write(".btnNext { font-size: 14px; color: " + NEXT_COLOR + "; font-family: verdana; font-weight:bold; text-decoration: none; under-line: none}");
document.write("</style>");

//This function is used to display the calendar

// [LFV Omnisoft] Añadido el parámetro 'separador' para poder usar un carácter diferente al por defecto
// [ASB Omnisoft] Añadido el parámetro 'idioma' para poder usar español o ingles
function showCalendar(field,date,separador,idioma,formulario,xPos,yPos)
{
	var nSpan = document.getElementsByTagName("DIV");
	
	for(n=0; n < nSpan.length; n++)
	{
		if(nSpan[n].id.indexOf("idcal_")!=-1) // si existe algun calendario visible lo ocultamos
		{
			nSpan[n].style.visibility = "hidden";
		}
	}
  // [LFV Omnisoft] Asigna el valor del separador
  if (separador)
     SEPARADOR = separador;
  else
     SEPARADOR = '-';

	if (HLD_DIV != date && BUILT == "yes")
	{
		if (NS4)
			calNS4.visibility = 'hidden';
		else if (IE4)
		{
			calIE4.style.visibility = 'hidden';
			// [LFV Omnisoft] Muestra los posibles selects que se hubieran ocultado previamente
			showSelects (calIE4);
		}
		else if (NS6)
			calNS6.style.visibility = 'hidden';
		
		BUILT = "no";
		HLD_DIV = date;
	}
	
	if (BUILT == "yes")
	{
		if (NS4)
			calNS4.visibility = 'visible';
		else if (IE4)
		{
			// [LFV Omnisoft] Oculta los selects que se vayan a solapar con el calendario
			hideSelects (calIE4);

			calIE4.style.visibility = 'visible';
		}
		else if (NS6)
			calNS6.style.visibility = 'visible';
		return;
	}

	//Set the Date field to use
	CURRENT_DATE_FIELD = field;
	FORMULARIO = formulario;
	
	//Set the Display Date to null
	DISPLAY_DATE = "";
	
	//Build the Calendar
	buildCalendar(idioma);
	
	if (!xPos)
		xPos = "";
	if (!yPos)
		yPos = "";
	
	/***** ASB 18/10/2005 ************************************/
	/* debido al nuevo portal hemos incluido este control de posicion
	/* para que se pinte bien la capa, en realidad no haria falta.
	**********************************************************/
	//var campo_fecha = "cal_" + CURRENT_DATE_FIELD;
	//document.getElementById(campo_fecha).style.left = eval(document.getElementById("cal_" + CURRENT_DATE_FIELD).offsetLeft) - 142;

	/**********************************************************/
	
	//Display the Calendar on the Web page
	if (NS4)
	{
		calNS4 = new Layer(50,this);
		calNS4.document.write(CALENDAR_HTML);
		calNS4.document.close();
		if (xPos != "" || yPos != "")
		{
			this.calNS4.pageX = xPos;
			this.calNS4.pageY = (yPos - 95);
		}
		else
		{
			this.calNS4.pageX = document.layers[date].pageX;
			this.calNS4.pageY = (document.layers[date].pageY - 95);
		}
		calNS4.visibility = 'visible';
	}
	else if (IE4)
	{
		calIE4 = document.all[date];
		
		calIE4.innerHTML = CALENDAR_HTML;

		xPos = eval(document.getElementById("cal_" + CURRENT_DATE_FIELD).offsetLeft) + 17; // - 135
		yPos = eval(document.getElementById("cal_" + CURRENT_DATE_FIELD).offsetTop); // - 123 // - 106
		
		if (xPos != "" || yPos != "")
		{
			calIE4.style.posLeft = xPos;
			calIE4.style.posTop = yPos;
		}

		// [LFV Omnisoft] Guarda todos los campos de tipo select, y oculta los que vayan a ser tapados por el calendario
		retrieveAllSelects (document);
		hideSelects (calIE4);
		
		calIE4.style.visibility = 'visible';
	}
	else if (NS6)
	{
		calNS6 = document.getElementById(date);

		xPos = eval(document.getElementById("cal_" + CURRENT_DATE_FIELD).offsetLeft) + 91; 
		yPos = eval(document.getElementById("cal_" + CURRENT_DATE_FIELD).offsetTop) - 21; 
			
		calNS6.innerHTML = CALENDAR_HTML;
		if (xPos != "" || yPos != "")
		{
			calNS6.style.top = yPos;
			calNS6.style.left = xPos;
		}
		calNS6.style.visibility = 'visible';
	}
	
	BUILT = "yes";
}

//This function is used to hide the calendar
function hideCalendar()
{
	if (BUILT == "no")
		return;
		
	if (NS4)
		calNS4.visibility = 'hidden';
	else if (IE4)
	{
		calIE4.style.visibility = 'hidden';
		// [LFV] muestra los posibles selects que se hubieran ocultado previamente
		showSelects (calIE4);
	}
	else if (NS6)
		calNS6.style.visibility = 'hidden';
}

//This function is used to change the Calendar Date
function chgCalendarDate(dspDate, idioma)
{
	//Set the Display to the new Date
	DISPLAY_DATE = dspDate;

	if (IE4)showSelects (calIE4);		

	//Build the Calendar
	buildCalendar(idioma);
	
	//Display the Calendar on the Web page
	if (NS4)
	{
		calNS4.document.write(CALENDAR_HTML);
		calNS4.document.close();
	}
	else if (IE4){
		calIE4.innerHTML = CALENDAR_HTML;
		hideSelects (calIE4);
	}
	else if (NS6)
		calNS6.innerHTML = CALENDAR_HTML;
}

//This function is used to change the Date field to the selected calendar date
function chgDate(txtDate, idioma)
{
    // [LFV Omnisoft] Modifica la cadena de la fecha para usar el separador
    var fecha = tratafecha(txtDate);
	
	/* ASB 19-08-2005 */
	var pos = 0;
	var mi_fecha;
	pos = fecha.indexOf('/');
	pos_fin = fecha.length;
	
	if(idioma == 'espaniol')
		mi_fecha = fecha.substring(0, 2) + "-" + fecha.substring(3, 5) + "-" + fecha.substring(6, pos_fin);
	else
		mi_fecha = fecha.substring(6, pos_fin) + "-" + fecha.substring(3, 5) + "-" + fecha.substring(0, 2);
    //fecha = fecha.replace (/[/]/g, SEPARADOR); // codigo antiguo
    /* Fin ASB */
	
	//Change the Date field
	//document.FORM_RVIA_0[CURRENT_DATE_FIELD].value = mi_fecha;
	var campo_fecha = eval("document." + FORMULARIO + "['" + CURRENT_DATE_FIELD + "']");
	campo_fecha.value = mi_fecha;

	//Hide the Calendar
	hideCalendar();
}

//This function is used to Build the Calendar
function buildCalendar(idioma)
{
	//Define the Month Names and Month Days Array
	if(idioma == "espaniol"){
		monthNames = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
		nombreDias = new Array("LUN", "MAR", "MIE", "JUE", "VIE", "SAB", "DOM");
	}		
	else if(idioma == "ingles"){
		monthNames = new Array("January","Febrery","March","April","May","June","July","August","September","October","November","December");
		nombreDias = new Array("SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT");
	}	
	monthDays = new Array(12);
	
	//Entry the Total Days for each Month
	monthDays[0] = 31;
	monthDays[1] = 28;
	monthDays[2] = 31;
	monthDays[3] = 30;
	monthDays[4] = 31;
	monthDays[5] = 30;
	monthDays[6] = 31;
	monthDays[7] = 31;
	monthDays[8] = 30;
	monthDays[9] = 31;
	monthDays[10] = 30;
	monthDays[11] = 31;

	//Determine the Date for the Calendar to Display
	if (DISPLAY_DATE == "")
		calendarDateObj = new Date();
	else
		calendarDateObj = new Date(DISPLAY_DATE);
	
	//Obtain the Calendar Dates
	calendarDate = calendarDateObj.getDate();
	calendarDay = calendarDateObj.getDay();
	calendarMonth = calendarDateObj.getMonth();
	calendarYear = calendarDateObj.getYear();
	
	//Obtain Todays Dates
	currentDateObj = new Date();
	currentDate = currentDateObj.getDate();
	currentDay = currentDateObj.getDay();
	currentMonth = currentDateObj.getMonth();
	currentYear = currentDateObj.getYear();
	
	//*** Fix - TDS 2-06-2003 ***
	if ((calendarMonth == currentMonth) && (calendarYear == currentYear))
	{
		calendarDate = currentDate;
		calendarDay = currentDay;
	}
	
	if (LeapYear(calendarYear))
		monthDays[1] = 29;
	//*** End Fix - 2-06-2003 ***
	
	//Make sure the Year is in the correct century
	calendarYear = calendarYear % 100;
	calendarYear = ((calendarYear < 50) ? (2000 + calendarYear) : (1900 + calendarYear));


	//Calculate the Blank entries before the 1st of the month
	blankEntry = calendarDate;

	while (blankEntry > 7) 
		blankEntry-= 7;

//	blankEntry = calendarDay - blankEntry + 1;
		blankEntry = calendarDay - blankEntry;
	if (blankEntry < 0) 
		blankEntry+= 7;
	
	//Calculate Next Months Date
	nextMonth = (calendarMonth + 2);
	if (nextMonth == 13)
	{
		nextMonth = 1;
		nextYear = (calendarYear + 1);
	} 
	else
		nextYear = calendarYear;

	//*** Fix - TDS 2-06-2003 ***
	//nextDate = nextMonth + "/" + currentDate + "/" + nextYear;
	nextDate = nextMonth + "/1/" + nextYear;
	//*** End Fix - 2-06-2003 ***
	
	//Calculate Previous Months Date
	prevMonth = calendarMonth;
	
	if (prevMonth == 0)
	{
		prevMonth = 12;
		prevYear = (calendarYear - 1);
	} 
	else
		prevYear = calendarYear;

	//*** Fix - TDS 2-06-2003 ***
	//prevDate = prevMonth + "/" + currentDate + "/" + prevYear;
	prevDate = prevMonth + "/1/" + prevYear;
	//*** End Fix - 2-06-2003 ***

	//Build the Header for the Calendar
	CALENDAR_HTML = "<table class=\"tblCalendar\" cellpadding=0 cellspacing=0  bgcolor='#FFFFFF'>";
	CALENDAR_HTML += "<tr>";
	//CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=chgCalendarDate('" + prevDate + "','" + idioma + "')><a href=javascript:chgCalendarDate('" + prevDate + "','" + idioma + "')><font class=\"btnPrev\"><b>&lt;</b></font></a></td>";
	CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=chgCalendarDate('" + prevDate + "','" + idioma + "')><a href=\"#\"><img src='/img/calenI.gif' border='0' width='21' height='18'></a></td>";
	CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" colspan=4><font class=\"txtMonth\">" + monthNames[calendarMonth] + " " + calendarYear + "</font></td>";
	//CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=chgCalendarDate('" + nextDate + "','" + idioma + "')><a href=javascript:chgCalendarDate('" + nextDate + "','" + idioma + "')><font class=\"btnNext\"><b>&gt;</b></font></a></td>";
	CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=chgCalendarDate('" + nextDate + "','" + idioma + "')><a href=\"#\"><img src='/img/calenD.gif' border='0' width='21' height='18'></a></td>";
	//CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=javascript: hideCalendar();><a href=javascript:hideCalendar();><font class=\"btnNext\"><b>X</b></font></a></td>";
	CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + " align=center class=\"tdMonth\" onMouseOver=mOvr(this,'" + PNI_MOCOLOR + "') onMouseOut=mOut(this,'" + MONTH_BGCOLOR + "') onClick=javascript:hideCalendar();><a href=\"#\"><img src='/img/aspa.gif' border='0' width='21' height='18'></a></td>";
	CALENDAR_HTML += "</tr>";
	CALENDAR_HTML += "<tr>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[0] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[1] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[2] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[3] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[4] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[5] + "</font></td>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " align=center class=\"tdDayW\"><font class=\"txtDay\">" + nombreDias[6] + "</font></td>";
	CALENDAR_HTML += "</tr>";
	CALENDAR_HTML += "<tr>";

	if(idioma == 'ingles'){
		if(blankEntry !=6) blankEntry += 1;
		else blankEntry = 0;
	}
	
	//Build a blank cell for each Blank Entry before the 1st of the Month
	for (s = 0;s < blankEntry;s++) 
		CALENDAR_HTML += "<td bgcolor=" + DAY_BGCOLOR + " align=center class=\"tdDay\"><font class=\"txtDay\">&nbsp;</font></td>";

	//Start the Day Counter
	dayCount = 1;

	//Loop through until the total days of calendar month have been reached
	while (dayCount <= monthDays[calendarMonth])  
	{
		//Start a new table row each time through the loop except the first time
		if (dayCount > 1)
			CALENDAR_HTML += "<tr>";
		
		//Start at the next cell after the blank entries and entry the cells across the row.
		for (b = blankEntry;b < 7;b++) 
		{
			//If the Day Counter is greater than the Month total then add blank entries
			if (dayCount <= monthDays[calendarMonth])
			{
				//tdProperties = "onClick=chgDate('" + (calendarMonth + 1) + "/" + dayCount + "/" + calendarYear + "') ";
				//tdData = "<a href=javascript:chgDate('" + (calendarMonth + 1) + "/" + dayCount + "/" + calendarYear + "')><font class=\"txtDay\">" + dayCount + "</font></a>";
				tdProperties = "onClick=chgDate('" + dayCount + "/" + (calendarMonth + 1) + "/" + calendarYear + "','" + idioma + "') ";
				tdData = "<a href=\"#\"><font class=\"txtDay\">" + dayCount + "</font></a>";
				//If the current day is equal to the calendar day and the
				//current month is equal to the calendar month, check the dates
				if ((currentDay == calendarDay) && (currentMonth == calendarMonth))
				{
					//If the day counter is equal to the current date then change the color
					if (dayCount == currentDate)
						tdProperties = tdProperties + "bgcolor=" + CUR_DAY_BGCOLOR + "";
					else 
						tdProperties = tdProperties + "onMouseOver=mOvr(this,'" + DAY_MOCOLOR + "') onMouseOut=mOut(this,'" + DAY_BGCOLOR + "') bgcolor=" + DAY_BGCOLOR + "";
				} 
				else 
					tdProperties = tdProperties + "onMouseOver=mOvr(this,'" + DAY_MOCOLOR + "') onMouseOut=mOut(this,'" + DAY_BGCOLOR + "') bgcolor=" + DAY_BGCOLOR + "";
			} 
			else
			{
				tdProperties = "bgcolor=" + DAY_BGCOLOR;
				tdData = "<font class=\"txtDay\">&nbsp;</font>";
							}
		
			//Build the table cells
			CALENDAR_HTML += "<td align=center class=\"tdDay\" " + tdProperties + ">" + tdData + "</td>";
		
			//Add to the Day counter
			dayCount++;
		}
	
		//End the table row
		CALENDAR_HTML += "</tr>";
				
		//Set the Blank entries to zero
		blankEntry=0;
	}

	//End the table
	
	CALENDAR_HTML += "<tr>";
	CALENDAR_HTML += "<td bgcolor=" + WEEK_BGCOLOR + " colspan=7 class=\"tdMonth\">&nbsp;</td>";
	//CALENDAR_HTML += "<td bgcolor=" + MONTH_BGCOLOR + "></td>";
	CALENDAR_HTML += "</tr>";
	CALENDAR_HTML += "</table>";
}

//*** Fix - TDS 2-06-2003 ***
//This fuction checks for the Leap Year
function LeapYear(year) 
{
    if ((year/4)   != Math.floor(year/4))   return false;
    if ((year/100) != Math.floor(year/100)) return true;
    if ((year/400) != Math.floor(year/400)) return false;
    return true;
}
//*** End Fix - 2-06-2003 ***

//This function is used to control the mouse over event.
function mOvr(src,clrOver)
{
	if(ff) src.bgColor = clrOver;
	else if (!src.contains(event.fromElement))
	{ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver;
	} 
}

//This function is used to control the mouse out event.
function mOut(src,clrIn)
{
	if(ff) src.bgColor = clrIn;
	else if (!src.contains(event.toElement))
	{ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	}
}

function tratafecha(fecha)
{
	//+ dayCount + "/" + (calendarMonth + 1) + "/" + calendarYear + 	
	primervalor = fecha.indexOf("/",1);
	segundovalor = fecha.indexOf("/",primervalor+1);

	if (primervalor==2 & segundovalor==5)
	{
		return (fecha);
	}
	else if (primervalor==1 & segundovalor==4)
	{
		return("0" +fecha);	
	}
	else if (primervalor==1 & segundovalor==3)  //Debemos añadir un 0 al mes y al dia
	{
		// 1/1/2004
		dia = "0" + fecha.substring(fecha,1);
		anno = fecha.substring(4);
		mes = "0" + fecha.charAt(2);
		return (dia+"/"+ mes + "/" + anno);
	}
	else if (primervalor==2 & segundovalor==4){ //Se añade un 0 al mes
		dia = fecha.substring(0,2);
		anno = fecha.substring(4);
		mes = "0" + fecha.charAt(3);
		return (dia+"/"+ mes +  anno);
	}
}

/**
 * [LFV Omnisoft] A partir de aquí, código y funciones necesarias para evitar el problema de que los DIV no 
 *                solapan los campos select en IE...
 */

var selects = new Array();
var n_selects = 0;

var selectsTapados = new Array();
var n_selectsTapados = 0;


function hideSelects(mainComp){
	izqui = getLeft(mainComp);//mainComp.offsetLeft + mainComp.offsetParent.offsetLeft;
	arb = getTop(mainComp);//mainComp.offsetTop + mainComp.offsetParent.offsetTop;
	ancho = mainComp.offsetWidth;
	alto = mainComp.offsetHeight;
	for (i = 0; i < selects.length; i++){
		sel = selects[i];
		arribaSel = getTop(sel);//sel.offsetTop + sel.offsetParent.offsetTop;
		izqSel = getLeft(sel);//sel.offsetLeft + sel.offsetParent.offsetLeft;
		derSel = izqSel + sel.offsetWidth;
		
		if (arribaSel > (arb) && arribaSel < (arb + alto))
		{
			if (derSel > izqui && izqSel < izqui)
			{
				// Sólo se mostrarán los selectores que estuvieran previamente ocultos
				if(sel.style.visibility != "hidden")
				{
					selectsTapados[n_selectsTapados++]=sel;
				}
				sel.style.visibility = "hidden";
			}
		}
	}
} 


function showSelects(mainComp){
	izqui = getLeft(mainComp);//mainComp.offsetLeft + mainComp.offsetParent.offsetLeft;
	arb = getTop(mainComp);//mainComp.offsetTop + mainComp.offsetParent.offsetTop;
	ancho = mainComp.offsetWidth;
	alto = mainComp.offsetHeight;
	
	for (i = 0; i < selectsTapados.length; i++)
	{
		sel = selectsTapados[i];
		arribaSel = getTop(sel);//sel.offsetTop + sel.offsetParent.offsetTop;
		izqSel = getLeft(sel);//sel.offsetLeft + sel.offsetParent.offsetLeft;
		derSel = izqSel + sel.offsetWidth;
		
		if (arribaSel < (arb + alto))
		{
			if (derSel > izqui && izqSel < izqui)
			{
				sel.style.visibility = "visible";
			}
		}
	}
	selectsTapados = new Array();
	n_selectsTapados = 0;
}

function getTop(comp){
	arriba = comp.offsetTop;
	padre = comp.offsetParent;
	while (padre != null){
		arriba += padre.offsetTop;
		padre = padre.offsetParent;
	}
	return arriba;
}

function getLeft(comp){
	izquierda = comp.offsetLeft;
	padre = comp.offsetParent;
	while (padre != null){
		izquierda += padre.offsetLeft;
		padre = padre.offsetParent;
	}
	return izquierda;
}

function retrieveAllSelects(doc){
	hijos = doc.all;
	for (i = 0; i < hijos.length; i++){
		hijo = hijos[i];
		if (hijo.options){
			selects[n_selects++] = hijo;
		}
	}
}

/**
 * ...[LFV Omnisoft] fin del código y funciones necesarias para evitar el problema de que los DIV no solapan 
 *                   los campos select en IE
 */

