function mGal(gal,foto) {
	try{
       var xhttp = new ActiveXObject('Microsoft.XMLHTTP');
		 document.location.href="#sfoto";
   }catch(E){
       var xhttp = new XMLHttpRequest();
   }
   var xurl = 'http://www.difusorafm.com.br/galerias.php?gal='+gal+'&foto='+foto;

		xhttp.open('GET',xurl,true);
        xhttp.onreadystatechange=function(){
           if(xhttp.readyState==4){
		   	   eval(xhttp.responseText);
           }
       }
       xhttp.send(null);
}

function rQuiz(q) {
	try{
       var xhttp = new ActiveXObject('Microsoft.XMLHTTP');
		 document.location.href="#sfoto";
   }catch(E){
       var xhttp = new XMLHttpRequest();
   }
   var xurl = 'http://www.difusorafm.com.br/quiz.php?q='+q;

		xhttp.open('GET',xurl,true);
        xhttp.onreadystatechange=function(){
           if(xhttp.readyState==4){
		   	   eval(xhttp.responseText);
           }
       }
       xhttp.send(null);
}

function nw(url){
	window.open(url);
	return false;
}

// Form cadastro

function dAvat(){
   document.getElementById('uavat').checked=true
}
function btCad(){
    var req = {
    "nome":    ("Escreva seu nome."),
    "email":   ("Informe eu e-mail."),
    "apelido": ("Crie um apelido ou nickname."),
    "senha":   ("Você deve criar uma senha.")
  };
  for (var i in req) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(req[i]);
      el.focus();
      return false;
    }
  }
  if(document.getElementById("senha").value!=document.getElementById("vsenha").value){
     alert("Atenção!\nA senha e sua confirmação estão diferentes.\nDigite a mesma senha nos dois campos.");
     document.getElementById("senha").focus();
     return false;
  }
}
function btAtv(){
    var el = document.getElementById("ativnum")
    if(!el.value){
      alert("Copie o código de ativação no campo abaixo.");
      el.focus();
      return false;
    }
}
function btLAtv(){
    var el = document.getElementById("email")
    if(!el.value){
      alert("O campo de e-mail não pode ficar em branco...");
      el.focus();
      return false;
    }
}
function btLSen(){
    var el = document.getElementById("email")
    if(!el.value){
      alert("O campo de e-mail não pode ficar em branco...");
      el.focus();
      return false;
    }
}
function btLgn(){
    var req = {
    "login":   ("Escreva seu e-mail ou seu apelido."),
    "senha":   ("Digite sua senha.")
  };
  for (var i in req) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(req[i]);
      el.focus();
      return false;
    }
  }
}
function login(){
   document.getElementById('pop').style.display='block';
   document.getElementById('login').focus();
   void(0);
}
function fechar(){
   document.getElementById('pop').style.display='none';
   void(0);
}
function btnEnviar() {
    var req = {
    "nome": ("Escreva seu nome."),
    "idade": ("Qual a sua idade?"),
    "email": ("Informe eu e-mail."),
    "cidade": ("Qual a sua cidade?"),
    "area": ("Quer enviar para onde?")
  };
  for (var i in req) {
    var el = document.getElementById(i);
    if(el){
      if(!el.value) {
        alert(req[i]);
        el.focus();
        return false;
      }
    }
  }
  document.getElementById("btok").disabled=true;
}
function blogEnv() {
    var req = {
    "nome": ("Escreva seu nome."),
    "cidade": ("Qual a sua cidade?"),
    "email": ("Informe eu e-mail.")
  };
  for (var i in req) {
    var el = document.getElementById(i);
    if(el){
      if(!el.value) {
        alert(req[i]);
        el.focus();
        return false;
      }
    }
  }
  document.getElementById("btokf").disabled=true;
}
function muralEnv() {
    var req = {
    "nome": ("Escreva seu nome."),
    "cidade": ("Qual a sua cidade?"),
    "email": ("Informe eu e-mail."),
    "assunto": ("Escreva o assunto.")
  };
  for (var i in req) {
    var el = document.getElementById(i);
    if(el){
      if(!el.value) {
        alert(req[i]);
        el.focus();
        return false;
      }
    }
  }
  document.getElementById("btok").disabled=true;
}
function rnr() {
	var el = document.getElementById("email");
	if(el){
		if(!el.value){
			alert("Escreva seu email!");
			el.focus();
			return false;
		}
	}
	document.getElementById("btok").disabled=true;
}
function selIM(img,id) {
	document.getElementById('mimg').value=img;
	void(0);
}

function icvotar(titulo,id){
	var id;
	var titulo;
	document.getElementById("esp1").value=titulo;
	document.getElementById("esp2").value=id;
	document.location.href='#promoform';
}
function abrirplayer(){
   window.open("webradio.php", "player", "width=216,height=179,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,left=20,top=20");
	return false;
}
function abrepopup(url,tgt,w,h){
   window.open(""+url+"", ""+tgt+"", "width="+w+",height="+h+",toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,left=20,top=20");
	return false;
}
var arr = new Array();
function selSong(id){
	if(arr.length==10) {
		alert('Atenção!\nVocê pode adicionar apenas 10 músicas na sua sequência!');
	}else{
		var id;
		document.getElementById('m'+id).style.borderColor = "red";
		document.getElementById('r'+id).style.display = "block";
		document.getElementById('v'+id).style.display = "none";
		arr.push(id);
		document.getElementById('esp2').value = arr;
	}
}
function rmSong(id){
	var id;
	document.getElementById('m'+id).style.borderColor = "#E5E4E0";
	document.getElementById('r'+id).style.display = "none";
	document.getElementById('v'+id).style.display = "block";
	
	for (var i = 0; i < arr.length; i++) {
        if(id == arr[i]) {
            arr.splice(i, 1);
        }
    }
	document.getElementById('esp2').value = arr;
}