function FHideRow(id_fila,id_campo)
{

            if(navigator.appName.indexOf("Microsoft") > -1){
                        var visible = 'block'
            }else{
                        var visible = 'table-row';
            }

 

            if(document.getElementById(id_campo).value == 0){
                      document.getElementById(id_fila).style.display='none';
            }

            if(document.getElementById(id_campo).value == 1){
                      document.getElementById(id_fila).style.display=visible;
            }
}

function guardarVisita()
{

	if ((document.getElementById('iConID').value =="") ||(document.getElementById('iConID').value == 0)) 
	{
		mostrarDiv('nuevoUsuario','show');
	}

}

function mostrarDiv(id,v)
{
	obj = document.getElementById(id);
	if (obj.style) 
	{ 
		obj=obj.style; 
    	v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
    }
    obj.visibility=v;
}

function imprimir()
{
	mostrarDiv('impresora','hide');
	window.print();
}


function mostrarHojaVisitas()
{
	window.open('index.php?ohaction=frmModDemandasHojaVisita', 'hoja de visita', 'height=850,width=640,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
//	window.close();
}

function cambiarFoto()
{
	window.open('index.php?ohaction=cambiarFoto', 'cambiarFoto', 'height=400,width=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


function abrirPopup(accion)
{
	window.open('index.php?ohaction=' + accion, 'abrirPopup', 'height=400,width=650,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

function seleccionarFoto(accion)
{
	window.open('index.php?ohaction=' + accion, 'seleccionarFoto', 'height=650,width=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

function seleccionarFotoFichaCliente(accion)
{
	window.open('index.php?ohaction=' + accion, 'abrirPopup', 'height=650,width=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

function mostrarEscaparate(idpropiedad, idfoto)
{
	window.open('index.php?ohaction=frmModPropiedadesescaparate&id=' + idpropiedad + '&idfoto=' + idfoto, 'escaparate', 'height=850,width=1024,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
	window.close();
}

function mostrarFichaCliente(idpropiedad, idfoto)
{
	window.open('index.php?ohaction=frmModPropiedadesfichacliente&id=' + idpropiedad + '&idfoto=' + idfoto, 'fichainterna', 'height=800,width=1024,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
	window.close();
}



function fichaInterna(accion, id)
{
	window.open('index.php?ohaction=' + accion, 'abrirPopup', 'height=700,width=1000,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


function fichaCliente(accion)
{
	window.open('index.php?ohaction=' + accion, 'fichaCliente', 'height=700,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


function abrirCartel(accion)
{
	window.open('index.php?ohaction=' + accion, 'abrirPopup', 'height=400,width=400,status=no,toolbar=no,menubar=no,location=no,resizable=no, scrollbars=no');
}

// Trae las franquicias y sedes para esa sucursal
function cambiarInmobiliaria() 
{
	var formulario = document.getElementById( 'form1' );

	formulario.action = "index.php?ohaction=frmModUsuarios";
	
	formulario.submit();
}

// Trae los permisos para ese grupo
function cambiarGrupo() 
{
	var formulario = document.getElementById( 'form1' );

	formulario.action = "index.php?ohaction=dspPermisos";
	
	formulario.submit();
}

// cambia el color de las filas
function ColorFila() 
{
	var rows = document.getElementsByTagName("tr");
	for(var i in rows) 
	{
		rows[i].onmouseover = function() {
				this.className = "resaltar";
				}
		rows[i].onmouseout = function() {
				this.className = null;
				}
    }
}

function showhideDiv(image, div)
{
	image = document.getElementById(image);
	div = document.getElementById(div);

	
	if (div.style.display == 'none')
	{
		div.style.display = '';
if(image)
		image.src = 'classes/js/dhtml-suite/themes/vista/images/icons/24-em-up.png';

	}
	else
	{
		div.style.display = 'none';
if(image)
		image.src = 'classes/js/dhtml-suite/themes/vista/images/icons/24-em-down.png';		
	}
}

function showDivWithOutImage(div)
{
	div = document.getElementById(div);
	
	if (div.style.display == 'none')
	{
		div.style.display = '';
	}
	else
	{
		div.style.display = 'none';
	}
}

function filtrarContactos()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoContactos');
		
		formulario.action = "index.php?ohaction=filtrarContactosSeleccionados";
		
		formulario.submit();
	}
}

// Filtra las propiedades seleccionadas del listado
function filtrarPropiedades()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{	
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoPropiedades');
		
		formulario.action = "index.php?ohaction=filtrarPropiedadesSeleccionadas";
		
		formulario.submit();
	}
}


// Filtra las propiedades en el listado de la busqueda
function filtrarPropiedadesEnBusqueda()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		var formulario = document.getElementById('form1');
		formulario.action = "index.php?ohaction=dspBuscarPropiedades&ids=" + ids+"&filtPropiedades=true";
		formulario.submit();
	}
}

// Filtra las demandas en la busqueda de demandas
function filtrarDemandasEnBusqueda()
{
	var ids = '';
	
	checkejemplo = document.getElementsByName("iDemID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1demanda']);
	}
	else
	{
		var formulario = document.getElementById('form1');
		formulario.action = "index.php?ohaction=frmBuscarDemandas&ids=" + ids;
		formulario.submit();
	}
}

// filtra las visitas en la busqueda
function filtrarVisitasEnBusqueda()
{
	var ids = '';
	
	checkejemplo = document.getElementsByName("iProVisID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		var formulario = document.getElementById('form1');
		formulario.action = "index.php?ohaction=frmBuscarVisitas&ids=" + ids;
		formulario.submit();
	}
}

// Filtra los contactos en el listado de la busqueda
function filtrarContactosEnBusqueda()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		var formulario = document.getElementById('form1');
		formulario.action = "index.php?ohaction=dspBuscarContactos&ids=" + ids;
		formulario.submit();
	}
}


// Busca demandas para las propiedades seleccionadas
function demandasMasivoPropiedades()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{	
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoPropiedades');
		
		formulario.action = "index.php?ohaction=filtrarPropiedadesDemandasSeleccionadas&propiedad=1";
		
		formulario.submit();
	}
}


// Filtra las propiedades seleccionadas del listado
function filtrarPropiedadesDemandasHot(id)
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{	
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoPropiedades');
		
		formulario.action = "index.php?ohaction=dspPropriedadesDemanda&id=" + id + "&filtro=true";
		
		formulario.submit();
	}
}



function eliminarMasivoContactos()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimcontacto'])) 
		{
			javascript:document.getElementById('frmListadoContactos').submit();
		}
	}
}

// Eliminar Masivo de Demandas
function eliminarMasivoDemandas(ohaction)
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iDemID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1demanda']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimdemanda'])) 
		{
			formulario=document.getElementById('frmListadoDemandas');
			if(ohaction=='frmBuscarDemandas'){
				formulario.action = "index.php?ohaction=delDemandasSeleccionadas&filtDemandas=true";	
			}			
			formulario.submit();
		}
	}
}

