// JavaScript Document
//A
function senhaCamera(){
	alert('Para Acesso a camera: \n Login: surf \n Senha: 123');
	document.location = 'ao_vivo.php';
}

function alerta(){
	alert("Passou");	
}

function aoVivo(url, objId){
	//alert(objId);
	ajax(url, objId);
	//setTimeout("aoVivo('"+url+"', '"+objID+"')");
}

function ajax(serverPage, objID){
	//alert("Aqui Foi");
	
	var xmlhttp = false;
	var obj = document.getElementById(objID);
	
	try{
		xmlhttp	= new ActiveXObject("Msxm12.XMLHTTP");
		//alert("Usando Microsoft");
	} catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			//alert("Usando Microsoft");
		}catch(E){
			//alert("Não é Microsoft!");
			xmlhttp = false;
		}
	}

if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
		xmlhttp = new XMLHttpRequest();	
		//alert("Usando FireFox");
	}

	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4){
			document.getElementById(objID).innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET", serverPage, true);
	xmlhttp.send(null);	
		
/*	
	xmlhttp.open("GET", serverPage, true);
	
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4){
			obj.innerHTML = xmlhttp.responseText;	
		}
	}
	xmlhttp.send(null);
*/
}


//B
//C
//D
function direciona(url, id){
	document.location = url+'id='+id;	
}

//E
function exclui(url){
	//alert("Passou");
	if(confirm('Tem certeza que deseja excluir?')){ 
		document.location=url;
	}
}

//F
//G
function galeria(url, obj_id){
	objMostra(obj_id);
	ajax(url, obj_id);
}

//H
//I
//J
//L
//M
function mostraBoletim(){
	//document.getElementById('campos_boletim').style['display'] = "block";
	var praia = document.getElementById('praia').value;
	//alert(praia);
	ajax('campos_boletim.php?praia='+praia, 'cBoletim');
}
function mostraBoletimFotos(id){
	if(id){ 

		var url = 'boletim_fotos.php?praia='+id;
		//alert(url);
		ajax(url, 'boletim_fotos_'+id);
		
	}else{
		ajax('boletim_fotos.php?praia=1', 'boletim_fotos_1');
		ajax('boletim_fotos.php?praia=2', 'boletim_fotos_2');	
	}
}


//N
function numNoticias(obj){
	if(obj == 'quant') var num = document.getElementById('num_noticias').value;
	else var num = 'todos';
	document.location = 'noticias.php?num_mostra='+num;
}
//O
function objEsconde(obj_id){
	document.getElementById(obj_id).style["visibility"] = "hidden";
}
function objMostra(obj_id){
	document.getElementById(obj_id).style["visibility"] = "visible";
}
//P
function popUp(id){
	window.open('noticia_imagem.php?id='+id, '','width=300,height=300');
}
function popUpAbre(url, tamanho){
		window.open(url, '', tamanho);
}
//Q
//R
//S
//T
function trocaFoto(num_praia, posicao, num_mostra){
	//alert(num_mostra);
	var foto = Number(document.getElementById('num_foto'+num_praia).innerHTML);
	if(posicao == 'mais' & foto < num_mostra) foto += 1;
	if(posicao == 'menos' & foto > 1) foto -= 1;
	
	if(num_praia == 1) var praia = 'prainha';
	if(num_praia == 2) var praia = 'praia_grande';
	
	
	document.getElementById('b_foto'+num_praia).src = 'img_site/img_boletim/'+praia+'_img0'+foto+'.jpg';
	document.getElementById('num_foto'+num_praia).innerHTML = foto;
	

}

//U
//V
//X
//Z

