	function menuOver(idd){
	document.getElementById('menu_l_' + idd).className = 'topo_menu_div_l';
	document.getElementById('menu_r_' + idd).className = 'topo_menu_div_r';	
}
	function menuOut(idd){
	document.getElementById('menu_l_' + idd).className = '';
	document.getElementById('menu_r_' + idd).className = '';		
}
function some(obj){
	var atual = document.getElementById(obj).value;
	if (atual == 'E-mail' || atual == 'Senha' || atual == 'Buscar no site'){
		document.getElementById(obj).value = '';	
	}
}
function some_s(){
	document.getElementById("topo_senha").innerHTML = '<input name="senha" id="senha" type="password" value="" onblur="coloca_s(this.value);">';
	window.setTimeout("document.getElementById('senha').focus();",1);
}
function coloca_s(valor){
	if (valor == ''){	
	document.getElementById("topo_senha").innerHTML = '<input name="senha" id="senha" type="text" value="Senha" onfocus="some_s();">';
}}
function coloca(obj,valor){
	var atual = document.getElementById(obj).value;
	if (atual == ''){
		document.getElementById(obj).value = valor;	
	}
}	

function GerarSWF(arquivo,altura,largura,id){
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" id="frash" name="' + id + '">');
    document.writeln('        <param name="movie" value="' + arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="' + id + '" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="tl" />');
    document.writeln('        <param name="scale" value="noscale" />');
    document.writeln('        <param name="bgcolor" value="#000000" />');
	document.writeln('        <param name="wmode" value="transparent" />');
    document.writeln('        <param name="allowFullScreen" value="true" />');	
    document.writeln('        <embed allowFullScreen="true" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="' + id + '" bgcolor="#000000" menu="false" quality="high" salign="tl" scale="noscale" id="frash" width="' + largura + '" height="' + altura + '"></embed>');
    document.writeln('    </object>');
}

function abre_vid_home(obj,tit,vw,votos){
	video_id_home = obj;
	document.getElementById('assistir_home').style.display = 'block';	
	document.getElementById('assistir_home_tit').innerHTML = tit;
	
	var arquivo = 'player/player.swf?movie=' + obj + '&bgcolor=0x7c7c7c&fgcolor=0x421e40&volume=100&autoload=on&autorewind=on&clickurl=&clicktarget=';
	var id = obj;
	var largura = '350';
	var altura = '304';
	var bd = '';
    bd = bd + '    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" id="' + id + '" name="' + id + '">';
    bd = bd + '        <param name="movie" value="' + arquivo + '" />';
    bd = bd + '        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />';
    bd = bd + '        <param name="menu" value="false" />';
    bd = bd + '        <param name="quality" value="high" />';
    bd = bd + '        <param name="salign" value="tl" />';
    bd = bd + '        <param name="scale" value="noscale" />';
    bd = bd + '        <param name="bgcolor" value="#000000" />';
	bd = bd + '        <param name="wmode" value="transparent" />';
    bd = bd + '        <param name="allowFullScreen" value="true" />';	
    bd = bd + '        <embed allowFullScreen="true" id="globalnav-embed" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#000000" menu="false" quality="high" salign="tl" scale="noscale" id="' + id + '" width="' + largura + '" height="' + altura + '"></embed>';
    bd = bd + '    </object>';
	
	document.getElementById('assistir_home_vid').innerHTML = bd;
	document.getElementById('view').innerHTML = vw + ' visualizações';
	
	bd = '';

	
	fator_voto_home = votos;
	
	var classe = '_hover';

	if (votos < 1){
	 classe = '';	
	}

    bd = bd + '<a href="javascript: void(0);" onClick="votacao(\'' + obj +  '\', \'1\');" class="bt_star' + classe + '" id="bt_star_1" onMouseOver="bt_star(1,\'1\');" onMouseOut="bt_star(2,\'1\');" title="Ruim"></a>';

	if (votos < 2){
	 classe = '';	
	}

    bd = bd + '<a href="javascript: votacao(\'' + obj +  '\', \'2\');" class="bt_star' + classe + '" id="bt_star_2" onMouseOver="bt_star(1,\'2\');" onMouseOut="bt_star(2,\'2\');" title="Regular"></a>';

	if (votos < 3){
	 classe = '';	
	}

    bd = bd + ' <a href="javascript: votacao(\'' + obj +  '\', \'3\');" class="bt_star' + classe + '" id="bt_star_3" onMouseOver="bt_star(1,\'3\');" onMouseOut="bt_star(2,\'3\');" title="Bom"></a>';
	
	if (votos < 4){
	 classe = '';	
	}

    bd = bd + ' <a href="javascript: votacao(\'' + obj +  '\', \'4\');" class="bt_star' + classe + '" id="bt_star_4" onMouseOver="bt_star(1,\'4\');" onMouseOut="bt_star(2,\'4\');" title="Ótimo"></a>';

	if (votos < 5){
	 classe = '';	
	}

    bd = bd + '<a href="javascript: votacao(\'' + obj +  '\', \'5\');" class="bt_star' + classe + '" id="bt_star_5" onMouseOver="bt_star(1,\'5\');" onMouseOut="bt_star(2,\'5\');" title="Excelente"></a>';
	
	
	document.getElementById('estrelas').innerHTML = bd;
	document.getElementById('vote_lbl').innerHTML = 'Vote nesse vídeo';
	
		
}
function fecha_vid_home(){
	document.getElementById('assistir_home').style.display = 'none';	
	document.getElementById('assistir_home_vid').innerHTML = ''
}

//Faz rotação na home
function gira_vid(div,obj,obj_str,pos,porp){
	
	var acrescenta = 0;
	var bd = '';
	var i;
	var inicio = pos;
	var qtde = obj.length;
	var qtde_proximo = pos + porp;
	var qtde_anteriores = pos - porp;
	
	
	if (qtde_anteriores < 1){
		qtde_anteriores = (qtde + qtde_anteriores);
	}		

	bd = '<a href="javascript:gira_vid(\'' + div + '\', ' + obj_str + ',\'' +  obj_str + '\','+qtde_anteriores+','+porp+');" id="bt_menos" title="Vídeos anteriores"></a>';		
	
	for (i = 1;i<(porp+1);i++){
		
		//existe esse index na array?
		if ( (pos + (i -2)) < qtde ){
			var atual = obj[((inicio) - 1) + (i - 1)].split('|');
			
			var link_item = atual[4];
			if(link_item.length == 20){
				link_item = '/revista/violaopro/video.asp?' + atual[4];
			}else{
				link_item = '/revista/violaopro/produto.asp?id=' + atual[4];
			}
			
			var img_item = atual[1];
			if (img_item.indexOf('thumb_') > -1){
				img_item = 'http://www.musicaemercado.com.br/adm/img_prod/' +atual[4] + '/' + img_item;	
			}else{
				img_item = 'http://imagens.violaopro.com.br/' + img_item;				
			}

			
			bd = bd + '<a href="' + link_item + '" title="' + atual[0] + ', por ' + atual[2] + '"><img src="' + img_item + '"><br>\n';
			bd = bd + '<span class="tit">' + atual[0] + '</span><br>\n';
			if (link_item.indexOf('id=') == -1){
				bd = bd + '<span class="by">' + atual[5] + '</span><br>\n';
				bd = bd + '<p class="cliques">' + atual[3] + ' visualizações</p></a>\n';
			}
			
			
		}else{
			acrescenta = acrescenta + 1;
		}

	}//loop acaba aqui
	
	//acrescenta pq passou do limite
	if (acrescenta > 0){
		for(i = 0;i<acrescenta;i++){
			var atual = obj[i].split('|');

			var img_item = atual[1];
			if (img_item.indexOf('thumb_') > -1){
				img_item = 'http://www.musicaemercado.com.br/adm/img_prod/' +atual[4] + '/' + img_item;	
			}else{
				img_item = 'http://imagens.violaopro.com.br/' + img_item;				
			}

			
			bd = bd + '<a href="video.asp?' + atual[4] + '" title="' + atual[0] + '"><img src="' + img_item + '"><br>\n';
			bd = bd + '<span class="tit">' + atual[0] + '</span><br>\n';
			bd = bd + '<span class="by">por ' + atual[2] + '</span><br>\n';
			bd = bd + '<p class="cliques">' + atual[3] + ' visualizações</p></a>\n';
		}
	}
	
	//nao começa do zero, ele tem q saber os primeiros q foram 'comidos' no final
	if (qtde_proximo > qtde){
		qtde_proximo = 1 + acrescenta;
	}	
	
		bd = bd + '<a href="javascript:gira_vid(\'' + div + '\', ' + obj_str + ',\'' +  obj_str + '\','+qtde_proximo+','+porp+');" id="bt_mais" title="Próximos vídeos"></a>';				
	
	document.getElementById('vitrine' + div).innerHTML = bd;
}
function fc(obj){
	obj.className = 'input_fc';	
}
function bl(obj){
	obj.className = 'input_bl';	
}
function bt_star(tipo,idd){
	
	if (document.getElementById('bt_star_1').style.cursor != 'default'){
	
	var i;
	var classe = 'bt_star_hover';
	for (i=1;i<=5;i++){
		
		if((i-1) == idd){
			classe = 'bt_star';
		}		
		document.getElementById('bt_star_' + i).className = classe;
	}
	
	}
}

function pega_ajax(){
try {
ajax = new XMLHttpRequest();
} catch(ee) {
try {
ajax = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
ajax = new ActiveXObject("Microsoft.XMLHTTP");
} catch(E) {
ajax = false;
}}}
return ajax;
}