// Eliminar Masivo de Captaciones
function eliminarMasivoCaptaciones()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iCapID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1captacion']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimcaptacion'])) 
		{
			javascript:document.getElementById('frmListadoCaptaciones').submit();
		}
	}
}

// Eliminar Masivo de Visitas
function eliminarMasivoVisitas()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProVisID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimvisitas'])) 
		{
			javascript:document.getElementById('frmListadoDemandasVisitas').submit();
		}
	}
}

// enviar por mail una lista de contactos
function enviarMailMasivoContactos()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=enviarMailMasivoContactos&ids=' + ids, 'enviarMailMasivoContactos', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

// imprimir una lista de contactos seleccionados
function imprimirMasivoContactos()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=imprimirMasivoContactos&ids=' + ids, 'imprimirMasivoContactos', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

// Formulario de subcategoría para Categoría de Propiedad
function formSubcategoria(id, idsub)
{
	window.open('index.php?ohaction=frmModCategoriasPropiedadesSubcategorias&id=' + id + '&idsub=' + idsub, 'formSubcategoria', 'height=200	,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

// Formulario para editar y crear Campos Dinámicos
function formCamposDinamicos(idcat, idcam)
{
	window.open('index.php?ohaction=popupCampoDinamico&idcat=' + idcat + '&idcam=' + idcam, 'popupCampoDinamico', 'height=300,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

// Formulario para agregar opciones a un campo dinámico de tipo Opciones
function formOpciones(id, idcat)
{
	window.open('index.php?ohaction=popupOpciones&idfields=' + id + '&idcat=' + idcat, 'popupOpciones', 'height=500,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
}


// Propiedades
function eliminarMasivoPropiedades(ohaction)
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{	
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimpropiedad'])) 
		{
			formulario=document.getElementById('frmListadoPropiedades');
			if(ohaction=='dspBuscarPropiedades'){
				formulario.action = "index.php?ohaction=delPropiedadesSeleccionadas&filtPropiedades=true";	
			}			
			formulario.submit();			
			//javascript:document.getElementById('frmListadoPropiedades').submit();
		}
	}
}

// enviar por mail una lista de propiedades
function enviarMailMasivoPropiedades()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=enviarMailMasivoPropiedades&ids=' + ids, 'enviarMailMasivoPropiedades', 'height=600,width=860,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}
}

// imprimir una lista de contactos seleccionados
function imprimirMasivoPropiedades()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProID[]");


	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=imprimirMasivoPropiedades&ids=' + ids, 'imprimirMasivoPropiedades', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	

	}
}

// Mostrar la galería de fotos
function mostrarGaleria(id)
{
//	alert (id);
  window.open('gallery/popupfotospropiedadFlash.php?id=' + id, 'Galería de fotos', 'height=700,width=850,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

// Cambia el filtro en el listado de propiedades
function cambiarFiltroActivos(pagina)
{
	formulario = document.getElementById("frmListadoPropiedades");
	formulario.action = "index.php?ohaction=dspPropiedades&pagina="+pagina;
//	alert(formulario.action);
	formulario.submit();
}

// ================================================================================
// y esta funcion????
function cambiarFiltroCaptaciones()
{
	formulario = document.getElementById("frmListadoCaptaciones");
	formulario.action = "";
	formulario.submit();
}

// Demandas Captaciones
// enviar por mail una lista de captaciones
function enviarMailMasivoCaptaciones()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado una captacion
	checkejemplo = document.getElementsByName("iCapID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1captacion']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=enviarMailMasivoCaptaciones&ids=' + ids, 'enviarMailMasivoCaptaciones', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

// imprimir una lista de contactos seleccionados
function imprimirMasivoCaptaciones()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iCapID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1captacion']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=imprimirMasivoCaptaciones&ids=' + ids, 'imprimirMasivoCaptaciones', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

// Filtra las propiedades seleccionadas del listado
function filtrarCaptaciones(ohaction)
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iCapID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{	
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1captacion']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoCaptaciones');
		
		if(ohaction=='dspBuscarCaptacion'){
			formulario.action = "index.php?ohaction=dspBuscarCaptacion&filtCaptaciones=true";	
		}else{
			formulario.action = "index.php?ohaction=filtrarCaptacionesSeleccionadas";
		}		
		
		
		formulario.submit();
	}
}


// ================================================================================



// Trae las subcategorias para la categoria seleccionada
function cambiarSubcategorias() 
{
	var formulario = document.getElementById( 'form1' );

	formulario.action = "index.php?ohaction=frmModPropiedades";
	
	formulario.submit();
}






function eliminarMasivoVisitas()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProVisID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		if(window.confirm('¿Está seguro de que desea eliminar todas las visitas seleccionadas?')) 
		{
			javascript:document.getElementById('frmListadoDemandasVisitas').submit();
		}
	}
}

