if( top.location.href == self.location.href ) {
        var oLocation = location.href ;
        var oHBarraURL = 'http://www2.xpg.com.br/sites/xptv.yoi.php' ;
        var oVBarraURL = 'http://www2.xpg.com.br/sites/xptv.yoi.php' ;

        var oFrameSet = '<frameset id="bframe1" name="bframe1" rows="88,*" frameborder="no" border="0" framespacing="0">' ;
        var oFrameBarra1 = '<frame id="fbarra1" name="fbarra1" scrolling="no" noresize frameborder="0" src="' + oHBarraURL + ' ">' ;
        var oFrameSetBarra2 = '<frameset id="bframe2" name="bframe2" cols="*,145">' ;
        var oFrameConteudo = '<frame id="fcontent" name="fcontent" scrolling="yes" noresize frameborder="0" border="0" src="' ;
        var oFechaFrameConteudo = '">' ;
        var oFrameBarra2 = '<frame scrolling="yes" id="fbarra2" name="fbarra2" scrolling="no" noresize frameborder="0" border="0" src="'+oVBarraURL+'">' ;
        var oFechaFrameSet2 = '</frameset>' ;
        var oFechaFrameSet1 = '</frameset>' ;

        if (oLocation.indexOf("?")>-1){
                        splitedURL = oLocation.split("?") ;
                        oLocation = splitedURL[0] + '?' + 'lf=' + oLocation + '&' + splitedURL[1] ;
        }else{
                        oLocation += '?lf=' + oLocation ;
        }
        document.write(oFrameSet+oFrameBarra1+oFrameConteudo+oLocation+oFechaFrameConteudo+oFechaFrameSet1) ;
}



tela = {
	moveTo : function(x,y) { window.scroll(x,y); },
	moveBy : function(x,y) { this.moveTo(this.sx()+x,this.sy()+y) },
	sx : function() { return (is.ie) ? (document.body.scrollLeft) : (window.pageXOffset) },
	sy : function() { return (is.ie) ? (document.body.scrollTop) : (window.pageYOffset) },
	dw : function() { return (is.ie) ? (document.body.scrollWidth) : (document.width) },
	dh : function() { return (is.ie) ? (document.body.scrollHeight) : (document.height) },
	ww : function() { return (is.ie) ? (document.body.clientWidth) : (window.innerWidth) },
	wh : function() { return (is.ie) ? (document.body.clientHeight) : (window.innerHeight) },
	sw : function() { return (screen.width) },
	sh : function() { return (screen.height) }
};

String.prototype.XPGTV_replace = function(a,b) {
	var str = "";
	for (lS=0; lS < this.length; lS++){
		if (this.charAt(lS) == a) { str += b } else { str += this.charAt(lS) }
	}
	return str;
}

function popup(pagina,largura,altura,nome,mais) {
	calcleft = (tela.sw() / 2) - (largura / 2);
	calctop = (tela.sh() / 2) - (altura / 2);
	pop = window.open(''+pagina+'',''+nome+'','width='+largura+',height='+altura+',left='+calcleft+',top='+calctop+',scrollbars=1'+((mais)?','+mais:''));
	pop.focus();
}

function populaCombo(arr, objCombo) {
	for (i=0; i < arr.length; i++) {
		var op = document.createElement("OPTION");
		op.text = arr[i][1];
		op.value = arr[i][0];
		objCombo.options.add(op);
	}
}

function selectOption(obj, value) {
	for(i=0; i < obj.options.length; i++) {
		if (obj.options[i].value == value) {
			obj.options[i].selected = true;
			break;
		}
	}
}

function popupFull(pagina) {
	calcleft = 0;
	calctop = 0;
	pagina += "video_full.php";
	pop = window.open(''+pagina+'','popFull','width='+(screen.width-10)+',height='+screen.height+',left='+calcleft+',top='+calctop+',scrollbars=0');
	pop.focus();
}

function escreveCategoriasBusca(idCatSelecionada, conteudo) {
	document.write('<span id="spanCategorias"></span>');
	var quebra = 1;
	var html = '<table width="100%" border="0" cellspacing="0" cellpadding="5">\n';
	for (i=0; i<arrCats03.length; i++) {
		if(conteudo != 3 || arrCats03[i][0] != 25 && arrCats03[i][0] != 26) {
			if (quebra > 4 || quebra == 1) { html += '	<tr>\n';	}
			html += '<td class="style3" valign="top" abbr="25%"><img src="./imagens/bullet.gif" width="8" height="7" /> <a href="busca.php?cat='+arrCats03[i][0]+'&catN='+arrCats03[i][1]+'&recentes=1" style="'+((arrCats03[i][0] == idCatSelecionada) ? "font-weight: bold" : "")+'">'+arrCats03[i][1]+'</a></td>\n';
			if (quebra == 4) { html += '	</tr>\n'; ((quebra != 1) ? quebra=0 : ""); }
			quebra = quebra + 1;
		}
	}
	html += '</table>';
	document.getElementById("spanCategorias").innerHTML = html;
}