function votacao(video, ponto) {
	document.getElementById('vote_lbl').innerHTML = "Aguarde...";
	document.getElementById('estrelas').innerHTML = "";		
					
	var ajax = pega_ajax();	
	if (document.getElementById && ajax) {
	ajax.open("POST", "votar_video.asp", true);
	ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
	ajax.send('video=' + video + '&ponto=' + ponto);
	
		ajax.onreadystatechange = function() {
			if (ajax.readyState == 4) {
				if(ajax.status == 200) {
				var resultado = ajax.responseText;
					resultado = resultado.replace(/\+/g," ");
					resultado = unescape(resultado);
					document.getElementById('vote_lbl').innerHTML = "";
					document.getElementById('estrelas').innerHTML = resultado;					
				} else {
					document.getElementById('vote_lbl').innerHTML = "Ocorreu um erro";
				}
			}
		}
	}
}
function abre_janela_comente_login(){
	document.getElementById('janela_comente_login').style.display='block';	
}
function abre_janela_comente(){
	document.getElementById('email_comentario').style.display='block';	
}
function fechar_email(){
	document.getElementById('email_janela').style.display='none';	
}
function fechar_comentario(){
	document.getElementById('email_comentario').style.display='none';	
}
function fechar_janela_comente_login(){
	document.getElementById('janela_comente_login').style.display='none';	
}