function guardarVisitas(ids)
{

	iConID = document.getElementById("iConID").value;
	
// iDemID = mandar desde el popup
// Llamar a la funcion de guardar propiedades para la visita por cada propiedad
// hacer un for de 1 a cantidad de propiedades
// Los nombres de los campos estan en un array porque son una cantidad dinamica de propiedades
// hay que mandar todos estos valores a la qry para que haga el insert en la tabla	
	
	// esto se rompeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee y lo necesito la puta madre!
	//alert (document.getElementById("dFechaInicioTarea[1]").value);
	//alert (document.getElementById("h_to[1]").value + ":" + document.getElementById("m_to[1]").value);	
	
	//alert (document.getElementByName("tNotas[]"));
	alert (document.getElementById("tNotas[]"));
	
	total = document.getElementById("tNotas[]");
		
	for (i=0; i <=total.length; ++i)
	{
		tNotas = document.getElementById("tNotas[i]").value;
		iEtaID = document.getElementById("iEtaID[i]").value;

		var ajax = initAjax();

		ajax.open("GET", 'index.php?ohaction=popupSaveVisitas&ids=' + ids +'&iConID=' + iConID +'&iEtaID=' + iEtaID + '&tNotas=' + tNotas);

	
	
	
		ajax.onreadystatechange = function() 

		{
	
			if (ajax.readyState == 4 && ajax.status == 200) 
	
			{
	
				//obj.innerHTML = ajax.responseText;
				//alert(ajax.responseText);
			}
	
		}
		ajax.send(null);
	}

}

// Filtra las propiedades seleccionadas del listado
function filtrarDemandas()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iDemID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{	
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1demanda']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoDemandas');
		
		formulario.action = "index.php?ohaction=filtrarDemandasSeleccionadas";
		
		formulario.submit();
	}
}

function enviarMailMasivoDemandas()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado una captacion
	checkejemplo = document.getElementsByName("iDemID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1demanda']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=enviarMailMasivoDemandas&ids=' + ids, 'enviarMailMasivoDemandas', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

// imprimir una lista de contactos seleccionados
function imprimirMasivoDemandas()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iDemID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1demanda']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=imprimirMasivoDemandas&ids=' + ids, 'imprimirMasivoDemandas', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}

function filtrarVisitas(ohaction,id){
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iProVisID[]");
	var cont=0;
	for (i=0;i<checkejemplo.length;++i){	
		if (checkejemplo[i].checked){
			cont++;
		}
	}
	if (cont == 0){
		alert(leyends['seleccion1visita']);
	}else{
		var formulario = document.getElementById('frmListadoDemandasVisitas');
		
		if(ohaction=='frmModPropiedadesVisitas'){
			formulario.action = "index.php?ohaction=frmModPropiedadesVisitas&id="+id+"&filtVisitas=true";	
		}else{
		//	formulario.action = "index.php?ohaction=filtrarVisitasSeleccionadas";
		}

		if(ohaction=='demandasVisitas'){
			formulario.action = "index.php?ohaction=demandasVisitas&filtVisitas=true";	
		}

		if(ohaction=='frmBuscarVisitas'){
			formulario.action = "index.php?ohaction=frmBuscarVisitas&filtVisitas=true";	
		}else{
			//formulario.action = "index.php?ohaction=filtrarVisitasSeleccionadas";
		}
		
		formulario.submit();
	}
}



function enviarMailMasivoDemandas()

