  // JavaScript Document

/* Legenda *****************************************************************/
var x = 1 
legenda = function (obj) {
	rivieraimobiliaria.AjaxService.precos(sucessoLegenda, falhaLegenda, obj);
}

sucessoLegenda = function (arg, obj) {
	var valores = arg.split(";");
	var leg = document.getElementById(obj);

	var v1 = valores[0].split("/");
	var v2= valores[1].split("/");
	var v3 = valores[2].split("/");
	var v4 = valores[3].split("/");
	var v5 = valores[4].split("/");

	with (leg) {
		style.marginLeft = "5px";
		//style.width = "50px";
		style.display = "inline";
		style.verticalAlign = "top";
		
		innerHTML = '<a href="javascript:;" class="preto t9 tahoma" onMouseOver="escondeMostra(\'leg'+x+'\')" onMouseOut="escondeMostra(\'leg'+x+'\')">'
			+ '<img src="/layout/ico.legenda.gif" width="10" height="10" style="vertical-align:bottom; border:0px; margin:0px 5px; display:inline;">ver legenda</a>'
			+ '<div id="sombra_leg'+x+'" class="legenda-sombra">&nbsp;</div>'
			+ '<div id="leg'+x+'" class="legenda">'
			+ '<table width="100%" border="0" cellspacing="0" cellpadding="2" class="t9">'
			+ '	<tr>'
			+ '  <td height="20" colspan="2" align="center"><strong>Faixas de Valores </strong></td>'
			+ '</tr>'
			+ '<tr>'
			+ '  <td align="right" width="1%"><img src="/layout/det.1star.gif" alt=""></td>'
			+ '  <td>at&eacute; ' + v1[1] + ' mil</td>'
			+ '</tr>'
			+ '<tr>'
			+ '  <td align="right"><img src="/layout/det.2star.gif" alt=""></td>'
			+ '  <td>de ' + v2[0] + ' a ' + v2[1] + ' mil</td>'
			+ '</tr>'
			+ '<tr>'
			+ '  <td align="right"><img src="/layout/det.3star.gif" alt=""></td>'
			+ '  <td>de ' + v3[0] + ' a ' + v3[1] + ' mil</td>'
			+ '</tr>'
			+ '<tr>'
			+ '  <td align="right"><img src="/layout/det.4star.gif" alt=""></td>'
			+ '  <td>de ' + v4[0] + ' a ' + v4[1] + ' mil</td>'
			+ '</tr>'
			+ '<tr>'
			+ '  <td align="right"><img src="/layout/det.5star.gif" alt=""></td>'
			+ '  <td>acima de ' + v5[0] + ' mil</td>'
			+ '</tr>'
			+ '</table>'
			+ '</div>'
	}
	x++;
}

falhaLegenda = function (arg) {
	alert("Ocorreu uma falha na leitura dos valores!");
}


/* Favoritos ***************************************************************/
favoritos = function (elem, foto) {
	var caminho =  elem.src.substr(0, elem.src.lastIndexOf("/") + 1);

	for (x = 0; x < 16; x++) {
		var x2 = ((x < 10) ? "0" : "") + x;
		var limpa = document.getElementById("datalistfotos_ctl" + x2 +"_fav");

		try {
			limpa.src = caminho + "nk.gif";
		} catch (e) { break; }			
	}
	
	var ref = foto.substr(0, foto.indexOf("_")).replace("imovel", "");
	
	elem.src = caminho + "ok.gif";
	
	rivieraimobiliaria.AjaxService.mudaFavorito(ref, foto, favSucesso, favErro);
}

favSucesso = function(arg) { }

favErro = function(erro) {
	alert("Ocorreu um erro na mudan&ccedil;a da foto favorita.");
}



/* Checagem de referência *********************************************************************/
checarRef = function(obj) {
	rivieraimobiliaria.AjaxService.checarRef(obj.value, refSucesso, refErro, obj);
}

refSucesso = function(arg, obj) {
	if (arg.toLowerCase() == "true") {
		alert("Já existe um imóvel com esta referência.\nPor favor escolha outra.");
		obj.select();
	}
}

refErro = function(erro) {
	alert("Ocorreu um erro na checagem de referências já existentes.");
}



/* Indicação *********************************************************************************/

