//AJAX

function loadASSUNTO(palco,ACAO,prog){
		window.parent.document.getElementById("base_desc_agenda").style.display= "block";
		window.parent.document.getElementById("agenda").innerHTML= '<p class="txt-branco-bold2">Carregando...</p>'
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		  xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
			window.parent.document.getElementById("agenda").innerHTML= xmlhttp.responseText;
			}
		  }
		xmlhttp.open("GET","busca_agenda.asp?IDMUSICO="+ACAO+"&palco="+palco+"&IDPROG="+prog+"",true);
		xmlhttp.send();
}

function loadASSUNTO2(palco,ACAO,prog){
		window.document.getElementById("base_desc_agenda").style.display= "block";
		window.document.getElementById("agenda").innerHTML= '<p class="txt-branco-bold2">Carregando...</p>'
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		  xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
			window.document.getElementById("agenda").innerHTML= xmlhttp.responseText;
			}
		  }
		xmlhttp.open("GET","busca_agenda.asp?IDMUSICO="+ACAO+"&palco="+palco+"&IDPROG="+prog+"",true);
		xmlhttp.send();
}

function limpar_fechar(){
	
	window.parent.document.getElementById("agenda").innerHTML= ""
	window.parent.document.getElementById("base_desc_agenda").style.display= "none";
	
}

function limpar_fechar2(){
	
	window.document.getElementById("agenda").innerHTML= ""
	window.document.getElementById("base_desc_agenda").style.display= "none";
	
}

function limpa_janela(id){
	window.document.getElementById(id).style.display= "none";
}






//Menu abas

function abas(id){
	
	$("#"+id).slideToggle("slow")
	
}


//Soma

function Soma(){
	var x = document.getElementById("real2").value;
	var y = document.getElementById("real").value;
	var valorx = parseFloat(x) + parseFloat(y);
	var valor = valorx.toFixed(2)
	document.getElementById("valor_final").innerHTML='R$ '+valor;
	document.getElementById("real2").value=valor;
}

function Minus(){
	var x = document.getElementById("real2").value;
	var y = document.getElementById("real").value;
	var valorx = parseFloat(x) - parseFloat(y);
	var valor = valorx.toFixed(2)
	document.getElementById("valor_final").innerHTML='R$ '+valor;
	document.getElementById("real2").value=valor;
}


function ApagarForm(forms){
var numero;
for (numero=forms; numero>0; numero--){
	document.getElementById('nome_'+numero).value='';
}

}



//Canvas - Slice //

var img = new Image();
var i=0;

function draw() {
		
	for(var i = 0; i < 3; i++) {
	
	var pic = $("#source"+i)

	pic.removeAttr("width"); 
	pic.removeAttr("height");
	
	var pic_real_width = pic.width();
	var pic_real_height = pic.height();
	
	  var ctx = document.getElementById("canvas"+i).getContext('2d');
	    ctx.drawImage(document.getElementById("source"+i),5,5,(pic_real_width+150)/2,(pic_real_height+150)/2)
	  }
}

function draw2(vl) {
		
	for(var i = 0; i < vl; i++) {
	
	var pic = $("#source"+i)

	pic.removeAttr("width"); 
	pic.removeAttr("height");
	
	var pic_real_width = pic.width();
	var pic_real_height = pic.height();
	
	  var ctx = document.getElementById("canvas"+i).getContext('2d');
	    ctx.drawImage(document.getElementById("source"+i),-50,-80,(pic_real_width+200)/2,(pic_real_height+200)/2)
	  }
}

//Rolagem

var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
	else window.frames[frm].scrollBy(inc, 0);
	timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
  }
  
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }


// Revelar rolagem //

function chave(id){
			if (id==0) {
					window.parent.document.getElementById("valor").style.display="none";	
			}
			
			else if(id==1) {
					window.parent.document.getElementById("valor").style.display="";
			}
		}


//Lightbox : Necessário da aplicação do arquivo jquery.js no corpo da página que estiver executando

function img_maior(caminho,legenda){
	
		//para gerar o encontrar um ID que está numa janela anterior, favor mudar o código para:
		// $("#loader",window.parent.document).html().fadeIn("slow", function(){ $("#base_lightbox").slideDown("slow");});
		//---
		$("#ltimg").attr("src", caminho);
		
		$("#bg_lightbox").fadeIn("slow", function(){ $("#base_lightbox").slideDown("slow", function(){ $("#ltimg").slideDown("slow") });});
		
		
		
		window.document.getElementById("legenda").innerHTML = legenda
		
}

function fechar_lightbox(){
	
		$("#ltimg").fadeOut("fast")
		
		$("#base_lightbox").fadeOut("fast")
		
		$("#bg_lightbox").fadeOut("slow")
	
}

//---

//Destaques


function Reveladest1(){
	
	window.document.getElementById('dst02').style.display = 'block';
	window.document.getElementById('dst01').style.display = 'none';
	window.document.getElementById('dst03').style.display = 'none';
}


function Reveladest2(){
	
	window.document.getElementById('dst03').style.display = 'block';
	window.document.getElementById('dst01').style.display = 'none';
	window.document.getElementById('dst02').style.display = 'none';
}

function Retornadest1(){
	
	window.document.getElementById('dst01').style.display = 'block';
	window.document.getElementById('dst02').style.display = 'none';
	window.document.getElementById('dst03').style.display = 'none';
}