{

	var ids = '';

	

	// verifica primero que se haya seleccionado una captacion

	checkejemplo = document.getElementsByName("iDemID[]");



	for (i=0;i<checkejemplo.length;++i)

	{

		if (checkejemplo[i].checked)

		{

			ids = ids + checkejemplo[i].value + ',';

		}

	}



	if (ids == '')

	{

		alert(leyends['seleccion1demanda']);

	}

	else

	{

		//alert(ids);

		window.open('index.php?ohaction=enviarMailMasivoDemandas&ids=' + ids, 'enviarMailMasivoDemandas', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	

	}



}



// imprimir una lista de contactos seleccionados

function imprimirMasivoDemandas()

{

	var ids = '';

	

	// verifica primero que se haya seleccionado un contacto

	checkejemplo = document.getElementsByName("iDemID[]");



	for (i=0;i<checkejemplo.length;++i)

	{

		if (checkejemplo[i].checked)

		{

			ids = ids + checkejemplo[i].value + ',';

		}

	}



	if (ids == '')

	{

		alert(leyends['seleccion1demanda']);

	}

	else

	{

		//alert(ids);

		window.open('index.php?ohaction=imprimirMasivoDemandas&ids=' + ids, 'imprimirMasivoDemandas', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	

	}



}

// imprimir una lista de Visitas

function imprimirMasivoVisitas()

{

	var ids = '';

	

	// verifica primero que se haya seleccionado un contacto

	checkejemplo = document.getElementsByName("iProVisID[]");



	for (i=0;i<checkejemplo.length;++i)

	{

		if (checkejemplo[i].checked)

		{

			ids = ids + checkejemplo[i].value + ',';

		}

	}



	if (ids == '')

	{

		alert(leyends['seleccion1visita']);

	}

	else

	{

		//alert(ids);

		window.open('index.php?ohaction=imprimirMasivoVisitas&ids=' + ids, 'imprimirMasivoVisitas', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	

	}



}

function enviarMailMasivoVisitas()

{

	var ids = '';

	

	// verifica primero que se haya seleccionado una captacion

	checkejemplo = document.getElementsByName("iProVisID[]");



	for (i=0;i<checkejemplo.length;++i)

	{

		if (checkejemplo[i].checked)

		{

			ids = ids + checkejemplo[i].value + ',';

		}

	}



	if (ids == '')

	{

		alert(leyends['seleccion1visita']);

	}

	else

	{

		//alert(ids);

		window.open('index.php?ohaction=enviarMailMasivoVisitas&ids=' + ids, 'enviarMailMasivoVisitas', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	

	}



}

// Función de conversión de moneda
function dot2comm(n) 
{
	if (n != '' && n != null)
	{
		c = 2;
		d = ',';
		t = '.';
		var m = (c = Math.abs(c) + 1 ? c : 2, d = d || ",", t = t || ".",
		    /(\d+)(?:(\.\d+)|)/.exec(n + "")), x = m[1].length > 3 ? m[1].length % 3 : 0;
		return (x ? m[1].substr(0, x) + t : "") + m[1].substr(x).replace(/(\d{3})(?=\d)/g,
		    "$1" + t) + (c ? d + (+m[2] || 0).toFixed(c).substr(2) : "");		
	} 
	else
	{
	   return 0;	
	}
}
//  End -->

function comm2dot(str)
{
  if (str!="0" && str!="" &&  str!=undefined) 
  {  
    temp = str.replace(".", "", "gi");
    temp = temp.replace(",", ".");
  } 
  else
  {
    temp = 0;
  }
  
  return temp;
}

function remplace(valeur,quoi,parquoi)
{

	valeur=valeur.split(quoi);

	if (parquoi==","){

		var new_valeur=valeur[0]+parquoi+valeur[1];}

	else{

		var new_valeur=parseFloat(valeur[0]+parquoi+valeur[1]);}

	return new_valeur;

}

// SMS
// imprimir una lista de contactos seleccionados
function smsContactos(id)
{
	window.open('index.php?ohaction=smsContactos&id=' + id, 'smsContactos', 'height=400,width=400,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
}


// SMS Masivo
function smsMasivoContactos(id)
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iConID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		//alert(ids);
		//window.open('index.php?ohaction=enviarMailMasivoContactos&ids=' + ids, 'enviarMailMasivoContactos', 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
		window.open('index.php?ohaction=smsMasivoContactos&ids=' + ids, 'smsMasivoContactos', 'height=400,width=400,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
	}
}


// editar visitas
// imprimir una lista de contactos seleccionados
function popupEditarVisita(id)
{
	window.open('index.php?ohaction=popupEditarVisitas&id=' +id,  'popupEditarVisitas', 'height=700,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

// imprimir una lista de contactos seleccionados
function popupCrearVisitas(id)
{
	var ids 		= '';
	
	var iConID 		= '';
	
	var iDemID 		= id;
	

	// verifica primero que se haya seleccionado un contacto
	checkejemplo 	= document.getElementsByName("iProID[]");
	
	iConID 			= document.getElementById("iConID").value;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1propiedad']);
	}
	else
	{

		window.open('index.php?ohaction=popupCrearVisitas&ids=' +ids+'&iConID=' + iConID + '&iDemID=' + iDemID,  'popupCrearVisitas', 'height=700,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}
}


// Ventana de nuevo contacto en demanda
function popupVentanaNuevoContacto()
{
	window.open('index.php?ohaction=popupDemandaNuevoContacto',  'popupVentanaNuevoContacto', 'height=400,width=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


// Ventana de nuevo contacto en captaciones
function popupVentanaNuevoContactoCaptaciones()
{
	window.open('index.php?ohaction=popupNuevoContactoCaptaciones',  'popupNuevoContactoCaptaciones', 'height=400,width=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

// Ventana de nueva propiedad en captaciones
function popupVentanaNuevaPropiedadCaptaciones(id)
{
	window.open('index.php?ohaction=popupNuevaPropiedadCaptaciones&iConID='+id,  'popupNuevaPropiedadCaptaciones', 'height=400,width=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


// Hoja de visita con id
function mostrarHojaVisitasHot(id)
{
	window.open('index.php?ohaction=frmModDemandasHojaVisita&iProVisID=' + id, 'HojaVisita', 'height=850,width=640,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}

/* 
============================
Transacciones
============================
*/
function calcularImportePorcentajeVenta()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioVenta").value);
	var porcentaje 		= comm2dot(document.getElementById("fPorcentajeComisionVenta").value);

	if (importetotal != 0 || porcentaje !=0)
	{
		document.getElementById("fComisionBrutoVenta").value= dot2comm(importetotal*porcentaje/100); 
		document.getElementById("fComisionBrutoVenta");		
	}
}



function calcularPorcentajeVenta()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioVenta").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoVenta").value);


	if (importetotal != 0 || importecomision !=0)
	{
		document.getElementById("fPorcentajeComisionVenta").value= dot2comm(importecomision*100/importetotal);
		document.getElementById("fPorcentajeComisionVenta");
	}
}


function calcularImporteIvaVenta()
{
	var importetotal	= comm2dot(document.getElementById("fComisionBrutoVenta").value);
	var porcentajeiva = comm2dot(document.getElementById("fPorcentajeIva").value);


	if (importetotal != 0 || porcentajeiva !=0)
	{
		importeIva = dot2comm(porcentajeiva*importetotal/100);
		document.getElementById("fImporteIva").value = importeIva;
		return importeIva;
	}
}


function calcularImportePesetasVenta()
{
	var importeEuros 		= comm2dot(document.getElementById("fPrecioFinalVenta").value);
	
	if (importeEuros != 0)
	{
		importeEuros			= new Number (importeEuros);
		var factorconversion	= 166.386;
		factorconversion		= new Number (factorconversion);
		document.getElementById("fPrecioFinalVentapta").value = dot2comm(importeEuros*factorconversion);
	}
}


function calcularTotalEurosVenta()
{

	var importetotal	= comm2dot(document.getElementById("fValorPropietarioVenta").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoVenta").value);
	var importePta		= comm2dot(document.getElementById("fPrecioFinalVentapta").value);
	var importeiva 		= comm2dot(calcularImporteIvaVenta());


	importetotal 		= new Number(importetotal);
	importecomision 	= new Number(importecomision);
	importeiva 			= new Number(importeiva);

		
	document.getElementById("fPrecioFinalVenta").value = dot2comm(importetotal + importecomision + importeiva);

	importepesetas		= calcularImportePesetasVenta();
}


function hideTransaction()
{
	//Effect.toggle('frmTransaction','appear');
	$("div.frmTransaction").slideToggle("slow");
}

function calcularImportePesetasAlquiler()
{
	
	var importeEuros 		= comm2dot(document.getElementById("fComisionInmobiliariaAlquiler").value);
	
	var factorconversion	= new Number(166.386);

	if (importeEuros != 0)
	{
		document.getElementById("fComisionInmobiliariaAlquilerPta").value = dot2comm(importeEuros*factorconversion);
	} 
	else
	{
	   document.getElementById("fComisionInmobiliariaAlquilerPta").value = 0;
	}
	
}

function calcularImportePorcentajeTraspaso()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioTraspaso").value);
	var porcentaje 		= comm2dot(document.getElementById("fPorcentajeComisionTraspaso").value);

	if (importetotal != 0 || porcentaje != 0)
	{
		document.getElementById("fComisionBrutoTraspaso").value = dot2comm(importetotal*porcentaje/100); 
		document.getElementById("fComisionBrutoTraspaso");
	}
}



function calcularPorcentajeTraspaso()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioTraspaso").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoTraspaso").value);

	if (importetotal != 0 || importecomision != 0)
	{
		document.getElementById("fPorcentajeComisionTraspaso").value= dot2comm(importecomision*100/importetotal);
		document.getElementById("fPorcentajeComisionTraspaso");
	}
}



function calcularImporteIvaTraspaso()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioTraspaso").value);
	var porcentajeiva = comm2dot(document.getElementById("fPorcentajeIva").value);

	
	if (importetotal != 0 || porcentajeiva != 0)
	{
		importeIva = dot2comm(porcentajeiva*importetotal/100);
		document.getElementById("fImporteIva").value = importeIva;
		return importeIva;
	}
}


function calcularImportePesetasTraspaso()
{
	var importeEuros 		= comm2dot(document.getElementById("fPrecioFinalTraspaso").value);
	
	if (importeEuros != 0)
	{
		importeEuros			= new Number (importeEuros);
		var factorconversion	= 166.386;
		factorconversion		= new Number (factorconversion);
	
		document.getElementById("fPrecioFinalTraspasopta").value = dot2comm(importeEuros*factorconversion);
	}
}



function calcularTotalEurosTraspaso()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioTraspaso").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoTraspaso").value);
	var importePta		= comm2dot(document.getElementById("fPrecioFinalTraspasopta").value);
	
	if (importetotal != 0 || importecomision != 0 || importePta != 0)
	{
		var importeiva 		= comm2dot(calcularImporteIvaTraspaso());
	
		importetotal 		= new Number(importetotal);
		importecomision 	= new Number(importecomision);
		importeiva 			= new Number(importeiva);
		
		document.getElementById("fPrecioFinalTraspaso").value = dot2comm(importetotal + importecomision + importeiva);
		importepesetas		= calcularImportePesetasTraspaso();
	}
}


function calcularImportePorcentajeAportacion()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioAportacion").value);
	var porcentaje 		= comm2dot(document.getElementById("fPorcentajeComisionAportacion").value);
	
	if (importetotal != 0 || porcentaje != 0)
	{
		document.getElementById("fComisionBrutoAportacion").value= dot2comm(importetotal*porcentaje/100); 
		document.getElementById("fComisionBrutoAportacion");
	}
}


function calcularPorcentajeAportacion()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioAportacion").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoAportacion").value);
	
	if (importetotal != 0 || importecomision !=0)
	{
		document.getElementById("fPorcentajeComisionAportacion").value = dot2comm(importecomision*100/importetotal);
		document.getElementById("fPorcentajeComisionAportacion");
	}
}



