<!--

 /****************************************************************************/
 /******************* Metodos comunes a todas las páginas ********************/
 /****************************************************************************/


var nav4 = window.Event ? true : false;	

if (document.getElementById){ //
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj,pat,obj1){
//alert('SwitchMenu')
	if(document.getElementById)
	{
		var el1 = document.getElementById(obj1);
		var el = document.getElementById(obj);
		var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //
		
		if (el!=null)
		{
			if(el.style.display != "block")
			{ //
				for (var i=0; i<ar.length; i++)
				{
					if (ar[i].className=="submenu") //
						ar[i].style.display = "none";
				}
				el.style.display = "block";
			}
			else
			{
				el.style.display = "none";
			}
		}
		
		if (el1 != null)
		{
			el1.className="menutitle1";	
		}	
	}
}

<!--
var Open = ""
var Closed = ""

function preload(strPathAplicacion_l)
{
	if(document.images)
		{
		Open = new Image(6,9)    
		Closed = new Image(9,6)
		Open.src = strPathAplicacion_l +"/images/vineta-menu2.gif"
		Closed.src = strPathAplicacion_l + "/images/vineta-menu1.gif"
		}
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

 /*-------------------------------------------------------------------------------*/
 /*----------------- Fin Metodos comunes a todas las páginas ---------------------*/
 /*-------------------------------------------------------------------------------*/


 /****************************************************************************/
 /*************** Metodos para controlar la barra de acciones ****************/
 /****************************************************************************/

function popUpActualizarDatosUsuario(nombreUsuario,correoElectronico,fechaNacimiento) 
{ 
	var strMensaje = '';
	var returnValue = true;
	
	var txtNombreUsuario = document.getElementById(nombreUsuario);
	var txtCorreoElectronico = document.getElementById(correoElectronico);
	var txtFechaNacimiento = document.getElementById(fechaNacimiento);
	
  if(txtNombreUsuario!=null) 
  {
		if (txtNombreUsuario.value == '')
		{
			strMensaje += "El campo Nombre es obligatorio.\n";
			returnValue = false;
		}
   }
	
	if(txtCorreoElectronico!=null)  
  {
		if(txtCorreoElectronico.value == '') 
		{
			strMensaje += "El campo Correo electr\u00f3nico es obligatorio.\n";
			returnValue = false;
		}
		else
		{
			if (!checkEmailAddress(txtCorreoElectronico.value))
			{
				strMensaje += "El formato del campo Correo electr\u00f3nico no es v\u00e1lido.\n";
				returnValue = false;
			}
		}
	}
	
	if(txtFechaNacimiento!=null) 
  {
		if (txtFechaNacimiento.value == '')
		{
			strMensaje += "El campo Fecha Nacimiento es obligatorio.\n";
			returnValue = false;
		}
  }
  
	if (!returnValue)
	{
		alert('Por favor verifique los siguientes campos:\n\n' + strMensaje);
	}
	
	return returnValue;
 }

function popUpEstadosValidation(startDate,endDate,infoAdicional) 
{ 
	var strMensaje = '';
	var returnValue = true;
	
	var txtStartDate = document.getElementById(startDate);
	var txtEndDate = document.getElementById(endDate);
	var txtInfoAdicional = document.getElementById(infoAdicional);
	
  if(txtStartDate!=null) 
  {
		if (!txtStartDate.disabled && txtStartDate.value == '')
		{
			strMensaje += "El campo fecha inicial de vigencia es obligatorio.\n";
			returnValue = false;
		}
   }
  
  if(txtEndDate!=null)  
  {
		if(!txtEndDate.disabled && txtEndDate.value == '') 
		{
			strMensaje += "El campo de fecha final de vigencia es obligatorio.\n";
			returnValue = false;
		}
	}
  
  if (txtInfoAdicional!=null)
  {
		if(!txtInfoAdicional.disabled && txtInfoAdicional.value == '') 
		{
			strMensaje += "El campo informaci\u00f3n adicional es obligatorio.\n";
			returnValue = false;
		}
	}
	
	if (txtEndDate!=null && txtEndDate!=null)
	{
		if (!txtStartDate.disabled && !txtEndDate.disabled && txtStartDate.value != '' && txtEndDate.value != '')
		{
			var sDate = ParseDate(txtStartDate.value);
			var eDate = ParseDate(txtEndDate.value);
		
			if (sDate >= eDate)
			{
				strMensaje = "La fecha inicial debe ser menor que la fecha final";
				returnValue = false;
			}
		}
	}
		
	if (!returnValue)
	{
		alert('Por favor verifique los siguientes campos:\n\n' + strMensaje);
	}
	
	return returnValue;
 }

function checkEmailAddress(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}


function select_deselectAll (chkVal, idVal) 
{ 
    var frm = document.forms[0];
    var obj;
    // Loop through all elements
    for (i=0; i<frm.length; i++) 
    {
		
   
        // Look for our Header Template's Checkbox
        if (idVal.indexOf ('CheckAll') != -1) 
        { 
						 
            // Check if main checkbox is checked, then select or deselect datagrid checkboxes 
            
            if(chkVal == true) 
            {
								
								if (frm.elements[i].id.indexOf ('chkId') != -1)
									frm.elements[i].checked = true;
            } 
            else 
            {
								if (frm.elements[i].id.indexOf ('chkId') != -1)
									frm.elements[i].checked = false;
            }
            // Work here with the Item Template's multiple checkboxes
        } 
        else if (idVal.indexOf('chkId') != -1) 
        {		
						    // Check if any of the checkboxes are not checked, and then uncheck top select all checkbox
            if (frm.elements[i].id.indexOf('CheckAll') != -1)
            {
							
							obj=frm.elements[i];
						}							
            else if(frm.elements[i].checked == false && frm.elements[i].id.indexOf ('chkId') != -1) 
						{
								obj.checked=false;
								//frm.elements[1].checked = false; //Uncheck main select all checkbox
						}
           
        }
    }

}

function confirmAprobar () 
{ 
		var frm = null;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}

    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de aprobar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}

