// ESPECIFICA LAS MASCARAS DE FORMATO CON LAS QUE PUEDE TRABAJAR// OPCIONES DE FORMATO://// dd   = 1 or 2-digit Day// DD   = 2-digit Day// mm   = 1 or 2-digit Month// MM   = 2-digit Month// yy   = 2-digit Year// YY   = 4-digit Year// yyyy = 4-digit Year// month   = Month name in lowercase letters// Month   = Month name in initial caps// MONTH   = Month name in captital letters// mon     = 3-letter month abbreviation in lowercase letters// Mon     = 3-letter month abbreviation in initial caps// MON     = 3-letter month abbreviation in uppercase letters// weekday = name of week in lowercase letters// Weekday = name of week in initial caps// WEEKDAY = name of week in uppercase letters// wkdy    = 3-letter weekday abbreviation in lowercase letters// Wkdy    = 3-letter weekday abbreviation in initial caps// WKDY    = 3-letter weekday abbreviation in uppercase letters//// Ejemplos://// calDateFormat = "mm/dd/yy";// calDateFormat = "Weekday, Month dd, yyyy";// calDateFormat = "wkdy, mon dd, yyyy";// calDateFormat = "DD.MM.YY";     // FORMAT UNSUPPORTED BY JAVASCRIPT -- REQUIRES CUSTOM PARSING//calDateFormat    = "DD/MM/yyyy";var calFechaPasada = new Date;// ESTILOS DEL CALENDARIOgeneralBackground  = "#F4F4F4";         // BG COLOR DE LA PARTE SUPERIORtableBGColor     = "#999999";         // BG COLOR DE LA TABLA DEL CALENDARIOcellColor        = "#ffffff";     // BG COLOR DE LAS CELDAS DE LA TABLA CALENDARIOheadingCellColor = "#C1D5DE";         // BG COLOR DE LAS CELDAS DE LOS D\u00CDAS DE LA SEMANAheadingTextColor = "black";         // TEXT COLOR DE LOS D\u00CDAS DE LA SEMANAdateColor        = "black";          // TEXT COLOR DE LOS D\u00CDAS DEL MESfocusColor       = "#FEF5D4";       // TEXT COLOR DE LA FECHA SELECCIONADA PREVIAMENTEhoverColor       = "#5F7AA4";        // TEXT COLOR DEL ENLACE CUANDO SE PASA SOBRE ELfontStyle        = "10pt  arial, helvetica"; // TEXT STYLE DE LOS D\u00CDAS DEL MESheadingFontStyle = "bold 10pt  arial, helvetica";     // TEXT STYLE DE LOS D\u00CDAS DE LA SEMANAcurrentDayColor  = "#2965AD";  //TEXT COLOR DEL DIA ACTUALMENTE SELECCIONADO EN LAS CELDAScurrentFontStyle = "bold 10pt  arial, helvetica bold"; // TEXT STYLE DEL DIA DEL MES SELECCIONADO// PREFERENCIAS DE FORMATObottomBorder  = false;        // TRUE/FALSE (para mostrar un borde en el calendario)tableBorder   = 0;            // Tama\u00F1o del borde de la tabla calendario 0=none// FIN DE PREFERENCIAS -------------------------------------------------------// DETERMINA EL NAVEGADORvar isNav = false;var isIE  = false;// ASUME QUE ES NETSCAPE \u00F3 EXPLORER ( no mas ) if (navigator.appName == "Netscape"){	isNav = true; }else{	isIE = true; }// OBTIENE EL LENGUAJE QUE TIENE EL NAVEGADORvar selectedLanguage;function selectLanguage(lang) {	selectedLanguage = lang; }//selectedLanguage = navigator.appVersion;// PRECARGA DE CABECERAS y algunas partes del CALENDARIObuildCalendarParts();// FUNCIONES DEL CALENDARIO ---------------------------------------------------// INICIALIZA LA VARIABLE GLOBAL CON LA FECHAfunction setDateField(dateField){	// ASIGNA EL OBJETO PASADO A LA VARIABLE	calDateField = dateField;		// OBTIENE EL VALOR DEL CAMPO FECHA	inDate = dateField.value;		// INICIALIZA A LA FECHA PASADA O AL CALENDARIO	setInitialDate();		// EL DOCUMENTO HTML DEL CALENDARIO SE CREA EN EL SCRIPT	calDocTop    = buildTopCalFrame();	calDocBottom = buildBottomCalFrame();}// INICIALIZA LA FECHA A LA ACTUAL O LA QUE SE ENCUENTRE EN EL CAMPO function setInitialDate(){	// CREA UN NUEVO OBJETO DATE CREATE	var mMonth = parseInt(inDate.substr(3,2),10) - 1;	var mDay = parseInt(inDate.substr(0,2),10);	var mYear = parseInt(inDate.substr(6,4),10);		calDate = new Date(mYear, mMonth, mDay);	calFechaPasada = new Date(mYear, mMonth, mDay);		// SI LA FECHA PASADA NO ES VALIDA UTILIZA LA ACTUAL    if (isNaN(calDate))	{	calDate = new Date();		calFechaPasada = new Date();	}    // MANTIENE EL DIA ACTUAL    calDay  = calDate.getDate();		// ESTABLECE EL DIA A 1 ... PARA EVITAR CALCULOS ERRONEOS DEL DATE JAVASCRIPT    // (SI EL MES CAMBIA DE FEB Y EL DIA ES 30, EL MES DEBERIA CAMBIAR A MARZO Y EL DIA A 2    //  . PONIENDO EL DIA A 1 EVITAMOS ESTE PROBLEMA)    calDate.setDate(1);}// POPUPfunction showCalendar(dateField){	// ESTABLECE LA FECHA INICIAL	setDateField(dateField);		// USA EL DOCUMENTO GENERADO	calDocFrameset =window.opener.calDocTop ;    // LANZA LA NUEVA VENTANA	newWin = window.open("javascript:opener.calDocFrameset", "calWin", winPrefs);	newWin.focus();}// CREA EL DOCUMENTO HTMLfunction buildTopCalFrame(){	// LA PARTE SUPERIOR DEL DOCUMENTO    var calDoc =        "<HTML>" +        "<HEAD>" +		"<TITLE>Calendario</TITLE>"+        "</HEAD>" +        "<BODY BGCOLOR='" + generalBackground + "'>" +        "<FORM NAME='calControl' onSubmit='return false;'>" +        "<CENTER>" +        "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>" +        "<TR><TD COLSPAN=7>" +        "<CENTER>" +        getMonthSelect() +        "<INPUT NAME='year' VALUE='" + calDate.getFullYear() + "' TYPE=TEXT SIZE=4 style='font-size=8pt; font-face=Verdana' MAXLENGTH=4 onChange='opener.setYear()'>" +        "</CENTER>" +        "</TD>" +        "</TR>" +		"<TR><TD height=8><SPACER type=block height=8/></TD></TR>"+        "<TR>" +        "<TD COLSPAN=7 align='center' valing='middle'>" +		"<A href='#' onClick='opener.setPreviousYear()'><IMG src='rew.gif' border='0'></A>" +        "<A href='#' onClick='opener.setPreviousMonth()'><IMG src='atras.gif' border='0'></A>" +        "<A href='#' onClick='opener.setToday()'><IMG src='hoy.gif' border='0'></A>" +        "<A href='#' onClick='opener.setNextMonth()'><IMG src='alante.gif' border='0'></A>" +        "<A href='#' onClick='opener.setNextYear()'><IMG src='ff.gif' border='0'></A>" +        "</TD>" +        "</TR>" +        "</TABLE>" +		buildBottomCalFrame()+        "</CENTER>" +        "</FORM>" +        "</BODY>" +        "</HTML>";	return calDoc;}// CREA EL CALENDARIO MENSUALfunction buildBottomCalFrame(){	// INTRODUCE LA CADENA DE COMIENZO	var calDoc = calendarBegin;		// RECUPERA MES Y A\u00D1O DE LA FECHA DEL CALENDARIO	month = calDate.getMonth();	year = calDate.getFullYear();		// OBTIENE EL DIA 	day = calDay;		var i   = 0;	// DETERMINA EL NUMERO DE D\u00CDAS DEL MES ACTUAL	var days = getDaysInMonth();	if (day > days)	{	day = days; }		// DETERMINA EN QUE DIA DE LA SEMANA EMPIEZA EL MES	var firstOfMonth = new Date (year, month, 1);	var startingPos  = (firstOfMonth.getDay()+ 7 - 1) % 7;	days += startingPos;		// MANTIENE UN CONTADOR DE COLUMNAS, COMENZANDO UNA NUEVA FILAS DESPUES DE CADA 7    var columnCount = 0;		// RELLENA LAS PRIMERAS CELDAS BLANCAS	for (i = 0; i < startingPos ; i++)	{	calDoc += blankCell;		columnCount++;	}    // SACA LOS VALORES PARA LOS DIAS DEL MES    var currentDay = 0;    var dayType    = "weekday";    for (i = startingPos; i < days; i++)	{	var paddingChar = "&nbsp;";		// AJUSTA EL ESPACIO DE LAS DIFERENTES CELDAS        if (i-startingPos+1 < 10)		{	padding = "&nbsp;&nbsp;"; }        else {	padding = "&nbsp;"; }        // OBTIENE EL DIA QUE SE ESTA ESCRIBIENDO        currentDay = i-startingPos+1;        // ESTABLECe EL TIPO DE DIA        if (currentDay == day) {            dayType = "focusDay";        }        else {            dayType = "weekDay";        }        if (currentDay == calFechaPasada.getDate()) {            dayType = "currentDay";        }		        // A\u00D1ADE EL CODIGO HTML        calDoc += "<TD align=center bgcolor='" + cellColor + "'>" +                  "<a class='" + dayType + "' href='javascript:opener.returnDate(" +                   currentDay + ")'>" + padding + currentDay + paddingChar + "</a></TD>";        columnCount++;        // NUEVA FILA CUANDO SEA NECESARIO        if (columnCount % 7 == 0) {            calDoc += "</TR><TR>";        }    }    // COMPLETA LAS CELDAS QUE SOBRAN    for (i=days; i<42; i++)  {     calDoc += blankCell;	columnCount++;        // NUEVA FILA CUANDO SEA NECESARIO        if (columnCount % 7 == 0) {            calDoc += "</TR>";            if (i<41) {                calDoc += "<TR>";            }        }    }        // FINALIZA EL CODIGO HTML    calDoc += calendarEnd;    // DEVUELVE LA GENERACI\u00D3N HTML DEL CALENDARIO    return calDoc;}// ESCRIBE LA PAGINA ENTERAfunction writeCalendar() {    // CREA EL NUEVO CALENDARIO PARA EL MES Y A\u00D1O SELECCIONADOS    calDocBottom = buildBottomCalFrame();    // ESCRIBE EL NUEVO CALENDARIO    newWin.document.clear();    newWin.document.write(buildTopCalFrame());    newWin.document.close();}// ESTABLE LA FECHA A LA ACTUAL Y MUESTRA EL CALENDARIOfunction setToday() {    // FECHA A LA ACTUAL     calDate = new Date();	calFechaPasada = new Date();    // SACA MES Y A\u00D1O    var month = calDate.getMonth();    var year  = calDate.getFullYear();    // ACTUALIZA LA LISTA DESPLEGABLE    newWin.document.all['month'].selectedIndex = month;    // ACTUALIZA EL CAMPO A\u00D1O    newWin.document.all['year'].value = year;    // RENUEVA LA PAGINA    writeCalendar();}// ESTABLECE UN NUEVO A\u00D1O PARA EL CALENDARIOfunction setYear() {    // OBTIENE EL NUEVO A\u00D1O    var year  = newWin.document.all['year'].value;    // SI EL A\u00D1O TIENE 4 DIGITOS LO MUESTRA    if (isFourDigitYear(year)) {        calDate.setFullYear(year);        writeCalendar();    }    else {        newWin.document.all['year'].focus();        newWin.document.all['year'].select();    }}// ESTABLECE UN NUEVO MES PARA EL CALENDARIOfunction setCurrentMonth() {    var month = newWin.document.all['month'].selectedIndex;    calDate.setMonth(month);    writeCalendar();}// UN A\u00D1O ATRASfunction setPreviousYear() {    var year = newWin.document.all['year'].value;    if (isFourDigitYear(year) && year > 1000) {        year--;        calDate.setFullYear(year);        newWin.document.all['year'].value = year;        writeCalendar();    }}//MES ANTERIORfunction setPreviousMonth() {    var year  = newWin.document.all['year'].value;    if (isFourDigitYear(year)) {        var month = newWin.document.all['month'].selectedIndex;        // SI EL MES ES ENERO, PONER DICIEMBRE Y REDUCIR UN A\u00D1O        if (month == 0) {            month = 11;            if (year > 1000) {                year--;                calDate.setFullYear(year);                newWin.document.all['year'].value = year;            }        }        else {            month--;        }        calDate.setMonth(month);        newWin.document.all['month'].selectedIndex = month;        writeCalendar();    }}// MES POSTERIORfunction setNextMonth() {    var year = newWin.document.all['year'].value;    if (isFourDigitYear(year)) {        var month = newWin.document.all['month'].selectedIndex;        // SI EL MES ES DICIEMBRE, PONER EL MES A ENERO Y UN A\u00D1O MAS         if (month == 11) {            month = 0;            year++;            calDate.setFullYear(year);            newWin.document.all['year'].value = year;        }        else {            month++;        }        calDate.setMonth(month);        newWin.document.all['month'].selectedIndex = month;        writeCalendar();    }}// A\u00D1O POSTERIORfunction setNextYear() {    var year  = newWin.document.all['year'].value;    if (isFourDigitYear(year)) {        year++;        calDate.setFullYear(year);        newWin.document.all['year'].value = year;        writeCalendar();    }}// OBTIENE EL NUMERO DE D\u00CDAS EN UN MESfunction getDaysInMonth()  {    var days;    var month = calDate.getMonth()+1;    var year  = calDate.getFullYear();    // RETURN 31 DIAS    if (month==1 || month==3 || month==5 || month==7 || month==8 ||        month==10 || month==12)  {        days=31;    }    // RETURN 30 DIAS    else if (month==4 || month==6 || month==9 || month==11) {        days=30;    }    // RETURN 29 DIAS    else if (month==2)  {        if (isLeapYear(year)) {            days=29;        }        // RETURN 28 DIAS        else {            days=28;        }    }    return (days);}// VER SI EL A\u00D1O ES BISIESTOfunction isLeapYear (Year) {    if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {        return (true);    }    else {        return (false);    }}// ASEGURARSE DE QUE EL A\u00D1O TIENE 4 DIGITOSfunction isFourDigitYear(year) {    if (year.length != 4) {        newWin.document.all['year'].value = calDate.getFullYear();        newWin.document.all['year'].select();        newWin.document.all['year'].focus();    }    else {        return true;    }}// CONSTRUYE LA LISTA DE MESESfunction getMonthSelect(){	switch (selectedLanguage)	{	case "fr":	monthArray = new Array('Janvier', 'F\u00E9vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aout', 'Septembre', 'Octobre', 'Novembre', 'D\u00E9cembre');					break;		case "de":	monthArray = new Array('Januar', 'Februar', 'M\u00E4rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember');					break;		case "en":	monthArray = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');					break;		default:	monthArray = new Array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');					break;	}		// DETERMINA EL MES A PONER POR DEFECTO    var activeMonth = calDate.getMonth();    // CODIGO HTML DE LA LISTA    monthSelect = "<SELECT NAME='month' onChange='opener.setCurrentMonth()' style='font-size=8pt; font-face=Verdana'>";    // BUCLE EN EL ARRAY DE MESES    for (i in monthArray)	{	// INTERPRETA LOS ARRAYS DE MESES        if (i == activeMonth) {            monthSelect += "<OPTION SELECTED>" + monthArray[i] + "\n";        }        else {            monthSelect += "<OPTION>" + monthArray[i] + "\n";        }    }    monthSelect += "</SELECT>";    // FIN CODIGO HTML DE LA LISTA    return monthSelect;}// DIAS DE LA SEMANA SEGUN LENGUAJEfunction createWeekdayList(){	switch (selectedLanguage)	{	case "fr":	weekdayList  = new Array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi','Dimanche');					weekdayArray = new Array('Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa','Di');					break;		case "de":	weekdayList  = new Array('Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag','Sonntag');					weekdayArray = new Array('Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa','So');					break;		case "en":	weekdayList  = new Array( 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday','Sunday');					weekdayArray = new Array('Mo','Tu','We','Th','Fr','Sa','Su');					break;		default:	weekdayList  = new Array('Lunes', 'Martes', 'Mi\u00E9rcoles', 'Jueves', 'Viernes', 'S\u00E1bado','Domingo');					weekdayArray = new Array('Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa','Do');					break;	}		// CODIGO HTML DE LOS D\u00CDAS DE LA SEMANA    var weekdays = "<TR BGCOLOR='" + headingCellColor + "'>";    for (i in weekdayArray)	{	weekdays += "<TD class='heading' align=center>" + weekdayArray[i] + "</TD>"; }    weekdays += "</TR>";    // FILA CON LOS D\u00CDAS DE LA SEMANA    return weekdays;}// PARTES DEL CALENDARIO YA CONSTRUIDASfunction buildCalendarParts() {    // CABECERAS DE LOS DI\u00C1S DE LA SEMANA    weekdays = createWeekdayList();    // CELDAS BLANCAS    blankCell = "<TD align=center bgcolor='" + cellColor + "'>&nbsp;&nbsp;&nbsp;</TD>";    // PARTE SUPERIOR DEL CALENDARIO    calendarBegin = "<STYLE type='text/css'>" +// ESTILOS QUE DEFINEN EL CALENDARIO        "<!--" +        "TD.heading { text-decoration: none; color:" + headingTextColor + "; font: " + headingFontStyle + "; }" +        "A.focusDay:link { color: " + dateColor + "; text-decoration:none; font: " + fontStyle + "; }" +        "A.focusDay:hover { color: " + dateColor + "; text-decoration: none; font: " + fontStyle + "; }" +        "A.focusDay:visited { color: " + dateColor + "; text-decoration: none; font: " + fontStyle + "; }" +        "A.weekday:link { color: " + dateColor + "; text-decoration: none; font: " + fontStyle + "; }" +        "A.weekday:hover { color: " + dateColor + "; font: " + fontStyle + "; text-decoration: none;}" +        "A.weekday:visited { color: " + dateColor + "; font: " + fontStyle + "; text-decoration: none;}" +        "A.currentday:link { color: "+currentDayColor+"; text-decoration: none; font: "+currentFontStyle+"; }" +        "A.currentday:hover { color: "+currentDayColor+"; font:  bold "+currentFontStyle+"; text-decoration: none;}" +        "A.currentday:visited { color: "+currentDayColor+"; font:  bold "+currentFontStyle+"; text-decoration: none;}" +        "-->" +        "</STYLE>" +        "<CENTER>";        // EL NETSCAPE NECESITA UNA TABLA PARA QUE SE VEAN LAS LINEAS        if (isNav) {            calendarBegin +=                 "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=" + tableBorder + " ALIGN=CENTER BGCOLOR='" + tableBGColor + "'><TR><TD>";        }        // CONSTRUIR CABECERAS DE LOS DIAS DE LA SEMANA        calendarBegin +=            "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=" + tableBorder + " ALIGN=CENTER BGCOLOR='" + tableBGColor + "'>" +            weekdays +            "<TR>";    // PARTE DE ABAJO DEL CALENDARIO    calendarEnd = "";        // MOSTRAR O NO UNA LINEA TRAS EL CALENDARIO        if (bottomBorder) {            calendarEnd += "<TR></TR>";        }        // EL NETSCAPE NECESITA UNA TABLA PARA QUE SE VEAN LAS LINEAS        if (isNav) {            calendarEnd += "</TD></TR></TABLE>";        }        // FINAL DE TABLA Y HTML        calendarEnd +=            "</TABLE>" +            "</CENTER>";}function jsReplace(inString, find, replace) {    var outString = "";    if (!inString) {        return "";    }    if (inString.indexOf(find) != -1) {        t = inString.split(find);        return (t.join(replace));    }    else {        return inString;    }}//NO HACE NADAfunction doNothing() {}//SE ASEGURA QUE UN VALOR SE COMPONE DE 2 DIGITOSfunction makeTwoDigit(inValue) {    var numVal = parseInt(inValue, 10);    // VALUE IS LESS THAN TWO DIGITS IN LENGTH    if (numVal < 10) {        // ADD A LEADING ZERO TO THE VALUE AND RETURN IT        return("0" + numVal);    }    else {        return numVal;    }}// CIERRA EL CALENDARIO Y ASIGNA EL VALOR SELECCIOANDO AL CAMPOfunction returnDate(inDay){    // inDay = DIA SELECCIONADO    calDate.setDate(inDay);    // ASIGNAR AL CAMPO EL DIA    var day           = calDate.getDate();    var month         = calDate.getMonth()+1;    var year          = calDate.getFullYear();    var monthString   = monthArray[calDate.getMonth()];    var monthAbbrev   = monthString.substring(0,3);    var weekday       = weekdayList[calDate.getDay()];    var weekdayAbbrev = weekday.substring(0,3);    outDate = calDateFormat;    // DIA DE 2 DIGITOS    if (calDateFormat.indexOf("DD") != -1) {        day = makeTwoDigit(day);        outDate = jsReplace(outDate, "DD", day);    }    // DIA DE 1 o 2 DIGITOS    else if (calDateFormat.indexOf("dd") != -1) {        outDate = jsReplace(outDate, "dd", day);    }    // MES DE 2 DIGITOS    if (calDateFormat.indexOf("MM") != -1) {        month = makeTwoDigit(month);        outDate = jsReplace(outDate, "MM", month);    }    // MES DE UNO O DOS DIGITOS    else if (calDateFormat.indexOf("mm") != -1) {        outDate = jsReplace(outDate, "mm", month);    }    // A\u00D1O DE 4 DIGITOS    if (calDateFormat.indexOf("yyyy") != -1) {        outDate = jsReplace(outDate, "yyyy", year);    }    // A\u00D1O DE 2 DIGITOS    else if (calDateFormat.indexOf("yy") != -1) {        var yearString = "" + year;        var yearString = yearString.substring(2,4);        outDate = jsReplace(outDate, "yy", yearString);    }    // A\u00D1O DE 4 DIGITOS	    else if (calDateFormat.indexOf("YY") != -1) {        outDate = jsReplace(outDate, "YY", year);    }    // DIA DEL MES     if (calDateFormat.indexOf("Month") != -1) {        outDate = jsReplace(outDate, "Month", monthString);    }    // DIA DEL MES    else if (calDateFormat.indexOf("month") != -1) {        outDate = jsReplace(outDate, "month", monthString.toLowerCase());    }    // DIA DEL MES    else if (calDateFormat.indexOf("MONTH") != -1) {        outDate = jsReplace(outDate, "MONTH", monthString.toUpperCase());    }    // DIS DEL MES    if (calDateFormat.indexOf("Mon") != -1) {        outDate = jsReplace(outDate, "Mon", monthAbbrev);    }    // DIA DEL MES    else if (calDateFormat.indexOf("mon") != -1) {        outDate = jsReplace(outDate, "mon", monthAbbrev.toLowerCase());    }    // DIA DEL MES    else if (calDateFormat.indexOf("MON") != -1) {        outDate = jsReplace(outDate, "MON", monthAbbrev.toUpperCase());    }    // DIA DE LA SEMANA    if (calDateFormat.indexOf("Weekday") != -1) {        outDate = jsReplace(outDate, "Weekday", weekday);    }    // DIA DE LA SEMANA    else if (calDateFormat.indexOf("weekday") != -1) {        outDate = jsReplace(outDate, "weekday", weekday.toLowerCase());    }    // DIA DE LA SEMANA    else if (calDateFormat.indexOf("WEEKDAY") != -1) {        outDate = jsReplace(outDate, "WEEKDAY", weekday.toUpperCase());    }    // DIA DE LA SEMANA    if (calDateFormat.indexOf("Wkdy") != -1) {        outDate = jsReplace(outDate, "Wkdy", weekdayAbbrev);    }    // DIA DE LA SEMANA    else if (calDateFormat.indexOf("wkdy") != -1) {        outDate = jsReplace(outDate, "wkdy", weekdayAbbrev.toLowerCase());    }    // D\u00CDA DE LA SEMANA    else if (calDateFormat.indexOf("WKDY") != -1) {        outDate = jsReplace(outDate, "WKDY", weekdayAbbrev.toUpperCase());    }    // ASIGNA AL CAMPO LA FECHA SELECCIONADA    calDateField.value = outDate;    // DEVUELVE EL FOCO AL CAMPO    calDateField.focus();    // CIERRA EL CALENDARIO    newWin.close()}