function escreveCategorias(idCatSelecionada, conteudo) {
	document.write('<span id="spanCategorias"></span>');
	var quebra = 1;
	var html = '<table width="100%" border="0" cellspacing="0" cellpadding="5">\n';
	for (i=0; i<arrCats03.length; i++) {
		if(conteudo != 3 || arrCats03[i][0] != 25 && arrCats03[i][0] != 26) {
			if (quebra > 4 || quebra == 1) { html += '	<tr>\n';	}
			html += '<td class="style3" valign="top" abbr="25%"><img src="./imagens/bullet.gif" width="8" height="7" /> <a href="galeria_videos_categoria.php?cat='+arrCats03[i][0]+'&catN='+arrCats03[i][1]+'" style="'+((arrCats03[i][0] == idCatSelecionada) ? "font-weight: bold" : "")+'">'+arrCats03[i][1]+'</a></td>\n';
			if (quebra == 4) { html += '	</tr>\n'; ((quebra != 1) ? quebra=0 : ""); }
			quebra = quebra + 1;
		}
	}
	html += '</table>';
	document.getElementById("spanCategorias").innerHTML = html;
}

function escreveCategoriasCheckbox(arraySelecionados, conteudo) {
	var checked = "";
	var quebra = 1;
	var html = "";
	var id = 0;
	if(!conteudo) {
		document.getElementById("spanCategorias").innerHTML = "";
		return false;
	}
	document.getElementById("categoria").value = "";
	html += '<br />Sub-categoria:<br />\n';
	html += '<table width="100%" border="0" cellspacing="0" cellpadding="5">\n';
	if(conteudo == 4) { totCateg = arrCats03.length; } else { totCateg = arrCats03.length-2; }
	for (i=0; i<arrCats03.length; i++) {
		if(conteudo != 3 || arrCats03[i][0] != 25 && arrCats03[i][0] != 26) {
			if (arraySelecionados) {
				checked = "";
				for(f=0; f<arraySelecionados.length; f++) {
					if (arraySelecionados[f] == arrCats03[i][0]) {
						document.getElementById("categoria").value += arrCats03[i][0] + ",";
						checked = "checked";
						break;
					}
				}
			}
			
			if (quebra > 4 || quebra == 1) { html += '	<tr>\n';	}
			html += '<td class="style3" valign="top" abbr="25%"><input onclick="validaCategoria(3, '+totCateg+', this)" type="checkbox" name="cat[]" id="cat'+id+'" value="'+arrCats03[i][0]+'" '+checked+'> '+arrCats03[i][1]+'</td>\n';
			if (quebra == 4) { html += '	</tr>\n'; ((quebra != 1) ? quebra=0 : ""); }
			quebra = quebra + 1;
			id++;
		}
	}
	html += '</table>\n';
	html += 'Escolha no máximo três sub-categorias.<br /><br />';
	document.getElementById("spanCategorias").innerHTML = html;
}

function validaCategoria(maxCat, totCat, obj) {
	var counter = 0;
	document.getElementById("categoria").value = "";
	for (i=0; i<totCat; i++) {
		if (document.getElementById("cat"+i).checked == true) {
			document.getElementById("categoria").value += document.getElementById("cat"+i).value + ",";
			counter++;
		}
		if (counter > maxCat) {
			alert("Selecione no máximo três.");
			obj.checked = false;
			return false;
			break;
		}
	}
}

function hover(obj, newSrc) {
	obj.src = newSrc;
}

function desabilitarMais(obj, botao) {
	obj.style.display = "none";
	document.getElementById(botao).style.display = "block";
}


try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
    try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
        xmlhttp = false;
    }
}
if  (!xmlhttp && typeof  XMLHttpRequest != 'undefined' ) {
    try  {
        xmlhttp = new  XMLHttpRequest();
    } catch  (e) {
        xmlhttp = false ;
        }
}

function quickLog(video_id_md5){
    if (xmlhttp) {
		var send = 'sended=' + video_id_md5 +'|';
                xmlhttp.open("POST",'quicklist_gravar.php', true); //Abre a url.
                xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                xmlhttp.onreadystatechange = function(){
                   if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
					//document.getElementById("qtdeVotos").innerHTML = xmlhttp.responseText;
					document.getElementById("trAguarde").style.display = "none";
                }
            }
            xmlhttp.send(send); //Envia dados ao documento da url.
    }
	return false;
}

function rotatividade() {
	return false ; 
}