/* Checa se e-mail e nome já estão cadastrados na mala dieta */
checaEmail = function(obj) {
	var elem = document.getElementById(obj);
	var id = document.getElementById("txtid")

	if (elem.value != "") {
		if (validarEmail(elem))
			rivieraimobiliaria.AjaxService.checaEmail(elem.value, id.value, checaEmailSucesso, checaEmailErro, obj);
		else
			alert("E-mail inválido.\nVerifique se o digitou corretamente.");
	}
	
	return false;
}

var xyz;
checaEmailSucesso = function(arg, obj) {
	if (!arg && arg != "") {
		__doPostBack('botmaisemail','');
		xyz = setInterval("document.getElementById('" + obj + "').select(); clearInterval(xyz);", 500);
	} else {
		var str = arg.split(",");
		alert("Este e-mail já foi cadastrado, abaixo informações:\n" +
			  "\nCorretor(a): " + str[0].toUpperCase() + 
			  "\nCliente " + str[1].toUpperCase());
	}
}

checaEmailErro = function(erro) {
	alert("Infelizmente ocorreu um erro na comunicação com o servidor.\n" +
		  "Aguarde um momento e tente novamente ou contacte o administrador do sistema.");
}

checaNome = function(obj) {
	//rivieraimobiliaria.AjaxService.checaNome(obj.value, checaNomeSucesso, checaNomeErro, obj);
}

checaNomeSucesso = function(arg, obj) {
	if (arg.toLowerCase() == "true") {
		alert("Este nome já se encontra cadastrado no sistema.");
		obj.select();
	}
}

checaNomeErro = function(erro) {
	alert("Infelizmente ocorreu um erro na comunicação com o servidor.\n" +
		  "Aguarde um momento e tente novamente ou contacte o administrador do sistema.");
}




/* Cadastro de emails *********************************************************************************/
validarMala = function(botao) {
	var tabEmails = document.getElementById("DataListEmails");
	
	try {
		if (tabEmails.rows.length > 0) {
			botao.disabled = true;
			__doPostBack('botcadastrar','');
		}
	}
	catch(e) {
		alert("Você precisa cadastrar pelo menos um e-mail para o contato.");
	}	

	return false;
}

/* Checa se cod já existe na mala dieta */
checaCodigo = function(obj) {
	if (obj.value != "") 
		rivieraimobiliaria.AjaxService.checaCodigo(obj.value, checaCodigoSucesso, checaCodigoErro, obj);
	else
		document.getElementById("botcadastrar").disabled = true;
}

checaCodigoSucesso = function(arg, obj) {
	var botCadastrar = document.getElementById("botcadastrar");
	
	if (arg) {
		var str = arg.split(",");
		alert("Este código já foi cadastrado, abaixo informações:\n" +
			  "\nCorretor(a): " + str[0].toUpperCase() + 
			  "\nCliente: " + str[1].toUpperCase());
		obj.select();
		botCadastrar.disabled = true;
		
	} else {
		botCadastrar.disabled = false;		
	}
}

checaCodigoErro = function(erro) {
	alert("Infelizmente ocorreu um erro na comunicação com o servidor.\n" +
		  "Aguarde um momento e tente novamente ou contacte o administrador do sistema.");
}


/* Mala Direta *********************************************************************************/
var tempoEspera = 5000;
var enviado = false;

var email = { 
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div	= document.createElement("div");
		//var trAssunto = document.getElementById("trassunto");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			//height = getPageSize()[1] + "px"; //"100%";
			
			if (navigator.appName.indexOf("MSIE 6") >= 0 )
				height = "100%";
			else
				height = document.documentElement.scrollHeight + "px";
			
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}

		/*with (trAssunto.style) {
			 visibility = "hidden";
			 position = "absolute";
		}*/
		
		objBody.appendChild(div);
		
		//document.getElementById("divfundo").style.height = getPageSize()[1] + "px";
	},
	
	
	resize: function() {
		document.getElementById("divfundo").style.height = getPageSize()[1] + "px";
	},
	
	
	mostrar: function() {
		var divop	= document.getElementById("divindique");
		var div		= document.getElementById("divfundo");
		
		with (divop.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divop.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divop.clientHeight) / 2) + "px";
		}
		
		email.resize();
		
		div.style.visibility = "visible";
		divop.style.visibility = "visible";

		document.getElementById("total").innerHTML = 0;
		document.getElementById("atual").innerHTML = 0;
		document.getElementById("emailSucesso").innerHTML = 0;
		document.getElementById("emailErro").innerHTML = 0;

		//return false;
	},
	
	
	fim: function() {
		var divop	= document.getElementById("divindique");
		var div		= document.getElementById("divfundo");

		div.style.visibility = "hidden";
		divop.style.visibility = "hidden";

		clearInterval(mala);
		
		if (enviado) {
			enviado = false;
			self.location.reload(true);
		}
		
		document.getElementById("botCancelar").value = "cancelar";
		
		return false;
	},
	
	
	enviar: function() {
		setTimeout("rivieraimobiliaria.AjaxService.qtdadeEmailsParaEnviar(sucessoMalaDados, falhaMala)", 2000);
		//alert();
		email.mostrar();
	}
}