function confirmDelete () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}

    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de eliminar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}

function confirmDesaprobar () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}

    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de desaprobar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}

function confirmEdit() 
{ 
		var frm = null;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}

    var j=0;
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
				j++;
				if (j!=1)
				{
					alert("Debe seleccionar solo un registro");
					return(false);
				}	
            }
        }
    }    
    if (j==0)
    {
			alert("Debe seleccionar por lo menos un registro");			
			return(false);
    }    
}

function confirmSave () 
{ 
	return confirm ('Esta seguro de grabar los cambios efectuados?');
}

function confirmDeleteRecord()
{
	return confirm('Esta seguro que desea eliminar el registro seleccionado?');
}

function confirmReturn()
{
	return confirm('Esta seguro de salir de la pantalla actual?');
}

 /*-------------------------------------------------------------------------------*/
 /*--------------Fin Metodos para controlar la barra de acciones------------------*/
 /*-------------------------------------------------------------------------------*/

 /****************************************************************************/
 /**** Metodos para controlar la barra de acciones en controles ANTHEM *******/
 /****************************************************************************/

function delete_PreCallBack(button) 
{
  return confirmDelete(document.forms[0]);
}

function approve_PreCallBack(button) 
{
  return confirmAprobar(document.forms[0]);
}

function disapprove_PreCallBack(button) 
{
	return confirmDesaprobar(document.forms[0]);
}

function update_PreCallBack(button) 
{
  return confirmEdit(document.forms[0]);
}

function deleteRecord_PreCallBack(button) 
{
	return confirmDeleteRecord();
}

function return_PreCallBack(button) 
{
	return confirmReturn();
}

 /*-------------------------------------------------------------------------------*/
 /*---Fin Metodos para controlar la barra de acciones en controles ANTHEM --------*/
 /*-------------------------------------------------------------------------------*/


 /*****************************************************************************/
 /** Otros metodos para controlar operaciones que requieren confirmación ******/
 /*****************************************************************************/

