﻿/* appVersion      appName    appCodeName   userAgent */
var pasta="http://www.nagueta.com.br";
//var pasta="http://localhost/nagueta_antigo";
var aciona;

var navegador=navigator.appVersion;
var nav1="4.0 (compatible; MSIE 5.5; Windows NT 5.1)";
var nav2="4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
var nav3="4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
//var nav4="5.0 (Windows; pt-BR)";

/* array com bordas*/

bordas=new Array(4)
	bordas[0]="#FFFF00";//amarelo
	bordas[1]="#FF0000";//vermelho
	bordas[2]="#FFCC00";//laranja
	bordas[3]="#FF6600";//laranja 


/* fim array com bordas*/

//window.setTimeout("verificapopup()",10000);
function verificapopup()
{
	if(!document.getElementById("nova"))
	{
		//popup();
	}
	else
	{
		//	
	}
}
							   
		   


function popup()
{	
	var foto=pasta+"/nagueta/flyers/flyer_na_gueta_sesc.jpg";
	novadiv=document.createElement('div');
	novadiv.style.zIndex="60";
	novadiv.style.display="block";
	novadiv.setAttribute("id","nova");
	novadiv.onclick=function()
	{
		clearInterval(timerndiv); 
		this.parentNode.removeChild(this);
	}
	document.getElementById("corpo").appendChild(novadiv);
	buscapop(foto,novadiv);
}
//alert(largura+"     "+altura);

novaimagem =Array("fundocorpo.jpg","background.jpg","botoes.png","favoritos.gif","fundocontador.gif","fundo_transparente.png","textura2p.jpg","textura1p.jpg","fundomyp.jpg","videos.jpg","banner.jpg");
quantidade=novaimagem.length;
for(var i=0;i<quantidade;i++)
{
	foto=new Image();
	foto.src="image/"+novaimagem[i];
}


/*window.onload=function(){
if( navegador == nav1 || navegador == nav2 || navegador == nav3 ){
document.getElementsByTagName("link")[1].attributes["href"].value="style/style3.css";
}
}*/

function formulario()
{
	var nome=document.getElementById("nomecontato");
	var email=document.getElementById("emailcontato");
	var mensagem=document.getElementById("mensagemc");
	if(nome.value=="" || email.value=="" || mensagem.value=="")
	{
		alert("preencha todos os campos");
		return false;
	}
	if(email.value.indexOf('@')==-1||email.value.indexOf('.')==-1||email.value.indexOf('com')==-1)
	{
	alert("o campo email não é valido");
	email.value="";
	email.focus;
	return false;
	}
	else
	{
		return true;
	}
}
function  verificac()
{
	var nome=document.getElementById("nome");
	var email=document.getElementById("email");
	if(nome.value=="" || email.value=="" )
	{
		alert("preencha todos os campos");
		return false;
	}
	if(email.value.indexOf('@')==-1||email.value.indexOf('.')==-1||email.value.indexOf('com')==-1)
	{
		alert("o campo email não é valido");
		email.value="";
		email.focus;
		return false;
	}
	else
	{
		return true;
	}
}

function addFav()
{
    var url      = pasta+"";
    var title    = "Banda NA GUETA ";
    if (window.sidebar) 
	{
		window.sidebar.addPanel(title, url,"");
	}
    else if(window.opera && window.print)
	{
    	var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all)
	{
		window.external.AddFavorite(url, title);
	}
}

  function addEvent(obj, evType, fn)
  {
		if (obj.addEventListener)
		{
			obj.addEventListener(evType, fn, true);
		}
		if (obj.attachEvent)
		{
			obj.attachEvent("on"+evType, fn);
		}
  }
						
	function aleatorio(inferior,superior)
	{ 
		numPossibilidades = superior - inferior; 
		aleat = Math.random() * numPossibilidades ;
		aleat = Math.floor(aleat) ;
		return parseInt(inferior) + aleat ;
    } 



				
						