sucessoMalaDados = function(arg) {
	if (arg <= 0) {
		document.getElementById("botCancelar").value = "fechar" ;
		alert("Não há e-mails para serem enviados!");
		return true;
	}
	
	document.getElementById("total").innerHTML = arg;

	enviarMala();
}

falhaMala = function(erro) {
	alert(erro.message);
}


enviarMala = function() {
	rivieraimobiliaria.AjaxService.enviarEmailMala(sucessoMalaEnvio, erroMalaEnvio)
	document.getElementById("atual").innerHTML++;
}

var mala = null;
sucessoMalaEnvio = function(arg) {
	if (arg == '' || arg == null) { 
		enviado = true;
		clearInterval(mala);
		document.getElementById("botCancelar").value = "fechar" ;
		document.getElementById("atual").innerHTML--;
		alert("Envio de mala direta finalizado!");
		rivieraimobiliaria.AjaxService.erroMala(listarEmailsErro, falhaMala)

		return false;
		
	} else if (arg == 'true') {
		document.getElementById("emailSucesso").innerHTML++;

	} else {
		document.getElementById("emailAnalise").innerHTML++;
	}
	
	mala = setTimeout("enviarMala(sucessoMalaEnvio, erroMalaEnvio)", tempoEspera);
}

erroMalaEnvio = function(erro) {
	//var a = document.getElementById("");
	//a.hasAttributes()
	//for (myKey in erro){
	//	alert ("myObj["+myKey +"] = " + erro[myKey]);
	//}
	//a = window.open();
	//a.document.write(erro._message);
	
	document.getElementById("emailErro").innerHTML++;
	mala = setTimeout("enviarMala(sucessoMalaEnvio, erroMalaEnvio)", tempoEspera);
}

listarEmailsErro = function(arg) {
	if(arg != null) {
		var linha = arg.split("#");
		
		var janela = window.open("", "", "");
		
		with (janela.document) {
			write("<html><body style='font-family:tahoma; font-size:12px;'>");
			write("<p>Verifique abaixo os emais que obtiveram erro no envio.</p>");
			
			for(x=0; x<linha.length-1; x++) {
				var campo = linha[x].split("/");
				write("<p><strong style='color:#f00'>" + campo[1] + "</strong><br />");
				write("<strong>Cód Sistema: </strong>" + campo[0] + "<br />");
				write("<strong>E-mail:</strong> " + campo[2] + "<br />");
				write("<strong>Erro:</strong> " + campo[3] + "</p>");
			}
			
			write("</body></html>");
		}
	}
}



/* Detalhes de erro na mala ********************************************************************/
var indicacao = {
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div	= document.createElement("div");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			//height = getPageSize()[1] + "px"; //"100%";
			
			//if (navigator.appName.indexOf("MSIE 6") >= 0 )
			//	height = "100%";
			//else
			//	height = document.documentElement.scrollHeight + "px";
			
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}
		
		objBody.appendChild(div);
		
		//document.getElementById("divfundo").style.height = getPageSize()[1] + "px";
	},
	
	resize: function() {
		$get("divfundo").style.height = getPageSize()[1] + "px"
	},
	
	detalhe: function (codIndErro) {
		indicacao.aguarde();
		rivieraimobiliaria.AjaxService.detalheIndicacaoNaoEnviada(codIndErro, sucessoDetInd, erroDetInd);
	},
	
	aguarde: function () {
		var divFundo = document.getElementById("divfundo");
		divFundo.style.visibility = "visible";
		
		with ($get("divDetalhes").style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetalhes.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetalhes.clientHeight) / 2) + "px";
			visibility = "visible";
		}
	},
	
	mostrar: function (str) {
		indicacao.resize()
		var divDetalhes = document.getElementById("divDetalhes");
				
		divDetalhes.innerHTML = str +
			"<center><input type='button' value='  fechar  ' class='t9' onclick='indicacao.ocultar();' /></center>";
			
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetalhes.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetalhes.clientHeight) / 2) + "px";
		}
	},
	
	ocultar: function() {
		with ($get("divfundo").style) {
			visibility = "hidden";
			height = "1px";
		}
		
		with ($get("divDetalhes").style) {
			visibility = "hidden";
			top = "1px";
		}
	}
}