function getHardDeleteConfirm(strMessage) 
{ 
if (confirm(strMessage)==true) 
	return true;
else 
	return false; 
}			

function ValTarifa(sender, args)
 {	
    if (document.forms[0].opcPRO_REGIMEN_TRIBUTARIO_rdbSiNo_1.checked && document.forms[0].txtPRO_TARIFA.value=="")
    {
         args.IsValid = false;
         return;
    }

    args.IsValid = true;
}

function habilitarRegimenTributario()
{
	
	document.all.reqPRO_DOCUMENTO_IDENTIDAD_REPRESENTANTE_LEGAL.enabled="false";
	if (document.forms[0].opcPRO_REGIMEN_TRIBUTARIO_rdbSiNo_1.checked)
	{	
		document.forms[0].txtPRO_TARIFA.disabled=false;		
		document.forms[0].txtPRO_TARIFA.focus();
		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_1.checked=false;
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_0.checked=false;
		document.all.opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo.disabled=true;		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_0.disabled=true;		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_1.disabled=true;		
		
	
	}
	else if(document.forms[0].opcPRO_REGIMEN_TRIBUTARIO_rdbSiNo_0.checked)
	{		
		document.forms[0].txtPRO_TARIFA.disabled=true;
		document.forms[0].txtPRO_TARIFA.value="";			
		document.all.opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo.disabled=false;		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_0.disabled=false;		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_1.disabled=false;		
		document.forms[0].opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo_0.checked=true;
		document.all.opcPRO_GRAN_CONTRIBUYENTE_rdbSiNo.focus();		
	}
	return(true);
}

function getExitConfirm(strMensaje) 
{ 
if (confirm(strMensaje)==true) 
	return true; 
else 
	return false; 
}			

 /*-------------------------------------------------------------------------------------*/
 /*---- Fin Otros metodos para controlar operaciones que requieren confirmación --------*/
 /*-------------------------------------------------------------------------------------*/

 /*****************************************************************************/
 /******** Metodos para ejecutar operaciones básicas sobre controles **********/
 /*****************************************************************************/

	function ventana(nombre, ancho, alto)
	{
		var atrib="resizable=no,width="+ancho+",height="+alto+",location=no,toolbar=no,menubar=no,scrollbars=yes,titlebar=no";
		var win = window.open(nombre, "ventana", atrib);
		win.opener = self;					
	}
	
	function ventanasize(url)
	{
		var winW = 800, winH = 600;
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			}
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				winW = document.body.offsetWidth;
				winH = document.body.offsetHeight;
			}
		}
		var intleft=((screen.width-winW)/2);
		var inttop=((screen.height-winH)/2);	
			
		var atrib="resizable=no,width="+winW+",height="+winH+ ",left=" +  intleft + ",top=" + inttop + ",location=no,toolbar=no,menubar=no,scrollbars=yes,titlebar=no";
		
		window.open(url, 'ventana', atrib);
		
	}
	
	function navegar(nombre)
	{	
		window.location=nombre;
		
	}

function setControl(control)
{
	if (control != null)
	{
		control.focus();
	}		
}

function showhide(what,what2)
	{
		if (what.style.display=='none')
		{
			what.style.display='';
			what2.src=Open.src;
		}
		else
		{
			what.style.display='none'
			what2.src=Closed.src;
		}
}

function habilitarCbo(chk,control)
{
		control.disabled=chk.checked;
}


// Validar la Longitud máxima de un Campo texarea
function textAreaMaxLength(field, maxlimit) 
{
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
}

