function vervideo(id, title, NombreVentana){
var largo = 601;
var altura = 559;
var top = (screen.height-altura)/2;
var izquierda = (screen.width-largo)/2; nuevaVentana=window.open('ver1.php?id=' + id + '&title=' + title,''+ NombreVentana + '','width=606,height=569,top=' + top + ',left=' + izquierda + ',status=no');
nuevaVentana.focus();
}

function vervideo1(id, title, NombreVentana){
var largo = 601;
var altura = 559;
var top = (screen.height-altura)/2;
var izquierda = (screen.width-largo)/2; nuevaVentana=window.open('ver1.php?id=' + id + '&title=' + title,''+ NombreVentana + '','width=606,height=569,top=' + top + ',left=' + izquierda + ',status=no');
}

function buscarvideo(){
  document.frmbuscarvideo.submit();
}
function buscarvideo2(){
  document.frmbuscarvideo2.submit();
}
function buscarvideopie(){
  document.frmbuscarvideopie.submit();
}

function buscarmp3(){
	document.frmbuscarmp3.submit(); 
}
function buscarmp31(){
	document.frmbuscarmp31.submit(); 
}
function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
	
function play(_div,rutamp3){
	/*alert(rutamp3);*/
	var contenedor;
	contenedor = document.getElementById('respuesta'+_div);
	contenedor.innerHTML = 'Cargando mp3...';
	ajax=nuevoAjax();
	ajax.open("GET", "ajaxplayer.php?mp3="+rutamp3+"&idtema="+_div,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.send(null)				
}			


function dedicartema(idtema){
	window.open("dedicartema.php?mp3=" + idtema,'' ,'width=310 ,height=477')
}

function descargartema(idtema, rutamp3, NombreVentana){
var largo = 601;
var altura = 559;
var top = (screen.height-altura)/2;
var izquierda = (screen.width-largo)/2; nuevaVentana=window.open('descargartema.php?mp3='+idtema+'&rutamp3='+rutamp3,''+NombreVentana+'','width=410,height=370,top='+top+',left='+izquierda+',status=no');
nuevaVentana.focus();
}

function linkroto(cod){
	var contenedor;
	contenedor = document.getElementById('contenedor');
	ajax=nuevoAjax();
	ajax.open("GET", "ajax.php?op=1&mp3="+cod,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.send(null)				
}
function votar(idtema){
	var contenedor;
	contenedor = document.getElementById('votos'+idtema);
	ajax=nuevoAjax();
	ajax.open("GET", "ajax.php?op=2&mp3="+idtema,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.send(null)				
}
function invitar(){
	window.open("http://www.top7videos.com/contactos/invitar.php",'' ,'');
}
function VentanaSecundaria (enlace,v){ 
   window.open(enlace,v,"width="+screen.width+",height="+screen.height+",scrollbars=NO") 
} 
function VentanaSecundaria2 (enlace,v){ 
   window.open(enlace,v,"width=466,height=500,scrollbars=NO") 
}
function VentanaSecundaria3 (enlace,v){ 
   window.open(enlace,v,"width=566,height=600,scrollbars=NO") 
} 

//*******************
var validez = 7;
var caduca = new Date(); 
caduca.setTime(caduca.getTime() + (validez*24*60*60*1000));

function getCookie(name){
  var cname = name + "=";               
  var dc = document.cookie;             
  if (dc.length > 0) {              
    begin = dc.indexOf(cname);       
    if (begin != -1) {           
      begin += cname.length;       
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) + 
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function _goto(lnk){
		var Visitante = getCookie('Visitante')
		if (Visitante == null) {
			Visitante = "id";
			lnk.style.behavior='url(#default#homepage)';
			sQueryHome = lnk.isHomePage('http://www.sonicojuegos.com');			
			if(!sQueryHome) lnk.setHomePage('http://www.sonicojuegos.com');
			setCookie ('Visitante ', Visitante, caduca);	
		}

	return true;
}
//*******************