function LayerPopup()
{
	this.popupVisualizar = false;
	this.popupIndiqueVisualizar = false;
}

LayerPopup.prototype.visualizar = function(url)
{
	var layerGeral_popup = document.getElementById('layerGeral_popup');
	var layerOpaco_popup = document.getElementById('layerOpaco_popup');
	
	//conteudo do popup comum
	var conteudoPopup = document.getElementById('conteudoPopup');
	//conteudo do popup do indique
	var layerMiolo_indique = document.getElementById('layerMiolo_indique');
	//novo conteudo do indique
	var modulo_indiqueAmigo = document.getElementById('modulo_indiqueAmigo');
	
	var pagina = Diversos.getPageSize();
	
	if(!this.popupVisualizar){this.popupVisualizar = layerGeral_popup.innerHTML;}	
	else{layerGeral_popup.innerHTML = this.popupVisualizar;}
	
	layerGeral_popup.style.display = '';
	layerOpaco_popup.style.display = '';
	
	layerGeral_popup.style.height = pagina.pageHeight + 'px';
	layerGeral_popup.style.width = pagina.pageWidth + 'px';
	
	layerOpaco_popup.style.height = pagina.pageHeight + 'px';
	layerOpaco_popup.style.width = pagina.pageWidth + 'px';
	
	if(this.popupIndiqueVisualizar)
	{
		if(url){LinkAjax.send(url, 'miolo-indique', 'carregando-indique');}
		
		if(conteudoPopup){conteudoPopup.style.display = 'none';}
		if(layerMiolo_indique){layerMiolo_indique.style.display = '';}
		if(modulo_indiqueAmigo){modulo_indiqueAmigo.style.display = '';}
	}
	else
	{
		if(url){LinkAjax.send(url, 'principal', 'carregando_principal');}
		
		if(conteudoPopup){conteudoPopup.style.display = '';}
		if(layerMiolo_indique){layerMiolo_indique.style.display = 'none';}
		if(modulo_indiqueAmigo){modulo_indiqueAmigo.style.display = 'none';}
	}
	
	this.popupIndiqueVisualizar = false;
}

LayerPopup.prototype.visualizarFechar = function()
{
	document.getElementById('layerOpaco_popup').style.display = 'none';
	document.getElementById('layerGeral_popup').style.display = 'none';
}

LayerPopup.prototype.visualizarIndique = function(url)
{
	this.popupIndiqueVisualizar = true;
	this.visualizar(url);
}

LayerPopup.prototype.janela = function(url, width, heigth)
{
	jan = window.open("","janela","scrollbars=yes,resizable=no,location=no,directories=no,status=no,menubar=no,width="+width+"px,height="+heigth+"px,top=0,left=0");
	jan.focus();
	jan.location = url;
}

LayerPopup.prototype.iframe = function(url)
{
	var conteudoPopup = document.getElementById('conteudoPopup');
	var layerMiolo_indique = document.getElementById('layerMiolo_indique');
	var modulo_indiqueAmigo = document.getElementById('modulo_indiqueAmigo');
	
	if(conteudoPopup){conteudoPopup.style.display = '';}
	if(layerMiolo_indique){layerMiolo_indique.style.display = 'none';}
	if(modulo_indiqueAmigo){modulo_indiqueAmigo.style.display = 'none';}

	var html  = '<div class="galeria_imagens" align="center">';
		html += '<div class="fechar" align="right" style="padding:10px;"><a onclick="LayerPopup.visualizarFechar();" class="fechar" style="cursor:pointer;">Fechar X</a></div>';
		html += '<iframe scrolling="no" src="'+url+'" height="440px;" width="520px;" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0">';
		html += '</iframe></div>';
	
	document.getElementById('principal').innerHTML = html;
	
	var layerGeral_popup = document.getElementById('layerGeral_popup');
	var layerOpaco_popup = document.getElementById('layerOpaco_popup');
	var pagina = Diversos.getPageSize();
	
	layerGeral_popup.style.display = '';
	layerOpaco_popup.style.display = '';
	
	layerGeral_popup.style.height = pagina.pageHeight + 'px';
	layerGeral_popup.style.width = pagina.pageWidth + 'px';
	
	layerOpaco_popup.style.height = pagina.pageHeight + 'px';
	layerOpaco_popup.style.width = pagina.pageWidth + 'px';
}

var LayerPopup = new LayerPopup();