addEvent(document,"click",historico);	
function bloqueia(tgt)
{
	this.onclick=function()
	{
		return false
	}
}
function historico(e)
{
	if(typeof(e)=='undefined')
	{
		var e=window.event;
	}
	source=e.target?e.target:e.srcElement;
	if(source.nodeType==3)
	{
		source =source.parentNode;
	}
	if(source.tagName=="SPAN")
	{
		if(document.all)
		{
			return false;
		}
		else
		{
			bloqueia(source);
		}
	}
	if(source.id=="pagvid")
	{
		if(document.all)
		{
			ajax(pasta+"/nagueta/pages/videos.php");
			return false;
		}
		else
		{	
			bloqueia(source);
			ajax(pasta+"/nagueta/pages/videos.php");
		}

	}
if(source.id=="button")
{
	if(document.getElementById("mensagem").value==""||document.getElementById("nome").value==""||document.getElementById("cidade").value=="")
	{
		alert("preencha o campo que esta vazio");
		return false;
	}
    if(document.getElementById("mensagem").value.length >= 180)
	{
		alert("coloque no maximo 6 linhas");
		document.getElementById("mensagem").focus;
		return false;	
	}
}
var foto=document.getElementById("background");
	if(foto)
	{
		foto.style.backgroundRepeat="repeat";
	}
	var rodape=document.getElementById("rodape");
	/*if(source.id=="fundo1"){
		var fundo="URL(image/fundo_transparente_verde.png)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundImage=fundo;
	}
		if(source.id=="fundo2"){
			var fundo="URL(image/fundo_transparente_azul.png)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundImage=fundo;}
		if(source.id=="fundo3"){
		var fundo="URL(image/fundo_transparente.png)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundImage=fundo;
		}
		if(source.id=="fundo4"){
		var fundo="URL(image/fundo_transparente_verm.png)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundImage=fundo;
		}
		if(source.id=="fundo5"){
		var fundo="URL(image/fundomy.jpg)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundColor="black";
		foto.style.backgroundAttachment="scroll";
		}
		if(source.id=="fundo6"){
		var fundo="URL(image/textura1.jpg)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundColor="black";
		foto.style.backgroundAttachment="fixed";
		}
		if(source.id=="fundo7"){
		var fundo="URL(image/textura2.jpg)";
		foto.style.backgroundImage=fundo;
		rodape.style.backgroundColor="black";
		foto.style.backgroundAttachment="fixed";}*/
		if(source.id=="historico")	
		addFav();
		if(source.id=="home")
		{
			 anima_agenda();
			
		
		}
		if(source.className=="paginas")
		{
		alvo=source.innerHTML.split('<');
		document.title=":::::"+alvo[0].toUpperCase()+"::::::";
		var paginas=new Array();
		paginas[0]=pasta+"/nagueta/pages/home.php";
		paginas[1]=pasta+"/nagueta/pages/integrantes.html";
		paginas[2]= pasta+"/nagueta/pages/fotos.php";
		paginas[3]=pasta+"/nagueta/pages/videos.php";
		paginas[4]= pasta+"/nagueta/pages/contato.php";
		paginas[5]=pasta+"/nagueta/pages/mp3.php";
		paginas[6]=pasta+"/nagueta/pages/agenda.php";
		for(var i=0;i<paginas.length;i++)
		{
			if(paginas[i].indexOf(alvo[0])>=1)
			{
			//if(i==0)
			//window.location=pasta+"";
			//paginas[i]=paginas[i].replace("www.nagueta.com.br","www.nagueta.com.br/nagueta");	
			//alert(paginas[i]);
			ajax(paginas[i]);
			if(document.all)
			{
				return false;
			}
			else
			{
				source.onclick=function()
				{
					return false;
				}
			}
			//document.title=":::::"+alvo[i].toUpperCase()+"::::::";
			clearInterval(aciona);	

		}

	}

}

/*if(source.id=="key"){//função que faz aparecer e sumir o formulario esta desativada
document.getElementById("key").ondblclick=function(){
document.getElementById("pessoas_online").style.display="none";
document.getElementById("formrestrito").style.display="block";
document.getElementById("fecha").onclick=function(){
	document.getElementById("pessoas_online").style.display="block";
document.getElementById("formrestrito").style.display="none";
}
}
}*/
}

//alert(document.referrer);
/*timerinc=window.setTimeout("incrementa()",1);
function incrementa(){
window.location.href="visit.php?inc=1";
}*/




/*addEvent(window,"load",centraliza);/*função que eu utilizava para centralizar a página com javascript*//*
function centraliza(e){
var navegador= navigator.appName;
var telal=window.screen.width;
if(window.screen.availWidth>1024 || window.screen.width>1024){
var objeto= document.getElementById("background").offsetWidth;
var centro = parseInt(telal)-parseInt(objeto);
var centraliza = (centro/2)-10;
var centralizam= (centro/2)-10;
document.getElementById("background").style.left=centraliza+"px";
if(navegador=="Netscape")
document.getElementById("background").style.left=centralizam+"px";
}
}
*/
w=0; 