sucessoDetInd = function (arg) {
	indicacao.mostrar(arg);
}

erroDetInd = function (arg) {}


var liPos = 1;
var reTimer = null;
var proxTimer = null;


/* Reenvio de e-mail ***************************************************************************/
reenviar = function (obj) {
	var dgv = $get(obj);//document.getElementById(obj);

	if (liPos < dgv.rows.length-1) {
		var codIndErro = $get("DataGrid1_ctl0" + (liPos+1) + "_erro");
		var img = document.createElement("img");
	
		proxPos(obj);
		
		rivieraimobiliaria.AjaxService.reenviarIndicacao(codIndErro.value, sucessoReenviar, erroReenviar, obj);
	} 
	
	//return false;
}

sucessoReenviar = function (arg, obj) {
	var dgv = $get("DataGrid1");
	var img = document.createElement("img");
	
	img.src = "img/\ico.ok.gif";
	img.setAttribute('alt','enviado com sucesso');

	dgv.rows[liPos].cells[0].removeChild(dgv.rows[liPos].cells[0].lastChild);
	dgv.rows[liPos].cells[0].appendChild(img);
		
	liPos++;
	proxTimer = setTimeout("proxPos('" + obj + "');", 300)	;
}

erroReenviar = function (erro, obj) {
	var dgv = $get(obj);
	var img = document.createElement("img");
	
	img.src = "img/\ico.excluir.gif";
	img.setAttribute('alt','erro no envio');

	dgv.rows[liPos].cells[0].removeChild(dgv.rows[liPos].cells[0].lastChild);
	dgv.rows[liPos].cells[0].appendChild(img);
		
	liPos++;
	proxTimer = setTimeout("proxPos('" + obj + "');", 300)	;
	
	//alert(erro._message);
}

proxPos = function(obj) {
	var dgv = $get(obj);
	
	if (liPos < dgv.rows.length-1) {
		var imgProx = document.createElement("img");
		
		imgProx.src = "img/\ico.enviando.gif";
		imgProx.setAttribute('alt','enviando');
		
		dgv.rows[liPos].cells[0].innerHTML = "";
		dgv.rows[liPos].cells[0].appendChild(imgProx);
		dgv.rows[liPos].cells[3].innerHTML = "";
		
		reTimer = setTimeout("reenviar('" + obj + "')", 5000);
		
	} else {
		clearInterval(reTimer);
		clearInterval(proxTimer);
		
		if (confirm("Reenvio de e-mails finalizado!\nDeseja recarregar a página?"))
			location.reload(true);
	}
}



/* Histórico de indicações ********************************************************************/
var ultInfo = null;
var historico = {
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div	= document.createElement("div");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			//height = getPageSize()[1] + "px"; //"100%";
			
			//if (navigator.appName.indexOf("MSIE 6") >= 0 )
			//	height = "100%";
			//else
			//	height = document.documentElement.scrollHeight + "px";
			
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}
		
		objBody.appendChild(div);
		
		//document.getElementById("divfundo").style.height = getPageSize()[1] + "px";
	},
	
	resize: function() {
		$get("divfundo").style.height = getPageSize()[1] + "px"
	},
	
	detalhe: function (codIndErro) {
		indicacao.aguarde();
		rivieraimobiliaria.AjaxService.detalhesIndicacao(codIndErro, sucessoDetInd, erroDetInd);
	},
	
	aguarde: function () {
		var divFundo = document.getElementById("divfundo");
		divFundo.style.visibility = "visible";
		
		with ($get("divDetalhes").style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetalhes.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetalhes.clientHeight) / 2) + "px";
			visibility = "visible";
		}
	},
	
	mostrar: function () {
		historico.resize()

		$get("divfundo").style.visibility = "visible";
		
		var divHistorico = document.getElementById("divHistorico");
			
		with (divHistorico.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divHistorico.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divHistorico.clientHeight) / 2) + "px";
			visibility = "visible";
		}
		
		//return false;
		
		//__doPostBack('botHistorico','');
	},
	
	ocultar: function() {
		with ($get("divfundo").style) {
			visibility = "hidden";
			height = "1px";
		}
		
		with ($get("divHistorico").style) {
			visibility = "hidden";
			top = "1px";
		}
		
		try {
			ultInfo.style.visibility = "hidden";
			ultInfo = null; 
		} catch(e) {}
	},
	
	mostrarInfo: function (codInd, sender) {
		sender.innerText = (sender.innerText == "[+]") ? "[-]" : "[+]";
		
		rivieraimobiliaria.AjaxService.detalheIndicacaoEnviada(codInd, sucessoHistInd, erroHistInd, codInd);
	}
}