function sbt_coment(){
	if (document.getElementById("comentario").value == ''){
		alert('Por favor, escreva seu comentário');
		document.getElementById("comentario").focus();
	}else{
		document.getElementById("form_comentar").submit();
	}
}
function comentario_reload(){
		window.setTimeout("document.location = 'video.asp' + document.location.search",1000);	
}
function recomendar(){
	
	var ev_nome = document.getElementById("ev_nome").value;
	var ev_email = document.getElementById("ev_email").value;
	var ev_nome2 = document.getElementById("ev_nome2").value;
	var ev_email2 = document.getElementById("ev_email2").value;	
	var ev_msg = document.getElementById("ev_msg").value;
	var ev_url = document.getElementById("ev_url").value;	


		var ajax = pega_ajax();
		if (document.getElementById && ajax) {
		ajax.open("POST", "video_enviar_email.asp", true);
		ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
		ajax.send('nome='+ev_nome+'&email='+ev_email+'&nome2='+ev_nome2+'&email2='+ev_email2+'&url='+ev_url+'&msg='+ev_msg);
		
		ajax.onreadystatechange = function() {
		if (ajax.readyState == 4) {
		if(ajax.status == 200) {
			var resultado = ajax.responseText;
			resultado = resultado.replace(/\+/g," ");
			resultado = unescape(resultado);
			fechar_email();
			alert('Vídeo enviado com sucesso!!');
		} else {
			fechar_email();
			alert('Ocorreu um erro!');
		}}}}
}
//LOGADO TOPO
var temporizador_menu = "";
function montre(id) {
	temporizador_menu = "";
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}
function menuTime(id){
	temporizador_menu = id;
	window.setTimeout("ativaFimdoMenu()",500);
}
function ativaFimdoMenu(){
	if (temporizador_menu != ""){
		var d = document.getElementById(temporizador_menu);
		d.style.display='none';
	}
}
/* botao direito */
function disableselect(e){
return true
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}

function tecla() {
if (window.event.ctrlKey){
	return false;
}

} 
document.onkeydown=tecla;