addEvent(document,"mouseover",tabela)
function tabela(e){
	if(typeof(e)=='undefined')var e=window.event;
source=e.target?e.target:e.srcElement;
if(source.nodeType==3)source =source.parentNode;
if(source.id=="mensagem")
document.getElementById("mensliv").style.display="block";
if(source.id=="fundov"){
acionat=window.setInterval("animatabela(w-=5)",1);
source.onmouseout=function(){clearInterval(acionat);}
}
if(source.id=="fundoa"){
acionats=window.setInterval("retornatabela(w+=5)",1);
source.onmouseout=function(){clearInterval(acionats);}
}
if(source.id=="historico")
source.style.cursor="pointer";
if(source.className=="trocafundo")
source.style.cursor="pointer";
}




addEvent(document,"mouseout",saindo);
function saindo(e)
{
	if(typeof(e)=='undefined')
	{
		var e=window.event;
	}
	source=e.target?e.target:e.srcElement;
	if(source.nodeType==3)
	{
		source =source.parentNode;
	}
	if(source.id=="mensagem")
	{
		document.getElementById("mensliv").style.display="none";
	}
}

function animatabela(w)
{
	var wi=document.getElementById("tabelaalbum").offsetHeight;	
	if(wi)
	{
		wi=parseInt(wi);
		limit=(wi-wi-wi);
		limit=limit+300;	
		if(w>=limit)
		{		
			document.getElementById("tabelaalbum").style.top=w+"px";
		}
		if(w<=limit)
		{
			clearInterval(acionat);
		}
	}
}

function retornatabela(w)
{
	if(w<=0)
	{	
		document.getElementById("tabelaalbum").style.top=w+"px";
		var wis=document.getElementById("tabelaalbum").offsetHeight;
	}
	if(w>=0)
	{
		clearInterval(acionats);
	}
}



/*

function bodyOnReady(func){
if(document.addEventListener && navigator.appName.indexOf('Opera')<0){ 
document.addEventListener( "DOMContentLoaded", func, false );
}else if(navigator.appName.indexOf('Internet Explorer')>=0){ //IE
try { 
 document.documentElement.doScroll("left"); 
 func();
} catch( error ) {  
setTimeout( arguments.callee, 20 );
  return}
}else if(navigator.appName.indexOf('Opera')>=0){
document.addEventListener( "DOMContentLoaded", function () {
 for (var i = 0; i <document.styleSheets.length; i++){ 
  if (document.styleSheets[i].disabled) {   
     setTimeout( arguments.callee, 0 ); 
       return; 
  }  
}  func();
}, false);
}
}//vai funcionar rapidão pois não precisa esperar a imagem, só o carregamento do HTML
bodyOnReady(function(){})
 
//vai funcionar beleza, mas só depois que tooodos os elementos forem carregados
window.onload = function(){
}
*/


	












/* função que apresenta a transparencia */


function ajax(url)
{
	if(url==pasta+"/nagueta/index.php")
	window.location=pasta+"/nagueta/index.php";
	function obterObjRequisicao()
	{
		if(window.XMLHttpRequest)
		{
			return new XMLHttpRequest();
		}
 		else if(window.ActiveXObject)
		{
  		  return new ActiveXObject("Microsoft.XMLHTTP");
		}
  		return null;
}


  var http = obterObjRequisicao();
  document.getElementById("todo_conteudo").innerHTML="";
  document.getElementById("loading").style.display="block";


  if(http)
  {
    http.onreadystatechange = processar;
    http.open("GET", url, true);
    http.send(null);
  }
  function processar()
  {
    if(http.readyState == 4)
	{
      if(http.status == 200)
	  {
			document.getElementById("loading").style.display="none";
			document.getElementById("todo_conteudo").innerHTML=http.responseText;   	
	   
      }
    }
  }

}