//idUserControl - Si los tabs estan contenidos en un control de usuario se debe
//indicar el id cliente del respectivo control 
function despliegaGrupo(indiceGrupo,CantidadPestanas,grupo,idUserControl)
{
	//var td;
	//var div;
	if (idUserControl==null)	
		document.getElementById("txtGrupoActivo").value = indiceGrupo;		
	else
		document.getElementById(idUserControl+"_txtGrupoActivo").value = indiceGrupo;
		
	//Oculta todas las Pestañas
	for(i=1;i<=CantidadPestanas;i++)
	{
		//Oculta TD
		if (idUserControl==null)
			td = document.getElementById("td"+grupo+i);
		else
			td = document.getElementById(idUserControl+"_td"+grupo+i);
			
		if (td!=null)
		{
			td.className="tab-activo";
		}
		//Oculta Div
		div = document.getElementById(grupo+i);		
		if (div!=null)
		{
			div.style.display='none';
		}		
	}
		
	//Activa la pestaña seleccionada		
	if (idUserControl==null)
		td=document.getElementById("td"+grupo+indiceGrupo);
	else
		td=document.getElementById(idUserControl+"_td"+grupo+indiceGrupo);
		
	if (td!=null)
	{
		td.className="tab-inactivo";
	}
	div=document.getElementById(grupo+indiceGrupo);
	if (div!=null)
	{
		div.style.display='';
	}
}

function OcultaGrupo(indiceGrupo,cantidadPestanas,grupo)
{
	//var pestana;	
	
	document.getElementById("txtGrupoActivo").value = indiceGrupo;
	//Oculta td y div
	for(i=1;i<=cantidadPestanas;i++)
	{
		td=document.getElementById("td"+grupo+i);
		if (td!=null)
		{
				td.className="tab-activo";      
				td.style.visibility="hidden";
		}
		pestana=document.getElementById(grupo+i);	    
		if (pestana!=null)
		{
				pestana.style.display='none';
				//pestana.style.visibility='hidden';
		}	        
	}		
	
	td=document.getElementById("td"+grupo+indiceGrupo);	
		
	if (td!=null)
	{
		td.className="tab-inactivo";
		td.style.visibility="visible";
	}	
	
	div=document.getElementById(grupo+indiceGrupo);	
	if (div!=null)
	{
		div.style.display='';
		//pestana.style.visibility='visible';
	}
}   
				
function despliegaTodoGrupo(indiceGrupo,cantidadPestanas,grupo)
{
	//var pestana;	           					
	for(i=1;i<=cantidadPestanas;i++)
	{		
		td=document.getElementById("td"+grupo+i);		            
		if (td!=null)
		{
			td.className="tab-activo";
			td.style.visibility="visible";
		}		            
		div=document.getElementById(grupo+i);
		if (div!=null)
		{
			div.style.display='';	
			//pestana.style.visibility='visible';						
		}
	}
	despliegaGrupo(indiceGrupo,cantidadPestanas,grupo);
	
	//Activa la pestaña indicada como Principal
	/*td=document.getElementById("td"+grupo+indiceGrupo);	
	if (td!=null)
	{
		td.className="tab-inactivo";
	}
	div=document.getElementById(grupo+indiceGrupo);
	if (div!=null)
	{
		div.style.display='';
	}*/
}        			

function validateMaxLen(field, maxLength)
{
	if (field.value.length > maxLength)
	{
			field.value = field.value.substring(0, maxLength);
	}
}

function habilitarCamposSINO()
{
	var cbo;
	var chkbox=habilitarCamposSINO.arguments[0];
	for (i = 1; i<habilitarCamposSINO.arguments.length; i++)
	{
		cbo=habilitarCamposSINO.arguments[i];						
		cbo.disabled=chkbox.checked;			
		if (cbo.type!="checkbox")
		{
			if(chkbox.checked == false)
			{
				if (cbo.type=="text")
				{
					cbo.value = "";
				}
				if (cbo.type=="select-one")
				{
					if(cbo.disabled == true)
					{
						cbo.selectedIndex = -1;
					}
					else
					{
						cbo.selectedIndex = 0;
					}
				}
			}
		}
	}
	for (i = 1; i<habilitarCamposSINO.arguments.length; i++)
	{	
		cbo=habilitarCamposSINO.arguments[i];		
		if (cbo.type=="checkbox")
		{
			cbo.checked = true;
			cbo.click();				
		}
	}		
}