sucessoHistInd = function(arg, codInd) {
	try {
		if (ultInfo.id != "info" + codInd) {
			ultInfo.style.visibility = "hidden";
			ultInfo = null; 
		}
	} catch(e) {}
	
	
	$get("info" + codInd).innerHTML = arg;

	with ($get("info" + codInd).style) {
		if (visibility == "visible") {
			visibility = "hidden";
			position = "absolute";
		} else {
			visibility = "visible";
			ultInfo = $get("info" + codInd);
			//position = "static";
		}
	}
}

erroHistInd = function(erro) {
}



/* Análise de E-mals **************************************************************************/
var liPosAnalise = 0;
var analiseTimer = null;

var analise = {
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div	= document.createElement("div");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			//height = getPageSize()[1] + "px"; //"100%";
			
			//if (navigator.appName.indexOf("MSIE 6") >= 0 )
			//	height = "100%";
			//else
			//	height = document.documentElement.scrollHeight + "px";
			
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}
		
		objBody.appendChild(div);
		
		//document.getElementById("divfundo").style.height = getPageSize()[1] + "px";
	},
	
	resize: function() {
		$get("divfundo").style.height = getPageSize()[1] + "px"
	},
	
	detalhe: function (codInd) {
		analise.aguarde();
		rivieraimobiliaria.AjaxService.detalheIndicacaoAnalise(codInd, sucessoAnaliseInd, erroAnaliseInd);
	},
	
	aguarde: function () {
		var divFundo = document.getElementById("divfundo");
		divFundo.style.visibility = "visible";
		
		with ($get("divDetalhes").style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetalhes.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetalhes.clientHeight) / 2) + "px";
			visibility = "visible";
		}
	},
	
	ocultar: function() {
		with ($get("divfundo").style) {
			visibility = "hidden";
			height = "1px";
		}
		
		with ($get("divHistorico").style) {
			visibility = "hidden";
			top = "1px";
		}
		
		try {
			ultInfo.style.visibility = "hidden";
			ultInfo = null; 
		} catch(e) {}
	},
	
	enviar: function(assimMesmo) {
		var tabela = $get("DataGrid1");
		var terminado = true;
		
		if (liPosAnalise>0) 
			liPosAnalise++;
			
		for(x=liPosAnalise; x < tabela.rows.length-1; x++) {
			var chk = tabela.rows[x].cells[2].firstChild;
			var codAnalise = chk.id.replace("chk","");
			var imgProx = document.createElement("img");


			 if (chk.checked && codAnalise.toLowerCase() != "todos") {
			 	liPosAnalise = x;
				terminado = false;
				
				imgProx.src = "img/\ico.enviando.gif";
				imgProx.setAttribute('alt','enviando');
	
				tabela.rows[x].cells[0].appendChild(imgProx);
				
				
				if (assimMesmo) {
					rivieraimobiliaria.AjaxService.enviarAssimMesmo(codAnalise, sucessoEAM, erroEAM);
				} else {
					rivieraimobiliaria.AjaxService.enviarSemRef(codAnalise, sucessoSR, erroSR);
				}
				
				
				$get("botAssimMesmo").disabled = true;
				$get("botSemRef").disabled = true;
				
				break;
			 }
		}
		
		if (liPosAnalise == 0) {
			alert("Você precisa pelo menos selecionar uma indicação para efetuar esta ação!");
		} else if (terminado && liPosAnalise > 0) {
			clearInterval(analiseTimer);
			
			if (confirm("Envio terminado com sucesso! \nDeseja atualizar esta página?"))
				location.reload(true);
		}
	}
}

