function one_star(){
	document.getElementById("ref_star").value="2";
	document.getElementById("mostra").innerHTML="1&nbsp;&nbsp;";
	document.getElementById("bot_votar").disabled=false;
	if (document.getElementById("1_star_out")){
		document.getElementById("1_star").innerHTML="";
		document.getElementById("1_star").innerHTML="<img src='puzzle/rating_over.gif' id='1_star_over' alt='1 Estrela' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("5_star_over")){
		document.getElementById("5_star").innerHTML="";
		document.getElementById("5_star").innerHTML="<img src='puzzle/rating_out.gif' id='5_star_out' alt='5 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("4_star_over")){
		document.getElementById("4_star").innerHTML="";
		document.getElementById("4_star").innerHTML="<img src='puzzle/rating_out.gif' id='4_star_out' alt='4 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("3_star_over")){
		document.getElementById("3_star").innerHTML="";
		document.getElementById("3_star").innerHTML="<img src='puzzle/rating_out.gif' id='3_star_out' alt='3 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("2_star_over")){
		document.getElementById("2_star").innerHTML="";
		document.getElementById("2_star").innerHTML="<img src='puzzle/rating_out.gif' id='2_star_out' alt='2 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
}

function two_star(){
	document.getElementById("ref_star").value="4";
	document.getElementById("mostra").innerHTML="2&nbsp;&nbsp;";
	document.getElementById("bot_votar").disabled=false;
	if (document.getElementById("2_star_out")){
		document.getElementById("2_star").innerHTML="";
		document.getElementById("2_star").innerHTML="<img src='puzzle/rating_over.gif' id='2_star_over' alt='2 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		if (document.getElementById("1_star_out")){
			document.getElementById("1_star").innerHTML="";
			document.getElementById("1_star").innerHTML="<img src='puzzle/rating_over.gif' id='1_star_over' alt='1 Estrela' style='margin-right:5px; cursor:pointer;'/>";
		}	
	}
	if (document.getElementById("5_star_over")){
		document.getElementById("5_star").innerHTML="";
		document.getElementById("5_star").innerHTML="<img src='puzzle/rating_out.gif' id='5_star_out' alt='5 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("4_star_over")){
		document.getElementById("4_star").innerHTML="";
		document.getElementById("4_star").innerHTML="<img src='puzzle/rating_out.gif' id='4_star_out' alt='4 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("3_star_over")){
		document.getElementById("3_star").innerHTML="";
		document.getElementById("3_star").innerHTML="<img src='puzzle/rating_out.gif' id='3_star_out' alt='3 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
}

function three_star(){
	document.getElementById("ref_star").value="6";
	document.getElementById("mostra").innerHTML="3&nbsp;&nbsp;";
	document.getElementById("bot_votar").disabled=false;
	if (document.getElementById("3_star_out")){
		document.getElementById("3_star").innerHTML="";
		document.getElementById("3_star").innerHTML="<img src='puzzle/rating_over.gif' id='3_star_over' alt='3 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		if (document.getElementById("1_star_out")){
			document.getElementById("1_star").innerHTML="";
			document.getElementById("1_star").innerHTML="<img src='puzzle/rating_over.gif' id='1_star_over' alt='1 Estrela' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("2_star_out")){
			document.getElementById("2_star").innerHTML="";
			document.getElementById("2_star").innerHTML="<img src='puzzle/rating_over.gif' id='2_star_over' alt='2 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
	}
	if (document.getElementById("5_star_over")){
		document.getElementById("5_star").innerHTML="";
		document.getElementById("5_star").innerHTML="<img src='puzzle/rating_out.gif' id='5_star_out' alt='5 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
	if (document.getElementById("4_star_over")){
		document.getElementById("4_star").innerHTML="";
		document.getElementById("4_star").innerHTML="<img src='puzzle/rating_out.gif' id='4_star_out' alt='4 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
}

function four_star(){
	document.getElementById("ref_star").value="8";
	document.getElementById("mostra").innerHTML="4&nbsp;&nbsp;";
	document.getElementById("bot_votar").disabled=false;
	if (document.getElementById("4_star_out")){
		document.getElementById("4_star").innerHTML="";
		document.getElementById("4_star").innerHTML="<img src='puzzle/rating_over.gif' id='4_star_over' alt='4 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		if (document.getElementById("1_star_out")){
			document.getElementById("1_star").innerHTML="";
			document.getElementById("1_star").innerHTML="<img src='puzzle/rating_over.gif' id='1_star_over' alt='1 Estrela' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("2_star_out")){
			document.getElementById("2_star").innerHTML="";
			document.getElementById("2_star").innerHTML="<img src='puzzle/rating_over.gif' id='2_star_over' alt='2 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("3_star_out")){
			document.getElementById("3_star").innerHTML="";
			document.getElementById("3_star").innerHTML="<img src='puzzle/rating_over.gif' id='3_star_over' alt='3 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
	}
	if (document.getElementById("5_star_over")){
		document.getElementById("5_star").innerHTML="";
		document.getElementById("5_star").innerHTML="<img src='puzzle/rating_out.gif' id='5_star_out' alt='5 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
	}
}

function five_star(){
	document.getElementById("ref_star").value="10";
	document.getElementById("mostra").innerHTML="5&nbsp;&nbsp;";
	document.getElementById("bot_votar").disabled=false;
	if (document.getElementById("5_star_out")){
		document.getElementById("5_star").innerHTML="";
		document.getElementById("5_star").innerHTML="<img src='puzzle/rating_over.gif' id='5_star_over' alt='5 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		if (document.getElementById("1_star_out")){
			document.getElementById("1_star").innerHTML="";
			document.getElementById("1_star").innerHTML="<img src='puzzle/rating_over.gif' id='1_star_over' alt='1 Estrela' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("2_star_out")){
			document.getElementById("2_star").innerHTML="";
			document.getElementById("2_star").innerHTML="<img src='puzzle/rating_over.gif' id='2_star_over' alt='2 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("3_star_out")){
			document.getElementById("3_star").innerHTML="";
			document.getElementById("3_star").innerHTML="<img src='puzzle/rating_over.gif' id='3_star_over' alt='3 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
		if (document.getElementById("4_star_out")){
			document.getElementById("4_star").innerHTML="";
			document.getElementById("4_star").innerHTML="<img src='puzzle/rating_over.gif' id='4_star_over' alt='4 Estrelas' style='margin-right:5px; cursor:pointer;'/>";
		}
	}
}

function pegarPosicaoX(objeto){
    var atual_left = 0;
    if (objeto.offsetParent){
        while (objeto.offsetParent){
            atual_left += objeto.offsetLeft
            objeto = objeto.offsetParent;
        }
    }
    return atual_left;
}
 
function pegarPosicaoY(objeto){
    var atual_top = 0;
    if (objeto.offsetParent){
        while (objeto.offsetParent){
            atual_top += objeto.offsetTop
            objeto = objeto.offsetParent;
        }
    }
    return atual_top;
} 

function open_indi(url_link){
	document.getElementById('light_tela').style.backgroundImage="url(puzzle/fundo_chamadas_outro.jpg)";
	var elemento = document.getElementById('indi');
	x = pegarPosicaoX(elemento);
	y = pegarPosicaoY(elemento); 
    if (navigator.appName == 'Microsoft Internet Explorer') {   
		document.getElementById('light_tela').style.height='355px';
	    document.getElementById('light_tela').style.width='257px';
	} else if (navigator.appName == 'Netscape') {   
		document.getElementById('light_tela').style.height='355px';
	    document.getElementById('light_tela').style.width='246px';
    }else{
		document.getElementById('light_tela').style.height='355px';
	    document.getElementById('light_tela').style.width='257px';
	}
	document.getElementById('light_tela').style.top = y+25 + "px";
	document.getElementById('light_tela').style.left = x-5 + "px";
	document.getElementById('light_tela').style.display='block';
	sal_ph11.open("GET","indique.php?url_link="+url_link);
	sal_ph11.onreadystatechange= function(){
		if (sal_ph11.readyState == 4 && sal_ph11.status == 200){
			text_response = sal_ph11.responseText;
			document.getElementById('dad_tela').innerHTML = text_response;
			extScript(text_response);
		}
	}
	update_indi();
	sal_ph11.send(null);
}

function update_indi(){
	document.getElementById('dad_tela').innerHTML = "<img src='puzzle/loading.gif'>";
}

function open_colab(url_link){
document.getElementById('light_tela').style.backgroundImage="url(puzzle/fundo_chamadas.jpg)";
	var elemento = document.getElementById('cola');
	x = pegarPosicaoX(elemento);
	y = pegarPosicaoY(elemento); 
    if (navigator.appName == 'Microsoft Internet Explorer') {   
		document.getElementById('light_tela').style.height='280px';
	    document.getElementById('light_tela').style.width='257px';
	} else if (navigator.appName == 'Netscape') {   
		document.getElementById('light_tela').style.height='275px';
	    document.getElementById('light_tela').style.width='244px';
    }else{
		document.getElementById('light_tela').style.height='280px';
	    document.getElementById('light_tela').style.width='257px';
	}
	document.getElementById('light_tela').style.top = y+25 + "px";
	document.getElementById('light_tela').style.left = x-5 + "px";
	document.getElementById('light_tela').style.display='block';
	sal_ph11.open("GET","colabo.php?url_link="+url_link);
	sal_ph11.onreadystatechange= function(){
		if (sal_ph11.readyState == 4 && sal_ph11.status == 200){
			text_response = sal_ph11.responseText;
			document.getElementById('dad_tela').innerHTML = text_response;
			extScript(text_response);
		}
	}
	update_indi();
	sal_ph11.send(null);
}

function fechar_tela(){
	document.getElementById('light_tela').style.display='none';
	document.getElementById("dad_tela").innerHTML="";
}

function valid_coment(){
	if (document.getElementById("cnome").value==""){
		alert("Nome Obrigatório para comentar");
		document.getElementById("cnome").focus();
		return false;
	}
	if (document.getElementById("cmail").value==""){
		alert("E-mail Obrigatório para comentar");
		document.getElementById("cmail").focus();
		return false;
	}
	if (document.getElementById("ctexto").value==""){
		alert("Digite seu comentário");
		document.getElementById("ctexto").focus();
		return false;
	}
	document.getElementById("enviando").value="1";
	document.form_coment.submit();
}

function indica(){
	if (document.getElementById("t_nome_i").value==""){
		alert("Digite seu Nome");
		document.getElementById("t_nome_i").focus();
		return false;
	}
	if (document.getElementById("t_mail_i").value==""){
		alert("Digite seu e-mail");
		document.getElementById("t_mail_i").focus();
		return false;
	}
	if (document.getElementById("t_texto_i").value==""){
		alert("Digite sua mensagem");
		document.getElementById("t_texto_i").focus();
		return false;
	}
	if (document.getElementById("t_no_i").value==""){
		alert("Digite o nome de seu amigo");
		document.getElementById("t_no_i").focus();
		return false;
	}
	if (document.getElementById("t_ma_i").value==""){
		alert("Digite o e-mail de seu amigo");
		document.getElementById("t_ma_i").focus();
		return false;
	}
    var nav;
	if (navigator.appName == 'Microsoft Internet Explorer'){
		nav = 2;
	} else if (navigator.appName == 'Netscape'){   
		nav = 1;    
	}else{
		nav = 2;
	}
	link_sal_ph11 = "indique.php?indi=s&url_link_other="+document.getElementById("url_hidden").value+"&nom_rem="+escape(document.getElementById("t_nome_i").value)+"&mail_rem="+escape(document.getElementById("t_mail_i").value)+"&mensa="+escape(document.getElementById("t_texto_i").value)+"&nom_des="+escape(document.getElementById("t_no_i").value)+"&mail_des="+escape(document.getElementById("t_ma_i").value);
	sal_ph11.open("GET",link_sal_ph11);
	sal_ph11.onreadystatechange= function(){
		if (sal_ph11.readyState == 4 && sal_ph11.status == 200){
			text_response = sal_ph11.responseText;
			document.getElementById('dad_tela').innerHTML = text_response;
			extScript(text_response);
		}
	}
	update_indi();
	sal_ph11.send(null);
}

function colabo(){
	if (document.getElementById("t_nome_i").value==""){
		alert("Digite seu Nome");
		document.getElementById("t_nome_i").focus();
		return false;
	}
	if (document.getElementById("t_mail_i").value==""){
		alert("Digite seu e-mail");
		document.getElementById("t_mail_i").focus();
		return false;
	}
	if (document.getElementById("t_texto_i").value==""){
		alert("Digite sua mensagem");
		document.getElementById("t_texto_i").focus();
		return false;
	}
    var nav;
	if (navigator.appName == 'Microsoft Internet Explorer'){
		nav = 2;
	} else if (navigator.appName == 'Netscape'){   
		nav = 1;    
	}else{
		nav = 2;
	}
	link_sal_ph11 = "colabo.php?colab=s&url_link_other="+document.getElementById("url_hidden").value+"&nom_rem="+escape(document.getElementById("t_nome_i").value)+"&mail_rem="+escape(document.getElementById("t_mail_i").value)+"&mensa="+escape(document.getElementById("t_texto_i").value);
	alert(link_sal_ph11);
	sal_ph11.open("GET",link_sal_ph11);
	sal_ph11.onreadystatechange= function(){
		if (sal_ph11.readyState == 4 && sal_ph11.status == 200){
			text_response = sal_ph11.responseText;
			document.getElementById('dad_tela').innerHTML = text_response;
			extScript(text_response);
		}
	}
	update_indi();
	sal_ph11.send(null);
}
