/*

$(document).ready( function (){
	$("#button_amigo").click(function() {
		$("#amigo").fadeIn("slow");
		$("#button_amigo").fadeOut("slow");
	});	
	$("#botao_resenha").click(function() {
		$("#resenha").slideDown();
		$("#botao_resenha").hide();
	})
	$("#fecha").click(function(){
		$("#botao_resenha").show();
		$("#resenha").slideUp();
	})	
	$(function(){ $('input[@type=radio].star').rating(); });
});	
*/

function display(id, on_off) { 
	var el = document.all ? document.all[id] : document.getElementById(id);  if(el) el.style.display = on_off ? '' : 'none'; 
}

function foto(endereco) {
	var sobraX = 0;
	var sobraY = 0;
	if (navigator.appName == "Netscape")
		sobraY = 23;

	nova = window.open('', 'foto', 'fullscreen=0,location=0,directories=0,menubar=0,toolbar=0,status=0,resizable=1,scrollbars=0, width=100, height=50, top=50, left=100')
	nova.document.write('<HTML><HEAD><TITLE>Por Minuto - Onde Correr</TITLE></HEAD>');
	nova.document.write('<BODY bgcolor=black background=f6.jpg leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin:0;overflow:hidden" onload="self.resizeTo(document.pic.width + ' + sobraX.toString() + ', document.pic.height + ' + sobraY.toString() + ');">\r\n');
	nova.document.write('<a href="#"><IMG SRC="' + endereco + '" BORDER=0 name="pic" alt="clique para fechar" onclick="parent.self.close();"></a></BODY></HTML>');
	nova.document.close();
	nova.focus();
}

function pop(endereco, X, Y, rolagem) {
	//var windowX = Math.ceil((window.screen.width  - X) / 2);
	//var windowY = Math.ceil((window.screen.height - Y) / 2);
	parametros='fullscreen=0,location=0,directories=0,menubar=0,scrollbars='+rolagem+',status=1,toolbar=0,resizable=0,width=' + X.toString()+ ',height=' +Y.toString();
	//+ ',left=' + Math.ceil(windowX).toString() + ',top=' + Math.ceil(windowY).toString()
	nova = window.open (endereco, 'nova', parametros)
	//if (navigator.platform == 'MacPPC') nova.resizeTo (X, Y);
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function displayFlash(largura, altura, arquivo){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+largura+'" height="'+altura+'" id="teste" align="middle">');
	document.write('	<param name="allowScriptAccess" value="sameDomain">');
	document.write('	<param name="wmode" value="transparent">');
	document.write('	<param name="movie" value="'+arquivo+'">');
	document.write('	<param name="quality" value="best">');
	document.write('	<param name="menu" value="false">');
	document.write('	<param name="bgcolor" value="#ffffff">');
	document.write('	<embed src="'+arquivo+'" wmode="transparent" menu="false" quality="best" width="'+largura+'" height="'+altura+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash">');
	document.write('</object>');
}

function EnableComment(){
	var objComentario 			= document.getElementById("objComentario")
	var objIndicacao 			= document.getElementById("objIndicacao")

	objComentario.style.display = "";
	objIndicacao.style.display = "none";
}

function EnableIndication(idVideo){
	var objComentario 			= document.getElementById("objComentario")
	var objIndicacao 			= document.getElementById("objIndicacao")

	objIndicacao.style.display = "";
	objComentario.style.display = "none";
}

function EnviaIndicacao(idVideo, objForm, stLink){
	if(objForm.stNome.value == ""){
		alert("Favor preencher o campo Nome");
		objForm.stNome.focus();
	}else if(objForm.stEmail.value == ""){
		alert("Favor preencher o campo E-mail corretamente");
		objForm.stEmail.focus();
	}else if(objForm.stNomeAmigo.value == ""){
		alert("Favor preencher o campo Nome do Amigo");
		objForm.stNomeAmigo.focus();
	}else if(objForm.stEmailAmigo.value == ""){
		alert("Favor preencher o campo E-mail do Amigo corretamente");
		objForm.stEmailAmigo.focus();
	}else{
		RunAjaxRequest("POST", "../../scripts/indique/IndiqueVideo.asp", 'stNome='+objForm.stNome.value+'&stEmail='+objForm.stEmail.value+'&stNomeAmigo='+objForm.stNomeAmigo.value+'&stEmailAmigo='+objForm.stEmailAmigo.value+'&stLink='+stLink+'&idVideo='+idVideo, RetornoIndiqueVideo);
	}
}

function RetornoIndiqueVideo(objRetorno){
	var objIndicacao 			= document.getElementById("objIndicacao")
	var objLoader				= document.getElementById("div_loader")
	var objEmailSucesso			= document.getElementById("objEmailSucesso")

	objIndicacao.style.display = "none";
	objLoader.style.display = "";

	if(objRetorno.readyState == 4){
		if (objRetorno.status == 200){
			objLoader.style.display = "none";
			objEmailSucesso.style.display = "";
		}
	}
}