// JavaScript Document
		<!--$Revision: 1.8 $-->
		//si es IE reemplaza los alerts
		//if(document.all){

			window.alert = newAlerts;
		//}
		//ojo que aca se redefine la pagina por defecto para las alertas alerta.htm
		function newAlerts(msg){
			//showPopup('confirmar.htm',msg,'','no');
			window.parent.showPopWin('alerta.htm', 250, 200, null, msg);
			//window.parent.showPopWin('alerta.htm', 200, 250, null, msg);
		}
		
		function Ident_Serv(){
			//showPopup('confirmar.htm',msg,'','no');
			window.parent.showPopWin('PagosyTransferencias/CMCLPACU001/CMCLPACU001_005_FotoIdCliente.html', 520, 320);
			//window.parent.showPopWin('alerta.htm', 200, 250, null, msg);
		}
		
		function newConfirmacion(msg){
			window.parent.showPopWin('js/confirmar.htm', 270, 180, null, msg);
		}
		
		function legal(msg){
			window.parent.showPopWin('PagosyTransferencias/CMCLTRAN0001_Ingreso02/CMCLTRAN0001_0020_Legal.html', 450, 200);
		}
		
		function legalServicios(msg){
			window.parent.showPopWin('PagosyTransferencias/CMCLPACU001/CMCLPACU001_020_Legal.html', 450, 200);
		}
		
		function eToken(msg){
			window.parent.showPopWin('contratacion/ventanas/CMCLTRAN0001_0019_Autorizar.html?row='+ msg+ '', 450, 200, null, msg);
		}
		
		function certificado(msg){
			window.parent.showPopWin('contratacion/ventanas/CMCLTRAN001_000_CertificadoDigital.html?Prm='+ msg+ '', 400, 400, null, msg);
		}
		
		function modifContactos(msg){
			window.parent.showPopWin('contratacion/CMEJCONT002/CMEJCONT002_004_modifContEmp.html?row='+ msg+ '', 750, 420, null, msg);	
		}
		function eFolletos(msg){
			window.parent.showPopWin('contratacion/CMEJCONT001/CMEJCONT001_002_eFolleto.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		
		function eContratos(msg){
			window.parent.showPopWin('contratacion/CMEJCONT002/CMEJCONT002_002_eContrato.html?row='+ msg+ '', 750, 420, null, msg);
		}

		function eCotizacion(msg){
			window.parent.showPopWin('contratacion/CMEJCONT006/CMEJCONT006_002_eCotizacion.html?row='+ msg+ '', 750, 420, null, msg);
		}
		
		function SelApoderados(msg){
			//window.parent.showPopWin('contratacion/CMEJCONT002/CMEJCONT002_003_selecApo.html?Prm='+ msg+ '', 740, 420, null, msg);
			window.parent.showPopWin('contratacion/Facultad/facultad.html?row='+ msg+ '', 740, 420, null, msg);

		}
		
		function vistoBueno(msg){
			window.parent.showPopWin('contratacion/CMEJCONT006/CMEJCONT006_003_vistoBueno.html?Prm='+ msg+ '', 740, 420, null, msg);
		}

		function newTipoEvento(msg){
			window.parent.showPopWin('SME010_001/SME010_001_seleccionarTipo.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		
		function newTipoRegalo(msg){
			window.parent.showPopWin('SME038/SME038_002_seleccionarTipoRegalo.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newAreaNegocio(msg){
			window.parent.showPopWin('SME010_001/SME010_001_seleccionarAreaNegocio.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newAreaNegocio(msg){
			window.parent.showPopWin('SME010_001/SME010_001_seleccionarAreaNegocio.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newResumenTotal(msg){
			window.parent.showPopWin('SME010_003/SME010_008_ResumenTotalEvento.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newSeleccionarEjecutivo(msg){
			//window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivo.html?Prm=CUA', 750, 420, null, msg);
			window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivoCUA.html?Prm=CUA', 750, 420, null, msg);
		}
		function newVincularEjecutivoCuenta(msg){
			//window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivo.html?Prm=CUA', 750, 420, null, msg);
			window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivoCUA2.html?Prm=CUA', 750, 420, null, msg);
		}
		function newSeleccionarEjecutivo2(msg){
			//window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivo.html?Prm=CUA2', 750, 420, null, msg);
			window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivoCUA.html?Prm=CUA2', 750, 420, null, msg);
		}
		
		function newSeleccionarEjecutivoTest(msg){
			window.parent.showPopWin('SME000/SME000_001_seleccionarEjecutivoCUA.html?Prm=CUA', 750, 420, null, msg);
		}
		function newDetalleEmpresa(msg){
			window.parent.showPopWin('SME019/SME019_001_seleccionarClientes.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newSecretaria(msg){
			window.parent.showPopWin('SME006/SME006_001_asignarSecretaria.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newAsignarHobbies(msg){
			window.parent.showPopWin('SME032/SME032_003_asignarHobbies.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newAsignarHobbies(msg){
			window.parent.showPopWin('SME032/SME032_003_asignarHobbies.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newAsignarProductos(msg){
			window.parent.showPopWin('SME032/SME032_003_asignarProductos.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newRegaloPeriodoAnterior(msg){
			window.parent.showPopWin('SME013/SME013_007_RegaloPeriodoAnterior.html?Prm='+ msg+ '', 750, 420, null, msg);
		}
		function newSeleccionarCalle(msg){
			window.parent.showPopWin('SME000/SME000_001_SeleccionarCalle.html?Prm='+ msg+ '', 420, 400, null, msg);
		}
		//Muestra un popup
		function showPopup(theURL,texto,winName,botonAceptar){
			var x=false;
			//se muestra una ventana de confirm ya que los otros navegadores
			//no cuentan con popups modales
			//window.open(theURL,'alerta',"modal,width=200,height=250,,left=200,top=250,scrollbars=NO");

			if(botonAceptar){
		//	x = confirm(texto);
		//	window.parent.showPopWin('confirmar.htm', 270, 180, null, texto);
			window.parent.showPopWin(theURL, 270, 180, null, texto);
			}else{
			alert(texto);
			x = false;
			}

			if(x!=true){x=false;}
			return x;
			}


/**
 * SUBMODAL v1.5
 * Used for displaying DHTML only popups instead of using buggy modal windows.
 *
 * By Seth Banks
 * http://www.subimage.com/
 *
 * Contributions by:
 * 	Eric Angel - tab index code
 * 	Scott - hiding/showing selects for IE users
 *	Todd Huss - inserting modal dynamically and anchor classes
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/subModal
 *
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

// Popup code
function destroyElement(obj) {

    obj.removeNode(true);

    }

var gPopupMask = null;
var gPopupContainer = null;
var gPopFrame = null;
var gReturnFunc;
var gPopupIsShown = false;
var gDefaultPage = "js/defecto.html";
var gHideSelects = false;
var gReturnVal = null;
var gMensaje =null;

var gTabIndexes = new Array();
// Pre-defined list of tags we want to disable/enable tabbing into
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");

// If using Mozilla or Firefox, use Tab-key trap.
if (!document.all) {
	document.onkeypress = keyDownHandler;
}



/**
 * Initializes popup code on load.
 */
function initPopUp() {
	// Add the HTML to the body
	theBody = window.document.getElementsByTagName('BODY')[0];
	popmask = window.document.createElement('div');
	popmask.id = 'popupMask';
	popmask.style.position= "absolute";
	popmask.style.zIndex= "200";
	popmask.style.top= "0px";
	popmask.style.left= "0px";
	popmask.style.width= "100%";
	popmask.style.height= "100%";
	popmask.style.opacity= ".3";
	popmask.style.filter= "alpha(opacity=30)";
	popmask.style.backgroundColor= "#333333";
	popmask.style.backgroundImage="none";
	popmask.style.backgroundRepeat= "repeat";
	popmask.style.display="none";

	popcont = window.document.createElement('div');
	popcont.id = 'popupContainer';
	popcont.innerHTML = '' +
/*		'444<div id="popupInner">' +
			'111<div id="popupTitleBar" style="color:#ffffff;font-weight:bold;height:1.3em;position: relative;z-index: 203;">' +
				'<div id="popupTitle" style="float:left;font-size:1.1em;"> </div>' +
				'<div id="popupControls" style="float:right;cursor:pointer;cursor:hand;">' +
					'<img src="images/ico_cerrar_alerta.gif" onclick="window.hidePopWin(false);" hspace="10" title="Cerrar Ventana" id="popCloseBox"/>' +
				'222</div>' +
			'</div>' +
			'<div id="bordeFrame"><iframe src="'+ gDefaultPage +'" style="margin:5px;width:100%;height:100%;background-color:transparent;border: 1px solid #ACB6B6;" scrolling="no" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%" style= "margin:0px;width:100%;height:100%;position:relative;z-index:202;"></iframe></div>' +
		'</div>333';*/
		'<table id="tableContainer" border="0" cellspacing="0" cellpadding="0" width="100%" >          <tr>            <td width="8" height="8" class="f1"><img src="images/ventana/b1.gif" width="9" height="8" class="transparente"></td>            <td class="f2">  <img src="images/ventana/b2.gif" width="100%" height="8" class="transparente"></td>            <td class="f3"><img src="images/ventana/b3.gif" width="9" height="8" class="transparente"></td>          </tr>          <tr>            <td class="f8"><img src="images/ventana/b8.gif" width="9" height="100%" class="transparente"></td>            <td width="100%" height="100%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">                <tr>                  <td height="17" class="bh"><div id="popupTitleBar" style="color:#252536;font-weight:bold;height:21px;position:relative;z-index: 203;">                  <div id="popupTitle" style="float:left;font-size:12px;height:21px;"> </div>                      <div id="popupControls" style="float:right;cursor:pointer;cursor:hand;"> <img src="images/ico_cerrar_alerta.gif" onclick="window.hidePopWin(false);" hspace="10" title="Cerrar Ventana" id="popCloseBox"/> </div>                    </div></td>                </tr>              </table><iframe src="'+ gDefaultPage +'" style="margin:0px;width:100%;height:100%;background-color:transparent;border: 1px solid #ACB6B6;" scrolling="no" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%" style= "margin:0px;width:100%;height:100%;position:relative;z-index:202;"></iframe></td>            <td class="f4"><img src="images/ventana/b4.gif" width="9" height="100%" class="transparente"></td>          </tr>          <tr>            <td class="f7"><img src="images/ventana/b7.gif" width="9" height="9" class="transparente"></td>            <td class="f6"><img src="images/ventana/b6.gif" width="100%" height="9" class="transparente"></td>            <td class="f5"><img src="images/ventana/b5.gif" width="9" height="9" class="transparente"></td>          </tr></table>';
	popcont.style.position= "absolute";
	popcont.style.zIndex= 201;
	popcont.style.top= "0px";
	popcont.style.left= "0px";
	popcont.style.display="none";
	popcont.style.padding= "0px";

	mensaje=window.document.createElement('div');
	mensaje.id= 'mensajepopup';
	mensaje.innerHTML='mensaje';
	mensaje.style.display="none";

	theBody.appendChild(popmask);
	theBody.appendChild(popcont);
	theBody.appendChild(mensaje);

	gPopupMask = window.document.getElementById("popupMask");
	gPopupContainer = window.document.getElementById("popupContainer");
	gPopFrame = window.document.getElementById("popupFrame");
	gMensaje = window.document.getElementById("mensajepopup");

	// check to see if this is IE version 6 or lower. hide select boxes if so
	// maybe they'll fix this in version 7?
	//var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
	/*if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
		gHideSelects = true;
	}*/

	// Add onclick handlers to 'a' elements of class submodal or submodal-width-height
	var elms = document.getElementsByTagName('a');
	for (i = 0; i < elms.length; i++) {
		if (elms[i].className.indexOf("submodal") == 0) {
			// var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};';
			// elms[i].onclick = eval(onclick);
			elms[i].onclick = function(){
				// default width and height
				var width = 400;
				var height = 200;
				// Parse out optional width and height from className
				params = this.className.split('-');
				if (params.length == 3) {
					width = parseInt(params[1]);
					height = parseInt(params[2]);
				}
				showPopWin(this.href,width,height,null); return false;
			}
		}
	}
}

//Si no es dummy
if(document.getElementById("$_BC_TIME")!=null){
addEvent(window, "load", initPopUp);
}
 /**
	* @argument width - int in pixels
	* @argument height - int in pixels
	* @argument url - url to display
	* @argument returnFunc - function to call when returning true from the window.
	* @argument showCloseBox - show the close box - default true
	*/


function showPopWin(url, width, height, returnFunc,mensaje) {
	// show or hide the window close widget
	/*if (showCloseBox == null || showCloseBox == true) {
		document.getElementById("popCloseBox").style.display = "block";
	} else {
		document.getElementById("popCloseBox").style.display = "none";
	}*/
	if(!gPopupMask){
		initPopUp();
	}
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	// calculate where to place the window on screen
	centerPopWin(width, height);

	var titleBarHeight = parseInt(window.document.getElementById("popupTitleBar").offsetHeight, 10);


	//gPopupContainer.style.width = width + "px";
	gPopupContainer.style.width = width+"px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";

	setMaskSize();

	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(window.document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";

	// set the url
	gPopFrame.src = url;

	gReturnFunc = returnFunc;
	// for IE
	/*if (gHideSelects == true) {
		hideSelectBoxes();
	}*/
	window.document.getElementById("mensajepopup").innerHTML =mensaje;
	window.setTimeout("setPopTitle();", 600);
}

//
var gi = 0;
function centerPopWin(width, height) {
	if (gPopupIsShown == true) {
		if (width == null || isNaN(width)) {
			width = gPopupContainer.offsetWidth;
		}
		if (height == null) {
			height = gPopupContainer.offsetHeight;
		}

		//var theBody = document.documentElement;
		var theBody = window.document.getElementsByTagName("BODY")[0];
		//theBody.style.overflow = "hidden";
		var scTop = parseInt(getScrollTop(),10);
		var scLeft = parseInt(theBody.scrollLeft,10);

		setMaskSize();

		//window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;

		var titleBarHeight = parseInt(window.document.getElementById("popupTitleBar").offsetHeight, 10);

		var fullHeight = getViewportHeight();
		var fullWidth = getViewportWidth();

		gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px";
		gPopupContainer.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
		//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);
	}
}
addEvent(window, "resize", centerPopWin);
addEvent(window, "scroll", centerPopWin);
window.onscroll = centerPopWin;


/**
 * Sets the size of the popup mask.
 *
 */
function setMaskSize() {
	var theBody = window.document.getElementsByTagName("BODY")[0];

	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();

	// Determine what's bigger, scrollHeight or fullHeight / width
	if (fullHeight > theBody.scrollHeight) {
		popHeight = fullHeight;
	} else {
		popHeight = theBody.scrollHeight;
	}

	if (fullWidth > theBody.scrollWidth) {
		popWidth = fullWidth;
	} else {
		popWidth = theBody.scrollWidth;
	}

	gPopupMask.style.height = popHeight + "px";
	gPopupMask.style.width = popWidth + "px";
}

/**
 * @argument callReturnFunc - bool - determines if we call the return function specified
 * @argument returnVal - anything - return value
 */
function hidePopWin(callReturnFunc) {
	gPopupIsShown = false;
	var theBody = window.document.getElementsByTagName("BODY")[0];
	theBody.style.overflow = "";
	restoreTabIndexes();
	if (gPopupMask == null) {
		return;
	}
	//gPopupContainer.style.width = "0px";
	//gPopupContainer.style.height = "0px";
	//document.getElementById('tableContainer').style.width="0px"
	gPopupMask.style.display = "none";
	gPopupContainer.style.display = "none";
	gMensaje = window.document.getElementById("mensajepopup");
	gMensaje.innerHTML='';

	/*if (callReturnFunc == true && gReturnFunc != null) {
		// Set the return code to run in a timeout.
		// Was having issues using with an Ajax.Request();
		gReturnVal = window.frames["popupFrame"].returnVal;
		window.setTimeout('gReturnFunc(gReturnVal);', 1);
	}*/
	gPopFrame.src = gDefaultPage;
	destroyElement(gPopupContainer)
	gPopupMask = null;
	gPopupContainer = null;
	gPopFrame = null;
	gReturnFunc;
	gPopupIsShown = false;
	gDefaultPage = "js/defecto.html";
	gHideSelects = false;
	gReturnVal = null;
	gMensaje =null;
	
	// display all select boxes
	/*if (gHideSelects == true) {
		displaySelectBoxes();
	}*/
	
	if(callReturnFunc){
		mainFrame.ejecutarComandoConfirm();
	}
}

/**
 * Sets the popup title based on the title of the html document it contains.
 * Uses a timeout to keep checking until the title is valid.
 */
function setPopTitle() {
	//return;
	if (window.frames["popupFrame"].document.title == null) {
		window.setTimeout("setPopTitle();", 10);
	} else {
		window.document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title;
	}
}

// Tab key trap. iff popup is shown and key was [TAB], suppress it.
// @argument e - event - keyboard event that caused this function to be called.
function keyDownHandler(e) {
	if(window.document.getElementById("popupContainer")!=null){
		gPopupIsShown=window.document.getElementById("popupContainer").style.display == "block";
	    if (gPopupIsShown && e.keyCode == 9){
	    	  return false;
	    }else if(e.keyCode == 13 && !parent.frames['LaunchJSP']){
			if(e.target=="[object HTMLHtmlElement]" || e.target=="[object HTMLInputElement]"){
				e.preventDefault();
				e.stopPropagation();
			}else if(e.srcElement){
				if(oSource!="INPUT"&&oSource!="TEXTAREA"){
		    			 e.cancelBubble = true;
						 e.returnValue=false;
	 	 	    }
			}
	    }

	}
}

// For IE.  Go through predefined tags and disable tabbing into them.
function disableTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = window.document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				gTabIndexes[i] = tagElements[k].tabIndex;
				tagElements[k].tabIndex="-1";
				i++;
			}
		}
	}
}

// For IE. Restore tab-indexes.
function restoreTabIndexes() {
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = window.document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				tagElements[k].tabIndex = gTabIndexes[i];
				tagElements[k].tabEnabled = true;
				i++;
			}
		}
	}
}

/**
 * COMMON DHTML FUNCTIONS
 * These are handy functions I use all the time.
 *
 * By Seth Banks (webmaster at subimage dot com)
 * http://www.subimage.com/
 *
 * Up to date code can be found at http://www.subimage.com/dhtml/
 *
 * This code is free for you to use anywhere, just keep this comment block.
 */

/**
 * X-browser event handler attachment and detachment
 * TH: Switched first true to false per http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
 *
 * @argument obj - the object to attach event to
 * @argument evType - name of the event - DONT ADD "on", pass only "mouseover", etc
 * @argument fn - function to call
 */
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, false);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight;

	return window.undefined;
}
function getViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined) return window.innerWidth;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
	if (document.body) return document.body.clientWidth;
}

/**
 * Gets the real scroll top
 */
function getScrollTop() {
	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
}
function getScrollLeft() {
	if (self.pageXOffset) // all except Explorer
	{
		return self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollLeft;
	}
}