sucessoEAM = function() {
	var imgEnviado = document.createElement("img");
	var dgv = $get("DataGrid1");
	
	imgEnviado.src = "img/\ico.ok.gif";
	imgEnviado.setAttribute('alt','enviando');
	
	dgv.rows[liPosAnalise].cells[0].removeChild(dgv.rows[liPosAnalise].cells[0].lastChild);
	dgv.rows[liPosAnalise].cells[0].appendChild(imgEnviado);
	
	analiseTimer = setTimeout("analise.enviar(true)", 2000);
	//alert(codAnalise.replace("chk",""));
}

erroEAM = function(erro) {
	alert("Mensagem: " + erro._message + "\n" + 
		  "Stack Trace: " + erro._stackTrace);
}

sucessoSR = function() {
	var imgEnviado = document.createElement("img");
	var dgv = $get("DataGrid1");
	
	imgEnviado.src = "img/\ico.ok.gif";
	imgEnviado.setAttribute('alt','enviando');
	
	dgv.rows[liPosAnalise].cells[0].removeChild(dgv.rows[liPosAnalise].cells[0].lastChild);
	dgv.rows[liPosAnalise].cells[0].appendChild(imgEnviado);
	
	analiseTimer = setTimeout("analise.enviar()", 2000);
	//alert(codAnalise.replace("chk",""));
}

erroSR = function(erro) {
	alert("Mensagem: " + erro._message + "\n" + 
		  "Stack Trace: " + erro._stackTrace);
}


sucessoAnaliseInd = function (arg) {
	indicacao.mostrar(arg);
}

erroAnaliseInd = function (arg) {}

//var fundo = setInterval(" clearInterval(fundo);", 2000);

/*malaSucesso = function(arg, obj) {
	if (!arg) {
		alert("Você precisa cadastrar pelo menos um e-mail para o contato.");
	} else {
		obj.disabled = true;
		__doPostBack('botcadastrar','');
	}
}

malaErro = function(erro) {
	alert("Infelizmente ocorreu um erro na comunicação com o servidor.\n" +
		  "Aguarde um momento e tente novamente ou contacte o administrador do sistema." + erro.message);
}*/


/* **************************************************************************************/
var estatistica = {
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div = document.createElement("div");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			height = getPageSize()[1] + "px"; //"100%";
			
			if (navigator.appName.indexOf("MSIE 6") >= 0 )
				height = "100%";
			//else
			//	height = document.documentElement.scrollHeight + "px";
				
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}

		objBody.appendChild(div);
	},
	
	fim: function() {
		var divArray = new Array("divfundo",
								 "divDetGoogle",
								 "divDetGooglePatro",
								 "divDetOutros");
		
		for (x=0; x < divArray.length; x++) {
			var div = document.getElementById(divArray[x]);
			div.style.visibility = "hidden";
		}

		return false;
	},
	
	google_on: function() {
		var div = document.getElementById("divfundo");
		var divDetGoogle = document.getElementById("divDetGoogle");
		
		with (divDetGoogle.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
		}

		divDetGoogle.style.visibility = "visible";
		div.style.visibility = "visible";
		
		__doPostBack('botGoogle','');
	},
	
	googlePatro_on: function() {
		var div = document.getElementById("divfundo");
		var divDetGooglePatro = document.getElementById("divDetGooglePatro");
		
		with (divDetGooglePatro.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
		}

		divDetGooglePatro.style.visibility = "visible";
		div.style.visibility = "visible";

		__doPostBack('botGooglePatro','');
	},

	outros_on: function() {
		var div = document.getElementById("divfundo");
		var divDetMaisDet = document.getElementById("divDetOutros");
		
		with (divDetMaisDet.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetMaisDet.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetMaisDet.clientHeight) / 2) + "px";
		}

		divDetMaisDet.style.visibility = "visible";
		div.style.visibility = "visible";

		__doPostBack('botOutros','');
	}
}