function calcularImporteIvaAportacion()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioAportacion").value);
	var porcentajeiva = comm2dot(document.getElementById("fPorcentajeIva").value);
	
	if (importetotal != 0 || importecomision !=0)
	{
		importeIva = dot2comm(porcentajeiva*importetotal/100);
		document.getElementById("fImporteIva").value = importeIva;
		return importeIva;
	}
}


function calcularImportePesetasAportacion()
{
	var importeEuros 		= comm2dot(document.getElementById("fPrecioFinalAportacion").value);
	
	if (importeEuros != 0)
	{
		importeEuros			= new Number (importeEuros);
		var factorconversion	= 166.386;
	
		factorconversion		= new Number (factorconversion);
		document.getElementById("fPrecioFinalAportacionpta").value = dot2comm(importeEuros*factorconversion);
	}
}


function calcularTotalEurosAportacion()
{
	var importetotal	= comm2dot(document.getElementById("fValorPropietarioAportacion").value);
	var importecomision = comm2dot(document.getElementById("fComisionBrutoAportacion").value);
	var importePta		= comm2dot(document.getElementById("fPrecioFinalAportacionpta").value);
	
	if (importetotal != 0 || importecomision != 0 || importePta != 0)
	{
		var importeiva 		= comm2dot(calcularImporteIvaAportacion());
	
		importetotal 		= new Number(importetotal);
		importecomision 	= new Number(importecomision);
		importeiva 			= new Number(importeiva);
	
		document.getElementById("fPrecioFinalAportacion").value = dot2comm(importetotal + importecomision + importeiva);
		importepesetas		= calcularImportePesetasAportacion();
	}
}