function habilitarCamposInverso()
{
		var cbo;
		var chkbox=habilitarCamposInverso.arguments[0];
		for (i = 1; i<habilitarCamposInverso.arguments.length; i++)
		{
			cbo=habilitarCamposInverso.arguments[i];
			cbo.disabled=!chkbox.checked;
			if (cbo.type=="checkbox")
			{
				cbo.checked=chkbox.checked;
			}
			if (cbo.type=="select-one")
			{
				cbo.disabled=chkbox.checked;
				if(cbo.disabled == true)
				{
					cbo.selectedIndex = -1;
				}
				else
				{
					cbo.selectedIndex = 0;
				}
			}
		}
}

function DesHabilitaMinoriaEtnica()
{
	InhabilitarCombo('AgentesBasicos_lblAGE_OTRA_MINORIA', true);
	InhabilitarCombo('AgentesBasicos_txtAGE_OTRA_MINORIA', true);
}

/*Permite habilitar o inhabilitar un combo
	idCombo: identificador del combo
	disabled: true para deshabilitarlo, false para habilitarlo*/
function InhabilitarCombo(idCombo, disabled)
{
	var combo = document.getElementById(idCombo);
	
	if (combo!=null)
	{
		combo.disabled = disabled;
	}
}

//Funcion para corregir error de los contrloes FileUpload
function onkeyPress(e)
{
	var key = window.event ? e.keyCode : e.which;
	if (key == 13)
	StartClick();
	e.cancelBubble = true;
	e.returnValue = false;
	return false;
}

/*Función que controla el resize de los nuevos popup*/
function resizePopUp()
{
	var x=document.getElementById('overlay'); 
	var xiframe=document.getElementById('popupFrame');
	
	if (x!=null)
	{	
		if (x && x.style.display=='block')
		{
			if (parseInt(navigator.appVersion)>3)
	
			{
				if (navigator.appName=='Netscape') 
				{
					winW = window.innerWidth + window.scrollMaxX; 
					winH = window.innerHeight + window.scrollMaxY
				}
				if (navigator.appName.indexOf('Microsoft')!=-1) 
				{
					//Width
					if (document.body.offsetWidth >= document.body.scrollWidth) 
					{
						winW = document.body.offsetWidth + 20;
					}
					else
					{
						winW = document.body.scrollWidth;
					}
					//Height
					if (document.body.offsetHeight >= document.body.scrollHeight) 
					{
						winH = document.body.offsetHeight + 20;
					}
					else
					{
						winH = document.body.scrollHeight;
					}
					
				}
			}
			
			x.style.width = winW;
			x.style.height = winH;
			
			if (navigator.appName.indexOf('Microsoft')!=-1 && xiframe!=null) 
			{
				xiframe.style.width = winW;
				xiframe.style.height = winH;
			}
		}
	}
}

/* Permite seleccionar un valor de un combo*/
function selectValue(combo, value)
 {
	if (combo!=null)
	{
		for (opcombo=0;opcombo<combo.length;opcombo++)
		{			
			var valor=combo.options[opcombo].value;
			if (valor == value)
			{
				combo.selectedIndex = opcombo;
				break;
			}
		}
	}
}

 /*-------------------------------------------------------------------------------------*/
 /*---------- FIN Metodos para controlar operaciones básicas sobre controles -----------*/
 /*-------------------------------------------------------------------------------------*/

 /*****************************************************************************/
 /****************** Metodos para ejecutar operaciones comunes ****************/
 /*****************************************************************************/
// Convert to UpperCase
function Upper(e,r)
{
	if ((e.keyCode >=65 && e.keyCode <=90) || e.keyCode == 192)
	{
		r.value = r.value.toUpperCase();
	}
}

	//pasa el texto a mayusculas y sin tildes
