function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames[i].replace(/-/g, "\-") + "(\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames.replace(/-/g, "\-") + "(\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function lightbox() {
	var anchor		= getElementsByClassName(document, 'a', 'light-box-coment');
	var anchor2		= getElementsByClassName(document, 'a', 'light-box-enq');
	var anchor21	= getElementsByClassName(document, 'a', 'light-box-enq-R');
	var anchor3		= getElementsByClassName(document, 'a', 'light-box-galeria');
	var anchor4		= getElementsByClassName(document, 'a', 'light-box-print');
	var anchor5		= getElementsByClassName(document, 'a', 'light-box-email');
	var anchor6		= getElementsByClassName(document, 'a', 'light-box-ficha');
	var anchor611	= getElementsByClassName(document, 'a', 'light-box-fichaComp');
	var anchor61	= getElementsByClassName(document, 'a', 'light-box-medicao');
	var anchor62	= getElementsByClassName(document, 'a', 'light-box-nota');
	var anchor7		= getElementsByClassName(document, 'a', 'light-box-caparevista');
	var anchor8		= getElementsByClassName(document, 'a', 'light-box-papel');
	var anchor9		= getElementsByClassName(document, 'a', 'light-box-recomenda');
	var anchor10	= getElementsByClassName(document, 'a', 'light-box-acusacao');
	var closeButton	= getElementsByClassName(document, 'a', 'close-button');

	//Comentário
	if(anchor) {
		for(var i = 0; i < anchor.length; i++) {
			anchor[i].onclick = function() {
					cod = document.getElementById('light-box-coment_cod').innerHTML;
					ExeAjax('tela_comentario.asp?codPC='+cod,'dialog');
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();

					$('#mask').css({'width':maskWidth,'height':maskHeight});

					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	

					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
					
		  			$('#dialog').css('width',  420);	
					/*$('#dialog').css('height',  600);	*/			
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 300);
					
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));

					$('#dialog').fadeIn(1000);
			};
		}
	}
	
	//Enquete
	if(anchor2) {
		for(var i = 0; i < anchor2.length; i++) {
			anchor2[i].onclick = function() {
					cod = document.getElementById('light-box-enq_totOPC').innerHTML
					respEnquete = Enquete(cod);
					if(respEnquete){
						cod = document.getElementById('light-box-enq_cod').innerHTML;
						ExeAjax('tela_enquete.asp?codPE='+cod+'&codR='+respEnquete,'dialog'); 
						var maskHeight = $(document).height();
						var maskWidth = $(window).width();
	
						$('#mask').css({'width':maskWidth,'height':maskHeight});

						$('#mask').fadeIn(1000);	
						$('#mask').fadeTo("slow",0.8);	
	
						//Get the window height and width
						var winH = $(window).height();
						var winW = $(window).width();
              			
						$('#dialog').css('width',  400);
						$('#dialog').css('height',  'auto');
						$('#dialog').css('overflow-y',  'hidden');						
						$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
						$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
	
						$('#dialog').fadeIn(1000); 
				}
			};
		}
	}
	
	//Enquete - Resultados
	if(anchor21) {
		for(var i = 0; i < anchor21.length; i++) {
			anchor21[i].onclick = function() {	
			
			cod = document.getElementById('light-box-enq_totOPC').innerHTML
			LimparEnquete(cod);
			cod = document.getElementById('light-box-enq_cod').innerHTML;
			// Requisitar função Ajax para preencher o LightBox	
			ExeAjax('tela_enquete.asp?codPE='+cod+'&R=1','dialog');
			
			var maskHeight = $(document).height();
			var maskWidth = $(window).width();
	
			$('#mask').css({'width':maskWidth,'height':maskHeight});

			$('#mask').fadeIn(1000);	
			$('#mask').fadeTo("slow",0.8);	
	
			//Get the window height and width
			var winH = $(window).height();
			var winW = $(window).width();

            $('#dialog').css('width',  400); 
			$('#dialog').css('height',  'auto');
			$('#dialog').css('overflow-y',  'hidden');  
			$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
			$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
	
			$('#dialog').fadeIn(1000); 
								
			};
			
		}
	}	
	
	//Galeria de Fotos
	if(anchor3) {
		
		for(var i = 0; i < anchor3.length; i++) {
			anchor3[i].onclick = function() {
					
					cod = document.getElementById('light-box-galeria_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_popupGaleria.asp?codGI='+cod,'dialog');
					
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  750);
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'hidden');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) -300);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000); 

			};
		}
	}
	
	//Imprimir Matéria
	if(anchor4) {
		for(var i = 0; i < anchor4.length; i++) {
			anchor4[i].onclick = function() {
				if(black.style.display == 'none' && light.style.display == 'none') {
					//Habilitar/Desabilitar Barras de Rolagem
					Rolagem();
					// Redimensionar
					Redimensionar();
					//Centralizar LightBox
					Centralizar();
					cod = document.getElementById('light-box-print_cod').innerHTML;
					// Tamanho da tela
					light.style.width = '540px';
					light.style.height = '320px';
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_imprimir.asp?codc='+cod,'light');
					// Aparecer para o usuário tela montada
					black.style.display = 'block';
					light.style.display = 'block';
				}
			};
		}
	}
	
	//Enviar por Email
	if(anchor5) {
		for(var i = 0; i < anchor5.length; i++) {
			anchor5[i].onclick = function() {
					cod = document.getElementById('light-box-email_cod').innerHTML;
					tt = document.getElementById('tituloEmail').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_email.asp?codc='+cod+'&tt='+tt,'dialog');
					
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
					 
					$('#dialog').css('width',  400); 
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'hidden');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);
			};
		}
	}
	
	//Ficha Técnica
	if(anchor6) {
		for(var i = 0; i < anchor6.length; i++) {
			anchor6[i].onclick = function() {				
					cod = document.getElementById('light-box-ficha_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_tabelas.asp?codc='+cod+'&tp=FICHA','dialog');
					// Aparecer para o usuário tela montada
					
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  750);  
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 300);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);
			};
		}
	}
	
	//Ficha Técnica Comparativo
	if(anchor611) {
		for(var i = 0; i < anchor611.length; i++) {
			anchor611[i].onclick = function() {
					if(ValidarComp()) {
						ExeAjax('tela_tabelasComp.asp?VS1='+VS1+'&VS2='+VS2+'&VS3='+VS3+'&VS4='+VS4,'dialog');
						//Requisitar função Ajax para preencher o LightBox
					
						// Aparecer para o usuário tela montada
						
						var maskHeight = $(document).height();
						var maskWidth = $(window).width();
				
						$('#mask').css({'width':maskWidth,'height':maskHeight});
			
						$('#mask').fadeIn(1000);	
						$('#mask').fadeTo("slow",0.8);	
				
						//Get the window height and width
						var winH = $(window).height();
						var winW = $(window).width();
			
						$('#dialog').css('width',  750);  
						$('#dialog').css('height',  'auto');
						$('#dialog').css('overflow-y',  'scroll');  
						$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
						$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
				
						$('#dialog').fadeIn(1000);
						}
			};
		}
	}
	
	//Medições
	if(anchor61) {
		for(var i = 0; i < anchor61.length; i++) {
			anchor61[i].onclick = function() {

					cod = document.getElementById('light-box-medicao_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_tabelas.asp?codc='+cod+'&tp=MEDICAO','light');
					// Aparecer para o usuário tela montada
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  750);  
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);

			};
		}
	}
	
	//Notas
	if(anchor62) {
		for(var i = 0; i < anchor62.length; i++) {
			anchor62[i].onclick = function() {
					cod = document.getElementById('light-box-nota_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_tabelas.asp?codc='+cod+'&tp=NOTA','light');
					// Aparecer para o usuário tela montada
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  750);  
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);

			};
		}
	}
	
	//Capa Revista Ampliar
	if(anchor7) {
		for(var i = 0; i < anchor7.length; i++) {
			anchor7[i].onclick = function() {
					cod = document.getElementById('imgclick').innerHTML;				
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_caparevista_ampliar.asp?codCR='+cod,'dialog');
					// Aparecer para o usuário tela montada
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  312);  
					$('#dialog').css('height',  'auto');
					$('#dialog').css('overflow-y',  'hidden');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) - 200);
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);
			};
		}
	}
	
	//Papel Parede Ampliar
	if(anchor8) {
		for(var i = 0; i < anchor8.length; i++) {
			anchor8[i].onclick = function() {

					cod = document.getElementById('imgclick').innerHTML;
					wid = document.getElementById('imgwid').innerHTML;

					ExeAjax('tela_papel_ampliar.asp?codPP='+cod+'&wid='+wid,'dialog');
					// Aparecer para o usuário tela montada
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
					

					$('#dialog').css('width',  parseInt(wid) -20);  
					$('#dialog').css('height',  'auto');
					$('#dialog').css('max-height',  winH -20);
					$('#dialog').css('overflow-y',  'scroll');
					$('#dialog').css('top', 10);
					$('#dialog').css('left', 10);
			
					$('#dialog').fadeIn(1000);


			};
		}
	}
	
	// Box Recomenda
	if(anchor9) {
		for(var i = 0; i < anchor9.length; i++) {
			anchor9[i].onclick = function() {				
					cod = document.getElementById('light-box-recomenda_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_recomenda2.htm','dialog');
					// Aparecer para o usuário tela montada
					
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  930);  
					$('#dialog').css('height',  500);
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2));
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);
			};
		}
	}
	
	//Box acusacao
	if(anchor10) {
		for(var i = 0; i < anchor10.length; i++) {
			anchor10[i].onclick = function() {				
					cod = document.getElementById('light-box-acusacao_cod').innerHTML;
					//Requisitar função Ajax para preencher o LightBox
					ExeAjax('tela_acusacao.htm','dialog');
					// Aparecer para o usuário tela montada
					
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
			
					$('#mask').css({'width':maskWidth,'height':maskHeight});
		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
			
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
		
					$('#dialog').css('width',  930);  
					$('#dialog').css('height',  500);
					$('#dialog').css('overflow-y',  'scroll');  
					$('#dialog').css('top',  (winH/2-$('#dialog').height()/2));
					$('#dialog').css('left', (winW/2-$('#dialog').width()/2));
			
					$('#dialog').fadeIn(1000);
			};
		}
	}

	//Fechar
	if(closeButton) {
		for(var j = 0; j < closeButton.length; j++) {
			closeButton[j].onclick = function() {
				Rolagem();	//Habilitar/Desabilitar Barras de Rolagem
				black.style.display = 'none';
				light.style.display = 'none';
			};
		}
	}
}

function lightbox_busca_galeria()
{
	cod = document.getElementById('light-box-galeria_cod').innerHTML;
	//Requisitar função Ajax para preencher o LightBox
	ExeAjax('tela_popupGaleria.asp?codGI='+cod,'dialog');
	
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();

	$('#mask').css({'width':maskWidth,'height':maskHeight});

	$('#mask').fadeIn(1000);	
	$('#mask').fadeTo("slow",0.8);	

	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();

	$('#dialog').css('width',  750);
	$('#dialog').css('height',  'auto');
	$('#dialog').css('overflow-y',  'hidden');  
	$('#dialog').css('top',  (winH/2-$('#dialog').height()/2) -300);
	$('#dialog').css('left', (winW/2-$('#dialog').width()/2));

	$('#dialog').fadeIn(1000); 
}