function showDiv(div)
{
	div = document.getElementById(div);
	
	if (div.style.visibility == 'hidden')
	{
		div.style.visibility = 'visible';
	}
	else
	{
		div.style.visibility = 'hidden';
	}
}

// Ventana de nuevo contacto en demanda
function popupVentanaNuevoContactoVendedores()
{
	window.open('index.php?ohaction=popupNuevoContactoVendedores',  'popupventanaNuevoContactoVendedores', 'height=400,width=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');
}


function displayElement(id, bDisplay)
{
	div = document.getElementById(id);
	div.style.display = bDisplay? '' : 'none';
}

function eliminarMasivoVendedores()
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iVenID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		if(window.confirm(leyends['seguroelimvisitas'])) 
		{
			 document.getElementById('frmListadoVendedores').action="index.php?ohaction=delVendedoresSeleccionados";
     		 document.getElementById('frmListadoVendedores').submit();
		}
	}
}



function filtrarVendedores(ohaction,id)
{
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iVenID[]");
	var cont=0;

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			cont++;
		}
	}
	
	if (cont == 0)
	{
		alert(leyends['seleccion1contacto']);
	}
	else
	{
		var formulario = document.getElementById('frmListadoVendedores');
		
		if(ohaction=='dspBuscarVendedores'){
			formulario.action = "index.php?ohaction=dspBuscarVendedores&filtVendedores=true";	
		}else{
			formulario.action = "index.php?ohaction=filtrarVendedoresSeleccionados";
		}		
		
		
		
		formulario.submit();
	}
}

// enviar por mail una lista de contactos
function enviarMailMasivoVendedores()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iVenID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=enviarMailMasivoVendedores&ids=' + ids, 'enviarMailMasivoVendedores', 'height=600,width=900,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}


// imprimir una lista de contactos seleccionados
function imprimirMasivoVendedores()
{
	var ids = '';
	
	// verifica primero que se haya seleccionado un contacto
	checkejemplo = document.getElementsByName("iVenID[]");

	for (i=0;i<checkejemplo.length;++i)
	{
		if (checkejemplo[i].checked)
		{
			ids = ids + checkejemplo[i].value + ',';
		}
	}

	if (ids == '')
	{
		alert(leyends['seleccion1visita']);
	}
	else
	{
		//alert(ids);
		window.open('index.php?ohaction=imprimirMasivoVendedores&ids=' + ids, 'imprimirMasivoVendedores', 'height=400,width=800,status=no,toolbar=no,menubar=no,location=no,resizable=yes, scrollbars=yes');	
	}

}
// imprimirMasivoVendedores is not defined


//Mario Garcia: anexe un controlador para el formulario de visitas
function  sendFormLocal(poForm){
  var _ele = document.getElementById('iConID');
  if ( !_ele || _ele.value == ''){
    errorOn(_ele, leyends['contactonoanonimo']);
		return false;    
  }
  return sendForm(poForm);
  
}

// leocelis: si se trata de la transaccion alquiler
// entonces mostrar el div
function mostrarDivMinisterio()
{
  var valor = document.getElementById('tipo_transaccion').value;
  var div = document.getElementById('divAdherida');

  if (parseInt(valor) == 2)
  {
    // muestra el div  
    div.style.display = '';
  }
  else
  {
    // oculta el div
    div.style.display = 'none';
  }
}

// seleccionar tipo de cartel escaparate
function seleccionarCartel(id)
{
 var width  = 700;
 var height = 680;
 //var left   = (screen.width  - width)/2;
 //var top    = (screen.height - height)/2;
 var left   = 0;
 var top    = 0;

 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=no';
 params += ', toolbar=no';
 
 newwin=window.open('index.php?ohaction=seleccionarCartel&id=' + id,'abrirPopup', params);
 if (window.focus) {newwin.focus()}
 return false;
}
// ** TAMAñO DE FUENTE ***
 //var tgs = new Array( 'text');
 //Specify spectrum of different font sizes:
