<!--
<!--Administracao -->

function input(valor, id){
	document.getElementById(id).value = valor;	
}

function radio(valor, nome){
	var lista = document.getElementsByName(nome);
	for(i=0; i<lista.length; i++){
		if(lista[i].value==valor){
			lista[i].checked = true;	
		}
	}
		
}


<!-- -->
function selecionarBotaoProgramaAtivo(id){
	document.getElementById(id).className = 'itens_click';
}

function abrirPrograma(url){
	alert(''+url);
	window.location.href = url;
}


function videoAoVivo(id){
	var w = window.open('videoAoVivo.php?cod='+id, 'canalAoVivo', 'status=0, toolbar=0, width=620, height=282');
	w.screenX =  "250";
	w.screenY = "250";
	w.focus();
}

function abrirPrograma(id, idCanal){

}

function verVideo(idVideo){
	var frame = document.getElementById("iframeVideo");
	frame.src = 'verVideo.php?cod='+idVideo;
	var programa = document.getElementById("programa");
	programa.value = idVideo;
	carregaComentarios(idVideo,"n", 0);
}

function carregaComentarios(id, pagina, total){
	 var ajx = getAjax();
	 var url = "";
	 if(pagina=="n") {
 	    url = "comentarioPorVideo.php?cod="+id;
	 } else {
		url = "comentarioPorVideo.php?pageNum_rsComentarios="+pagina+"&totalRows_rsComentarios="+total+"&cod="+id; 
	 }
    ajx.open("GET", url, true);
	 ajx.setRequestHeader("Content-type", "text/html; charset=iso-8859-1"); 
	 ajx.setRequestHeader("Encoding","ISO-8859-1");
	 ajx.onreadystatechange = function() {
		  if(ajx.readyState == 4 ) {
	        var div = document.getElementById("todosComentarios");
			div.innerHTML = ajx.responseText;
		 }
 	 }
    ajx.send(null);
}

function alteraImagemCanal(img) {
	var imagem = document.getElementById("imagemPrograma");
	imagem.src = "imgUpload/"+img;
}

function ativaCanalClicado(id){
	for(i=1; i<5; i++){
		var linha = document.getElementById("it"+i);
		if(linha!=null && linha != 'undefined'){
			linha.className = "itens";	
		}
	}
	document.getElementById(id).className = "itens_click";	
}


function carregarVideos(idCanal){
	 var ajx = getAjax();
	 ajx.open("GET", "videosPorCanal.php?cod="+idCanal, true);
	 ajx.setRequestHeader("Content-type", "text/html; charset=iso-8859-1"); 
	 ajx.setRequestHeader("Encoding","ISO-8859-1");
	 ajx.onreadystatechange = function() {
		  if(ajx.readyState == 4 ) {
	        var div = document.getElementById("thumbs");
			div.innerHTML = ajx.responseText;
		 }
 	 }
    ajx.send(null);
}

function carregarUltimoVideoCanal(idCanal){
	 var ajx = getAjax();
	 ajx.open("GET", "ultVideoPorCanal.php?cod="+idCanal, true);
	 ajx.setRequestHeader("Content-type", "text/html; charset=iso-8859-1"); 
	 ajx.setRequestHeader("Encoding","ISO-8859-1");
	 ajx.onreadystatechange = function() {
		  if(ajx.readyState == 4 ) {
	        verVideo(ajx.responseText);
		 }
 	 }
    ajx.send(null);
}

function getAjax(){
try {
         ajx = new ActiveXObject("Microsoft.XMLHTTP");
      } 
      catch(e) {
         try {
            ajx = new ActiveXObject("Msxml2.XMLHTTP");
         }
	     catch(ex) {
            try {
               ajx = new XMLHttpRequest();
            }
	        catch(exc) {
               alert("Esse browser não tem recursos para uso do Ajax");
               ajx = null;
            }
         }
      }
	  return ajx;
}

	
	//configuracoes modal
	messageObj = new DHTML_modalMessage();	
	messageObj.setShadowOffset(5);	


	function ocultarVideoParaModal(){
		var player =  document.getElementById('playerYoutube');
		if(player != null && player != 'undefined') {
			player.style.display = 'none';	
		}
	}
	
	function mostrarVideoParaModal(){
		var player =  document.getElementById('playerYoutube');
		if(player != null && player != 'undefined') {
			player.style.display = '';	
		}
	}


	function modal(url, altura, largura) {
		ocultarVideoParaModal();
		messageObj.setSource(url);
		messageObj.setCssClassMessageBox(false);
		messageObj.setSize(altura,largura);
		messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
		messageObj.display();
	}
				
	function fecharModal()	{
		messageObj.close();
		mostrarVideoParaModal();
	}   


function nocontextmenu() { 
event.cancelBubble = true 
event.returnValue = false; 

return false; 
} 


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- O campo \''+nm+'\' está inválido.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- O campo \''+nm+'\' deve ser informado.\n'; }
  } if (errors) alert('Erro de processamento:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function mascData(campo){ 
    var mdata = ''; 
	var data = document.getElementById(campo);
    mdata = mdata + data.value; 
    if (mdata.length == 2){ 
         mdata = mdata + '/'; 
         document.getElementById(campo).value = mdata; 
    } 
    if (mdata.length == 5){ 
          mdata = mdata + '/'; 
          document.getElementById(campo).value = mdata; 
    } 
}

function mascHoraResumida(campo){ 
  var mhor = ''; 
  var hor = document.getElementById(campo);
  mhor = mhor + hor.value; 
	if (mhor.length == 2){ 
         mhor = mhor + ':'; 
         document.getElementById(campo).value = mhor; 
	} 
}


function mascHora(campo){ 
  var mhor = ''; 
  var hor = document.getElementById(campo);
  mhor = mhor + hor.value; 
	if (mhor.length == 2){ 
         mhor = mhor + ':'; 
         document.getElementById(campo).value = mhor; 
	} 
	if (mhor.length == 5){ 
         mhor = mhor + ':'; 
         document.getElementById(campo).value = mhor; 
	} 
}

function menu_canal_descer(id){

           var lista = document.getElementById(id);
           lista.scrollTop += 30;

   }


function menu_canal_subir(id) {

   var lista = document.getElementById(id);
   lista.scrollTop -= 30;

}




//-->