function completo(foto)
{

	if(foto.complete)
	{
		clearInterval(carrega);
		document.getElementById("caixa_imagens").innerHTML="<img src="+foto.src+" id='fotosdoalbum'   title=\"show da banda Na Gueta com a novaformação e pre-Lançamento do 1º CD da Banda\"         alt=\"show da banda Na Gueta com a novaformação e pre-Lançamento do 1º CD da Banda\">"; 
	}
}
function busca(url)
{
 document.getElementById("caixa_imagens").innerHTML=" <object id=\"FlashID4\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"250\" height=\"200\">"+
    "<param name=\"movie\" value=\"image/logop2.swf\" />"+
    "<param name=\"quality\" value=\"high\" />"+
    "<param name=\"wmode\" value=\"transparent\" />"+
    "<param name=\"swfversion\" value=\"6.0.65.0\" />"+
    "<!-- Esta tag param solicita que os usurios com o Flash Player 6.0 r65 e verses posteriores baixem a verso mais recente do Flash Player. Exclua-o se voc no deseja que os usurios vejam o prompt. -->"+
    "<!-- A tag object a seguir aplica-se a navegadores que no sejam o IE. Portanto, oculte-a do IE usando o IECC. -->"+
    "<!--[if !IE]>-->"+
    "<object type=\"application/x-shockwave-flash\" data=\"image/logop.swf\" width=\"250\" height=\"200\">"+
      "<!--<![endif]-->"+
      "<param name=\"quality\" value=\"high\" />"+
      "<param name=\"wmode\" value=\"transparent\" />"+
      "<param name=\"swfversion\" value=\"6.0.65.0\" />"+
      "<!-- O navegador exibe o seguinte contedo alternativo para usurios que tenham o Flash Player 6.0 e verses anteriores. -->"+
      "<div>"+
        "<h4>O contedo desta pgina requer uma verso mais recente do Adobe Flash Player.</h4>"+
        "<p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Obter Adobe Flash player\" width=\"112\" height=\"33\" /></a></p>"+
      "</div>"+
      "<!--[if !IE]>-->"+
    "</object>"+
    "<!--<![endif]-->"+
  "</object>";






 
	foto=new Image();
	foto.src=url;
	carrega=window.setInterval("completo(foto)",100);
}	


function completopop(foto,novadiv)
{
	if(foto.complete)
	{
		clearInterval(carregan);
		/*if(document.getElementById("agenda_marquee")){
		textopopup=document.getElementById("agenda_marquee").getElementsByTagName("DIV")[this.length].innerHTML;
		}
		if(document.getElementById("divdaagenda")){
		textopopup=document.getElementById("divdaagenda").getElementsByTagName("DIV")[this.length].innerHTML;
		}*/
		//alert(textopopup);
		var largura=window.availWidth;
		var altura=window.availHeight ;
		novadiv.innerHTML="<div style=\"background-image:url("+foto.src+");width:1024;height:"+altura+";background-repeat:no-repeat;display:block\"></div>";//flyer da página inicial 
		objimage=novadiv.getElementsByTagName("div")[0];
		timerndiv=window.setInterval("mover()",1);
		objimage.onmouseout=function(){timerndiv=window.setInterval("mover()",1)}
		objimage.onmouseover=function(){clearInterval(timerndiv);}
}
}
	function buscapop(url,novadiv){
	 novadiv.innerHTML="<object id=\"FlashID4\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"250\" height=\"200\">"+
		"<param name=\"movie\" value=\"image/logop2.swf\" />"+
		"<param name=\"quality\" value=\"high\" />"+
		"<param name=\"wmode\" value=\"transparent\" />"+
		"<param name=\"swfversion\" value=\"6.0.65.0\" />"+
		"<!-- Esta tag param solicita que os usurios com o Flash Player 6.0 r65 e verses posteriores baixem a verso mais recente do Flash Player. Exclua-o se voc no deseja que os usurios vejam o prompt. -->"+
		"<!-- A tag object a seguir aplica-se a navegadores que no sejam o IE. Portanto, oculte-a do IE usando o IECC. -->"+
		"<!--[if !IE]>-->"+
		"<object type=\"application/x-shockwave-flash\" data=\"image/logop.swf\" width=\"250\" height=\"200\">"+
		  "<!--<![endif]-->"+
		  "<param name=\"quality\" value=\"high\" />"+
		  "<param name=\"wmode\" value=\"transparent\" />"+
		  "<param name=\"swfversion\" value=\"6.0.65.0\" />"+
		  "<!-- O navegador exibe o seguinte contedo alternativo para usurios que tenham o Flash Player 6.0 e verses anteriores. -->"+
		  "<div>"+
			"<h4>O contedo desta pgina requer uma verso mais recente do Adobe Flash Player.</h4>"+
			"<p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Obter Adobe Flash player\" width=\"112\" height=\"33\" /></a></p>"+
		  "</div>"+
		  "<!--[if !IE]>-->"+
		"</object>"+
		"<!--<![endif]-->"+
	  "</object>"; 
		 foto=new Image();
		foto.src=url;
		carregan=window.setInterval("completopop(foto,novadiv)",100);
}	
	
			

  

	   
 