/* var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
 var startSz=new Array();
 function ts( trgt,inc ) {
  	var tgs = new Array( trgt);
	//alert(startSz[trgt]);
	if(startSz[trgt]==undefined){
		startSz[trgt] = 4;	
	}
	if (!document.getElementById) return
		var d = document,cEl = null,sz = startSz[trgt],i,j,cTags;
		sz += inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 6 ) sz = 6;
		startSz[trgt] = sz;
		if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
		cEl.style.fontSize = szs[ sz ];
		//alert(cEl.style);
		cEl.style.fontSize = '2000px';
		for ( i = 0 ; i < tgs.length ; i++ ) {
			cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) {
			cTags[ j ].style.fontSize = szs[ sz ];
		}
	}
}
*/

 var szs = new Array( '10px','12px','14px','16px','18px','20px','22px','24px','26px','28px','30px','32px','34px','36px' );
 var startSz=new Array();
 function ts( trgt,inc ) {
  	var tgs = new Array( trgt);
	//alert(startSz[trgt]);
	if(startSz[trgt]==undefined){
		startSz[trgt] = 5;	
	}
	if (!document.getElementById) return
		var d = document,cEl = null,sz = startSz[trgt],i,j,cTags;
		sz += inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 14 ) sz = 14;
		startSz[trgt] = sz;
		if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
		cEl.style.fontSize = szs[ sz ];
		//alert(cEl.style);
		//cEl.style.fontSize = '2000px';
		for ( i = 0 ; i < tgs.length ; i++ ) {
			cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) {
			cTags[ j ].style.fontSize = szs[ sz ];
		}
	}
}


	var nav4 = window.Event ? true : false;
	function solonumeros ( evt ) {
	//alert(evt);
	 // NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	 var key = nav4 ? evt.which : evt.keyCode;
	
	 return (key <= 13 || (key >= 48 && key <= 57));
	
	}