function PasaMayusculas(campoid)
{
		campoid.value=campoid.value.toUpperCase();	
        var chr1 = new Array();
        var chr = new Array();
        chr1[0]=193;
        chr1[1]=201;
        chr1[2]=205;
        chr1[3]=211;
        chr1[4]=218;
        
        chr[0]="A";
        chr[1]="E";
        chr[2]="I";
        chr[3]="O";
        chr[4]="U";
            
		var largo=(campoid.value.length)*1;
	    
		for (var i=0; i<=4; i++)
		{
			var letra1=chr[i];
			var letra=unescape('%' + chr1[i].toString(16));
			for (var j=0;j<=(largo-1);j++)
				{
					if (campoid.value.charAt(j)==letra)
					{
						campoid.value=campoid.value.substring(0,j)+letra1+campoid.value.substring(j+1,largo);
					}
				}
		}
		return true;
}

// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57	

function acceptDecimal(evt,keyCodeDecSing){	
var key = nav4 ? evt.which : evt.keyCode;
if (keyCodeDecSing == 44 && key == 46)
{
	key = 44;
	if (!nav4)
	{		
		evt.keyCode = 44;
	}
	else
	{		
		evt.which = 44;
	}
}
return (key <= 13 || (key >= 48 && key <= 57) || key == keyCodeDecSing);
}

//Acepta: Solo Numeros
function acceptNum(evt){	
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || (key >= 48 && key <= 57));
}

function acceptChar(evt){	
var key = nav4 ? evt.which : evt.keyCode;
return ( !( (key >= 1 && key <= 31) || (key==42) || (key==47) || (key==60) || (key==62)|| (key == 96) || 
						(key >= 169 && key <= 192) || (key >= 194 && key <=200) || (key >= 255) ) );
}

// Acept:a Numeros, Letras, punto y Arroba
function acceptCharMail(evt){
var key = nav4 ? evt.which : evt.keyCode;

return ( !( (key >= 1 && key <= 31) || (key >= 33 && key <= 44) || (key==47) || (key >= 58 && key <= 63) || (key >= 91 && key <= 94) || (key == 96) || (key >= 123 && key <=129) || (key >= 131 && key <= 192) || (key >= 194 && key <=200) || (key==209) || (key==241) || (key >= 255) ) );
}

function acceptCharURL(evt){	
var key = nav4 ? evt.which : evt.keyCode;
return ( !( (key >= 1 && key <= 31) || (key >= 33 && key <= 45) || (key >= 59 && key <= 63) || (key >= 91 && key <= 94) ||  (key == 96) ||
						(key >= 123 && key <=129) || (key >= 131 && key <= 192) || (key >= 194 && key <=200) || (key >= 255) ) );
}

function acceptCharDir(evt){	
var key = nav4 ? evt.which : evt.keyCode;
return (!( (key >= 1 && key <= 31) || (key == 60) || (key == 62) ) );
}

function checkOnlyNumbers(str) {
    return /^ *[0-9]+ *$/.test(str);
}

function checkNumericControl(control)
{
	if (control.value.length > 0)
	{
		var result = checkOnlyNumbers(control.value);
		
		if (!result)
		{
			alert("Este es un campo numerico. Por favor remueva los caracteres invalidos (e.j., [, ?, /).");
			control.focus();
			return false;
		}
	}
	
	return true;	
}

function checkDecimalControl(control,keyCodeDecSing)
{	
	if (control.value.length > 0)
	{				
		var result = true;
		
		if (keyCodeDecSing == 44)
			result = /^\d+(\,\d+)?$/.test(control.value);
		else if (keyCodeDecSing == 46)
			result = /^\d+(\.\d+)?$/.test(control.value);
		 
		if (!result)
		{
			alert("Este no es un numero decimal valido. Por favor verifique.");
			control.focus();
			return false;
		}
	}
	
	return true;	
}