var detalhes = {
	iniciar: function() {
		var objBody = document.getElementsByTagName("body").item(0);
		var div = document.createElement("div");
			
		div.setAttribute('id','divfundo');		

		with (div.style) {
			height = getPageSize()[1] + "px"; //"100%";
			
			if (navigator.appName.indexOf("MSIE 6") >= 0 )
				height = "100%";
			//else
			//	height = document.documentElement.scrollHeight + "px";
				
			width = "100%";
			top = "0px";
			position = "absolute";
			backgroundColor = "#000";
			filter = "alpha(opacity=50)";
			opacity = ".5";
			zIndex = 0;
			visibility = "hidden";
		}

		objBody.appendChild(div);
	},
	
	fim: function() {
		var tabela = document.getElementById("DataListDetalhes");
		var tabAcesso = document.getElementById("dgAcesso");
		
		var divArray = new Array("divfundo",
								 "divEstatDetalhes",
								 "divAcesso");
		
		for (x=0; x < divArray.length; x++) {
			var div = document.getElementById(divArray[x]);
			div.style.visibility = "hidden";
		}


		try {
			while (tabela.rows.length > 0) {
				tabela.deleteRow(0);
			}
		} catch(e) {}
		

		try {
			while (tabAcesso.rows.length > 0) {
				tabAcesso.deleteRow(0);
			}
		} catch(e) {}


		document.getElementById("hidCodAcesso").value = "";
		try { tabela.style.visibility = "hidden"; } catch(e) {}
		try { document.getElementById("divEstatDetalhes2").style.overflow = "hidden"; } catch(e) {}
		detalhes.limparDados();

		return false;
	},

	fim2: function() {
		var tabela = document.getElementById("DataListDetalhes");
		var divArray = new Array("divEstatDetalhes");
		
		for (x=0; x < divArray.length; x++) {
			var div = document.getElementById(divArray[x]);
			div.style.visibility = "hidden";
		}

		try {
			while (tabela.rows.length > 0) {
				tabela.deleteRow(0);
			}
		} catch(e) {}
		

		document.getElementById("hidCodAcesso").value = "";
		document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim() }
		try { tabela.style.visibility = "hidden"; } catch(e) {}
		document.getElementById("divEstatDetalhes2").style.overflow = "hidden";
		detalhes.limparDados();
		
		return false;
	},

	fim3: function() {
		var tabela = document.getElementById("divDetPalavras");
		var divArray = new Array("divDetPalavras");
		
		for (x=0; x < divArray.length; x++) {
			var div = document.getElementById(divArray[x]);
			div.style.visibility = "hidden";
		}

		try {
			while (tabela.rows.length > 0) {
				tabela.deleteRow(0);
			}
		} catch(e) {}
		

		document.getElementById("hidCodAcesso").value = "";
		document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim() }
		try { tabela.style.visibility = "hidden"; } catch(e) {}
		document.getElementById("divEstatDetalhes2").style.overflow = "hidden";
		detalhes.limparDados();
		
		return false;
	},

	limparDados: function() {
		document.getElementById("hidOpcao").value = "";
		document.getElementById("hidTabela").value = "";
		document.getElementById("hidPalavra").value = "";
		document.getElementById("hidData").value = "";
		document.getElementById("hidCodUrl").value = "";
		document.getElementById("hidCorretor").value = "";
		document.getElementById("hidTabCor").value = "";
	},
	
	acesso_on: function(opcao) {
		var divDetalhes = document.getElementById("divAcesso");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}
 
		document.getElementById("hidOpcao").value = opcao;
		//document.getElementById("hidTabela").value = "acesso";
		///document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		//document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim() }
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetAcesso','');
	},

	cadastre_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "cadastre";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	encontre_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "encontre";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	interesse_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "interesse";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	atendimento_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "atendimento";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	fale_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "fale";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	indicacao_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "indicacao";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	indicacaoFac_on: function(opcao) {
		var divDetalhes = document.getElementById("divEstatDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidOpcao").value = opcao;
		document.getElementById("hidTabela").value = "indicacaoFac";
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetalhes','');
	},

	outros_on: function() {
		var divDetMaisDet = document.getElementById("divDetOutros");
		
		with (divDetMaisDet.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetMaisDet.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetMaisDet.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("divfundo").style.visibility = "visible";
	},

	interno_on: function(codUrl, opcao, palavra) {
		var divDetalhes = document.getElementById("divEstatDetalhes");

		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		try { detalhes.fim3(); } catch(e) {}
		
		document.getElementById("hidOpcao").value = codUrl;
		document.getElementById("hidTabela").value = opcao;
		document.getElementById("hidCodAcesso").value = palavra;
		document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim2() }

		__doPostBack('botDetalhes','');
	},


	//Acesso de palavras nos dias e dias na palavra chave
	palavras_on: function(codUrl, data) {
		var divDetalhes = document.getElementById("divDetPalavras");

		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}
		
		document.getElementById("hidOpcao").value = "palavras";
		//document.getElementById("hidPalavra").value = "palavras";
		document.getElementById("hidData").value = data;
		document.getElementById("hidCodUrl").value = codUrl;
		//document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		//document.getElementById("divfundo").style.visibility = "visible";
		//document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim2() }

		__doPostBack('botPalavraAcesso','');
	},
	
	acessoPalavra_on: function(codUrl, palavra) {
		var divDetalhes = document.getElementById("divDetPalavras");

		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}
		
		document.getElementById("hidOpcao").value = "dias";
		document.getElementById("hidPalavra").value = (palavra == "") ? codUrl : palavra;
		//document.getElementById("hidData").value = data;
		document.getElementById("hidCodUrl").value = codUrl;
		//document.getElementById("divEstatDetalhes2").style.overflow = "auto";
		//document.getElementById("divfundo").style.visibility = "visible";
		//document.getElementById("botDetalhesFim").onclick = function() { detalhes.fim2() }

		__doPostBack('botPalavraAcesso','');
	},


	//Corretores
	fimCor: function() {
		var tabela = document.getElementById("DataListCorDetalhes");
		var divArray = new Array("divfundo",
								 "divCorDetalhes");
		
		for (x=0; x < divArray.length; x++) {
			var div = document.getElementById(divArray[x]);
			div.style.visibility = "hidden";
		}


		while (tabela.rows.length > 0) {
			tabela.deleteRow(0);
		}
		
		
		document.getElementById("hidCorretor").value = "";
		document.getElementById("divEstatDetalhesCor").style.overflow = "";

		return false;
	},

	envCor_on: function(codOpe) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "enviada";
		document.getElementById("hidTabela").value = "enviada";
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	},

	vistaCor_on: function(codOpe) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "vista";
		//document.getElementById("hidTabela").value = "vista";
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	},
	
	intCor_on: function(codOpe, mala) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "interesse";
		document.getElementById("hidTabela").value = "interesse";
		document.getElementById("hidMala").value = mala;
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	},
	
	indCor_on: function(codOpe, mala) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "indicacao";
		document.getElementById("hidTabela").value = "indicacao";
		document.getElementById("hidMala").value = mala;
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	},

	faleCor_on: function(codOpe, mala) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "fale";
		document.getElementById("hidTabela").value = "fale";
		document.getElementById("hidMala").value = mala;
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	},

	atenCor_on: function(codOpe, mala) {
		var divDetalhes = document.getElementById("divCorDetalhes");
		
		with (divDetalhes.style) {
			zIndex = 1;
			left = ((getPageSize()[0] - divDetGoogle.clientWidth) / 2) + "px";
			top = ((document.all) ? document.body.scrollTop : window.pageYOffset) +
				((getPageSize()[3] - divDetGoogle.clientHeight) / 2) + "px";
			visibility = "visible";
		}

		document.getElementById("hidCorretor").value = codOpe;
		document.getElementById("hidTabCor").value = "atendimento";
		document.getElementById("hidTabela").value = "atendimento";
		document.getElementById("hidMala").value = mala;
		document.getElementById("divEstatDetalhesCor").style.overflow = "auto";
		document.getElementById("divfundo").style.visibility = "visible";
		
		__doPostBack('botDetCor','');
	}
}


verEstat = function () {
	var divGoogle = document.getElementById("detgoogle");
	var divGooglePatro = document.getElementById("detgooglepatro");;
	var divOutros = document.getElementById("detoutros");
	
	with (divGoogle) {
		innerHTML = "<a href='javascript:estatistica.google_on();' title='ver detalhes' style='color:#000;'>[+]</\a>";
		width = "100px";
		style.display = "inline";
	}

	with (divGooglePatro) {
		innerHTML = "<a href='javascript:estatistica.googlePatro_on();' title='ver detalhes' style='color:#000;'>[+]</\a>";
		width = "100px";
		style.display = "inline";
	}

	with (divOutros) {
		innerHTML = "<a href='javascript:estatistica.outros_on();' title='ver detalhes' style='color:#000;'>[+]</\a>";
		width = "100px";
		style.display = "inline";
	}
}


getPageSize = function() {
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight) 
	
	return arrayPageSize;
}