// Class: Dump
// Author: Shuns (www.netgrow.com.au/files)
// Last Updated: 10/10/06
// Version: 1.1
var_dump=function(object, showTypes){
var dump='';
var st=typeof showTypes=='undefined' ? true : showTypes;
var now = new Date( );
var winName='dumpWin' + now.toString();
var browser=_dumpIdentifyBrowser();
var w=760;
var h=500;
var leftPos=screen.width ?(screen.width-w)/ 2 : 0;var topPos=screen.height ?(screen.height-h)/ 2 : 0;
var settings='height='+h+',width='+w+',top='+topPos+',left='+leftPos+',scrollbars=yes,menubar=yes,status=yes,resizable=yes';
var title='.:: Dump | ' + now.toString() + ' | Fuck You! ::.';
var script='function tRow(s){t=s.parentNode.lastChild;tTarget(t, tSource(s));}function tTable(s){var switchToState=tSource(s);var table=s.parentNode.parentNode;for(var i=1;i < table.childNodes.length;i++){t=table.childNodes[i];if(t.style){tTarget(t, switchToState);}}}function tSource(s){if(s.style.fontStyle=="italic"||s.style.fontStyle==null){s.style.fontStyle="normal";s.title="click to collapse";return "open";}else{s.style.fontStyle="italic";s.title="click to expand";return "closed";}}function tTarget(t, switchToState){if(switchToState=="open"){t.style.display="";}else{t.style.display="none";}}';
dump+=(/string|number|undefined|boolean/.test(typeof(object))||object==null)? object : recurse(object, typeof object);
winName=window.open('', winName, settings);
if(browser.indexOf('ie')!=-1||browser=='opera'||browser=='ie5mac'||browser=='safari'){winName.document.write('<html><head><title> '+title+' </title><script type="text/javascript">'+script+'</script><head>');winName.document.write('<body>'+dump+'</body></html>');}else{winName.document.body.innerHTML=dump;winName.document.title=title;var ffs=winName.document.createElement('script');ffs.setAttribute('type', 'text/javascript');ffs.appendChild(document.createTextNode(script));winName.document.getElementsByTagName('head')[0].appendChild(ffs);}winName.focus();function recurse(o, type){var i;var j=0;var r='';type=_dumpType(o);switch(type){case 'regexp':var t=type;r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>RegExp: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case 'date':var t=type;r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>Date: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case 'function':var t=type;var a=o.toString().match(/^.*function.*?\((.*?)\)/im);var args=(a==null||typeof a[1]=='undefined'||a[1]=='')? 'none' : a[1];r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td colspan="2"'+_dumpStyles(t,'td-value')+'><table'+_dumpStyles('arguments','table')+'><tr><td'+_dumpStyles('arguments','td-key')+'><i>Arguments: </i></td><td'+_dumpStyles(type,'td-value')+'>'+args+'</td></tr><tr><td'+_dumpStyles('arguments','td-key')+'><i>Function: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o+'</td></tr></table>';j++;break;case 'domelement':var t=type;r+='<table'+_dumpStyles(t,'table')+'><tr><th colspan="2"'+_dumpStyles(t,'th')+'>'+t+'</th></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Name: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeName.toLowerCase()+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Type: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeType+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>Node Value: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.nodeValue+'</td></tr>';r+='<tr><td'+_dumpStyles(t,'td-key')+'><i>innerHTML: </i></td><td'+_dumpStyles(type,'td-value')+'>'+o.innerHTML+'</td></tr>';j++;break;}if(/object|array/.test(type)){for(i in o){var t=_dumpType(o[i]);if(j < 1){r+='<table'+_dumpStyles(type,'table')+'><tr><th colspan="2"'+_dumpStyles(type,'th')+'>'+type+'</th></tr>';j++;}if(typeof o[i]=='object' && o[i]!=null){r+='<tr><td'+_dumpStyles(type,'td-key')+'>'+i+(st ? ' ['+t+']' : '')+'</td><td'+_dumpStyles(type,'td-value')+'>'+recurse(o[i], t)+'</td></tr>';}else if(typeof o[i]=='function'){r+='<tr><td'+_dumpStyles(type ,'td-key')+'>'+i+(st ? ' ['+t+']' : '')+'</td><td'+_dumpStyles(type,'td-value')+'>'+recurse(o[i], t)+'</td></tr>';}else{r+='<tr><td'+_dumpStyles(type,'td-key')+'>'+i+(st ? ' ['+t+']' : '')+'</td><td'+_dumpStyles(type,'td-value')+'>'+o[i]+'</td></tr>';}}}if(j==0){r+='<table'+_dumpStyles(type,'table')+'><tr><th colspan="2"'+_dumpStyles(type,'th')+'>'+type+' [empty]</th></tr>';}r+='</table>';return r;};};_dumpStyles=function(type, use){var r='';var table='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;cell-spacing:2px;';var th='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;text-align:left;color: white;padding: 5px;vertical-align :top;cursor:hand;cursor:pointer;';var td='font-size:xx-small;font-family:verdana,arial,helvetica,sans-serif;vertical-align:top;padding:3px;';var thScript='onClick="tTable(this);" title="click to collapse"';var tdScript='onClick="tRow(this);" title="click to collapse"';switch(type){case 'string':case 'number':case 'boolean':case 'undefined':case 'object':switch(use){case 'table':r=' style="'+table+'background-color:#0000cc;"';break;case 'th':r=' style="'+th+'background-color:#4444cc;"'+thScript;break;case 'td-key':r=' style="'+td+'background-color:#ccddff;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;case 'array':switch(use){case 'table':r=' style="'+table+'background-color:#006600;"';break;case 'th':r=' style="'+th+'background-color:#009900;"'+thScript;break;case 'td-key':r=' style="'+td+'background-color:#ccffcc;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;case 'function':switch(use){case 'table':r=' style="'+table+'background-color:#aa4400;"';break;case 'th':r=' style="'+th+'background-color:#cc6600;"'+thScript;break;case 'td-key':r=' style="'+td+'background-color:#fff;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;case 'arguments':switch(use){case 'table':r=' style="'+table+'background-color:#dddddd;cell-spacing:3;"';break;case 'td-key':r=' style="'+th+'background-color:#eeeeee;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;}break;case 'regexp':switch(use){case 'table':r=' style="'+table+'background-color:#CC0000;cell-spacing:3;"';break;case 'th':r=' style="'+th+'background-color:#FF0000;"'+thScript;break;case 'td-key':r=' style="'+th+'background-color:#FF5757;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;case 'date':switch(use){case 'table':r=' style="'+table+'background-color:#663399;cell-spacing:3;"';break;case 'th':r=' style="'+th+'background-color:#9966CC;"'+thScript;break;case 'td-key':r=' style="'+th+'background-color:#B266FF;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;case 'domelement':switch(use){case 'table':r=' style="'+table+'background-color:#FFCC33;cell-spacing:3;"';break;case 'th':r=' style="'+th+'background-color:#FFD966;"'+thScript;break;case 'td-key':r=' style="'+th+'background-color:#FFF2CC;color:#000000;cursor:hand;cursor:pointer;"'+tdScript;break;case 'td-value':r=' style="'+td+'background-color:#fff;"';break;}break;}return r;};_dumpIdentifyBrowser=function(){var agent=navigator.userAgent.toLowerCase();if (typeof window.opera != 'undefined'){return 'opera';} else if (typeof document.all != 'undefined'){if (typeof document.getElementById != 'undefined'){var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, '$1').replace(/ /, '');if(typeof document.uniqueID != 'undefined') {if (browser.indexOf('5.5') != -1){return browser.replace(/(.*5\.5).*/, '$1');}else{return browser.replace(/(.*)\..*/, '$1');}}else{return 'ie5mac';}}}else if(typeof document.getElementById != 'undefined'){if (navigator.vendor.indexOf('Apple Computer, Inc.')!=-1) {return 'safari';}else if(agent.indexOf('gecko')!=-1) {return 'mozilla';}}return false;};_dumpType=function(obj){var t=typeof(obj);if(t=='function'){var f=obj.toString();if((/^\/.*\/[gi]??[gi]??$/).test(f)){return 'regexp';}else if((/^\[object.*\]$/i).test(f)){t='object'}}if(t !='object'){return t;}switch(obj){case null:return 'null';case window:return 'window';case document:return document;case window.event:return 'event';}if(window.event &&(event.type==obj.type)){return 'event';}var c=obj.constructor;if(c !=null){switch(c){case Array:t='array';break;case Date:return 'date';case RegExp:return 'regexp';case Object:t='object';break;case ReferenceError:return 'error';default:var sc=c.toString();var m=sc.match(/\s*function(.*)\(/);if(m !=null){return 'object';}}}var nt=obj.nodeType;if(nt !=null){switch(nt){case 1:if(obj.item==null){return 'domelement';}break;case 3:return 'string';}}if(obj.toString !=null){var ex=obj.toString();var am=ex.match(/^\[object(.*)\]$/i);if(am !=null){var am=am[1];switch(am.toLowerCase()){case 'event':return 'event';case 'nodelist':case 'htmlcollection':case 'elementarray':return 'array';case 'htmldocument':return 'htmldocument';}}}return t;};