//
// FieldBuffer - Class for form-buffering, value-restoration and file-field resetting.
//
// Author: Christopher Bergren (Anjuna Moon)
// Created: Stockholm Sweden, July 25th, 2005
// License: Freeware (Please keep credits intact as a sign of good-will)
//
// METHODS:
// BufferForm(FormObject)
//		Buffers values from all input-elements except File and Button
// RestoreForm(FormObject)
//		Restores the buffered data to corresponding elements 
// ClearFileFields(FormObject)
//		Performs a Reset-operation that only affects File-elements
//
function FieldBuffer() {
	FieldBuffer.prototype.BufferForm=fnBufferForm;
	FieldBuffer.prototype.RestoreForm=fnRestoreForm;
	FieldBuffer.prototype.ClearFileFields=fnClearFileFields
	arrEls=new Array;		
	hshEls={};
	function fnBufferForm(oFrm) {
		oEls=oFrm.elements;
		for (i=0;i<oEls.length;i++) {
			arrEls[i]=new Element(oEls[i]);
		}
	}
	function fnRestoreForm(oFrm) {
		for (i=0;i<arrEls.length;i++) {
			oEl=arrEls[i];
			if (oEl.BufferThis)
				oEl.SetValue();
		}
	}
	function fnClearFileFields(oFrm) {
		this.BufferForm(oFrm);
		oFrm.reset();
		this.RestoreForm(oFrm);
	}
	function Element(oEl) {
		Element.prototype.SetValue=fnSetValue;
		this.Type=oEl.type;
		this.ObjRef=oEl;
		this.Required=false;
		this.CommonName='';
		switch(this.Type) {
			case 'select-one':
				this.Value=oEl.selectedIndex;
				this.BufferThis=true;
				break;
			case 'checkbox':
			case 'radio':
				this.Value=oEl.checked;
				this.BufferThis=true;
				break;
			case 'textarea':
			case 'text':
			case 'password':
			case 'hidden':
				this.Value=oEl.value;
				this.BufferThis=true;
				break;
			default:
				this.BufferThis=false;
		}
		function fnSetValue() {
			switch(this.Type) {
				case 'select-one':
					this.ObjRef.selectedIndex=this.Value;
					break;
				case 'checkbox':
				case 'radio':
					this.ObjRef.checked=this.Value;
					break;

				case 'textarea':
				case 'text':
				case 'password':
				case 'hidden':
					this.ObjRef.value=this.Value;
					break;
			}
		}
	}
}
function showhideDiv(divName, image, closedImage, openedImage)
	{
		what = document.getElementById(divName);
		originalImage = document.getElementById(image);
		
		if (what.style.display=='none')
		{
			what.style.display='';
			originalImage.src = openedImage;
		}
		else
		{
			what.style.display='none'
			originalImage.src = closedImage;
		}
}
function querySt(ji)
{
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++)
	{
		//alert(gy[i]);	
		ft = gy[i].split("=");
		if (ft[0] == ji)
		{
			//alert(ft[1]);
			return ft[1];
		}
	}
}

// Permite seleccionar un departamento en el mapa de colombia
function seleccionarDepartamento(controlName) 
{
	var control = document.getElementById(controlName);
	
	if (control==null)
	{
		return;
	}
		
  var movieName = "colombia";
  var valor = control.options[control.selectedIndex].value;
  
	if (valor.length >= 2)
  {
		var Frame = valor.substring(0,2);
  }
  else
  {
		return;
  }
  
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  var  thisMovie;
	
  if (navigator.appName.indexOf ("Microsoft") !=-1) 
  {
    thisMovie =  document.forms[0][movieName];
  }	
  else 
  {
    thisMovie = document.forms[0][movieName];
  }
  
  // Si encontro la pelicula
  if (typeof(thisMovie) != "undefined")
  {
	// Si esta totalmente cargado
    if (thisMovie.PercentLoaded() == 100)
    {
			thisMovie.GotoFrame(Frame);
		}
  }
}

 /*-------------------------------------------------------------------------------------*/
 /*------------------- FIN Metodos para ejecutar operaciones comunes -------------------*/
 /*-------------------------------------------------------------------------------------*/
	