//apresentação da pagina inicial 

/*
ff=100;//100% opaco
jf=0;//numero da foto
hf=2;//final da string texto
tf=1;//começo da string texto
af=1;//array da variavel do texto


 carrega fotos 



function animafotos(){
novafoto=new Image();
novafoto.src="image/naguetaini1.jpg";
novafoto2=new Image();
novafoto2.src="image/naguetaini2.jpg";
novafoto3=new Image();
novafoto3.src="image/naguetaini3.jpg";
novafoto4=new Image();
novafoto4.src="image/naguetaini4.jpg";

iniciof=setTimeout("trans(flyers.className='aprese1',ff=0);",10000);
}
function trans(){

timer=window.setInterval("transparencia(ff-=2)",1);
}

function transparencia(){
document.getElementById("flyers").style.backgroundImage="none";
document.getElementById("flyers").style.filter='alpha(opacity='+ff+');';//fica transparente
if(ff<=0){
clearInterval(timer);
jf++;
af++;
document.getElementById("escreva").innerHTML="";
document.fotodefault.src='image/naguetaini'+jf+'.jpg';
timer2=window.setInterval("transparencia2(ff+=2)",1);
}
}

function transparencia2(){
document.getElementById("flyers").style.filter='alpha(opacity='+ff+');';
if(ff>=100){
clearInterval(timer2);
timer3=window.setInterval("textos()",10);
}
}

function textos(){
var texto=new Array(4);

texto[2]="   <br><br><br><br><br> 19/12 Na GUETA e o RAPPA confira o flyer! ";
texto[3]="   <br><br><br><br><br> Banda NA GUETA 1º lugar no Festival de Osasco com a música Etnocultura concorrendo na categoria MPB ";
texto[4]="   <br><br><br><br><br> A Banda Na GUETA deseja a todos os amigos fãs um um Feliz Natal e um<br> Prospero ano novo repleto de"+
"saúde e paz esses são os votos da famíla NA GUETA  ";
texto[5]="   <br><br><br><br><br> &nbsp;&nbsp;&nbsp;De um click no botão mp3 ouças as  musicas da banda";


hf++;
document.getElementById("escreva").innerHTML=(texto[af]).substring(tf,hf);
if(hf>=300){
hf=2;
clearInterval(timer3);
iniciof=setTimeout("trans();",10000);
if(jf>=4){
jf=0;
af=1;
tf=1;
hf=2;
}
}
}

*/




//detecta class id e name
	
/*addEvent(document,"mouseover",cap)
	function cap(e){
		if(typeof(e)=='undefined')var e=window.event;
source=e.target?e.target:e.srcElement;
if(source.nodeType==3)source =source.parentNode;
	document.title="  id= "+source.id+" name= "+source.name+" class="+source.className;	
		}*/
		
		
var parabaixo=50;//centro da circunferencia em y
var paradireita=200;//centro da circunferencia em x
var teta_rad = 0; // angulo em radianos (0 a 2PI)
var teta_deg = 0; //angulo em graus (0º - 360º)
inc_teta = 5; //valor de incremento do angulo
Raio = 70; //raio da circunferencia
inc_Raio = 0; //incremento do Raio
dec_Raio = 0; //decremento do Raio



function mover()
{
	var objimage=novadiv.getElementsByTagName("DIV")[0];
	if(objimage)
	{
		x=Raio * Math.cos(teta_rad);//calculo da coordenada x da circunferência
		y=Raio * Math.sin(teta_rad);//calculo da coordenada y da circunferência
		
		Ex=Math.round(x);//arredonda a cordenada x
		Ey=Math.round(y);//arredonda coordenada y
		
		objimage.style.left=(Ex+paradireita)+"px";//centro mais a cordenada
		objimage.style.top=(Ey+parabaixo)+"px";// centro mai a cordenada
		teta_deg = teta_deg + inc_teta;
		
		Raio = Raio + inc_Raio;
		Raio = Raio - dec_Raio;
		
		teta_rad = (teta_deg*6.283185307179586476925286766559/360);
	}
}


