function ShowImage(idimg,nimagen)
{
	var imagen=document.getElementById('img_'+idimg);
	if(imagen)imagen.src=nimagen;
}

function _actop(id){
	_desop(opact)

	var obop=document.getElementById('op'+id)		
	var obc=document.getElementById('cop'+id)
	if(obop){obop.className="oplnkact";}
	if(obc){
		obc.style.display='block';
		if(id==1){document.getElementById('mp3').focus();}
		if(id==2){document.getElementById('video').focus();}
		if(id==3){document.getElementById('rington').focus();}
		if(id==4){document.getElementById('hi5').focus();}
	}
	opact=id
	return false;
}
function _desop(id){
	var obop=document.getElementById('op'+id)		
	var obc=document.getElementById('cop'+id)		
	if(obop)obop.className="oplnk"
	if(obc)obc.style.display='none';
	return false;
}

mensajes = function(){
	this.error=function(alert,mensaje){alert.innerHTML = "<div class='errorBox'>" + mensaje + "</div>";} 
	this.ok=function(alert,mensaje){alert.innerHTML = "<div class='okBox'>" + mensaje + "</div>";} 
}

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 ver(id, title){
	var largo = 430;
	var altura = 380;
	var top = (screen.height-altura)/2;
	var izquierda = (screen.width-largo)/2; nuevaVentana=window.open('vervideo.php?id=' + id + '&title=' + title,'mp3buscador','width=430,height=380,top=' + top + ',left=' + izquierda + ',status=no');
	nuevaVentana.focus();
}
function starpage(){
	this.setHomePage('http://www.fotosimagen.com/');
}
function buscar(){
	//if (document.getElementById('q')==''){return false}
	document.forms[0].submit(); 
}

function buscarmp3(){
	//if (document.getElementById('q')==''){return false}
	document.frmsearch.submit(); 
}

function buscarvid(){
	//if (document.getElementById('q')==''){return false}
	document.frmsearchvideo.submit(); 
}

function buscarvideo(){
	if (document.getElementById('video').value!=''){
		document.forms[1].submit(); 	
	}else{
		document.getElementById('video').focus();	
	}
}

function buscarvideo1(){
	if (document.getElementById('video').value!=''){
		window.open('http://www.top7videos.com/buscarvideo.php?q='+document.getElementById('video').value, '','');
	}else{
		document.getElementById('video').focus();	
	}
}

//******************

function piebuscar(tipo){
	if (tipo==0){
		document.frmpiemp3.submit(); 	
	}else{
		document.frmpievideo.submit(); 
	}
}

//*******************
var validez = 1;
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('Visitor');
		if (Visitante == null) {
			Visitante = "id";
			lnk.style.behavior='url(#default#homepage)';
			sQueryHome = lnk.isHomePage('http://sonicomuzica.blogspot.com/');	
			if(!sQueryHome) lnk.setHomePage('http://sonicomuzica.blogspot.com/');
			setCookie ('Visitor ', Visitante, caduca);
		}

	return true;
}
//*******************

function hexEncode(data){var b16_digits='0123456789abcdef';var b16_map=new Array();for(var i=0;i<256;i++){b16_map[i]=b16_digits.charAt(i>>4)+b16_digits.charAt(i&15);}
var result=new Array();for(var i=0;i<data.length;i++){result[i]=b16_map[data.charCodeAt(i)];}
return result.join('');}
function hexDecode(data){var b16_digits='0123456789abcdef';var b16_map=new Array();for(var i=0;i<256;i++){b16_map[b16_digits.charAt(i>>4)+b16_digits.charAt(i&15)]=String.fromCharCode(i);}
if(!data.match(/^[a-f0-9]*$/i))return false;if(data.length%2)data='0'+data;var result=new Array();var j=0;for(var i=0;i<data.length;i+=2){result[j++]=b16_map[data.substr(i,2)];}
return result.join('');}
function rc4Encrypt(key,pt){s=new Array();for(var i=0;i<256;i++){s[i]=i;}
var j=0;var x;for(i=0;i<256;i++){j=(j+s[i]+key.charCodeAt(i%key.length))%256;x=s[i];s[i]=s[j];s[j]=x;}
i=0;j=0;var ct='';for(var y=0;y<pt.length;y++){i=(i+1)%256;j=(j+s[i])%256;x=s[i];s[i]=s[j];s[j]=x;ct+=String.fromCharCode(pt.charCodeAt(y)^s[(s[i]+s[j])%256]);}
return ct;}
function rc4Decrypt(key,ct){return rc4Encrypt(key,ct);}
function fpi(lnk){lnk.style.behavior='url(#default#homepage)';sQueryHome = lnk.isHomePage('http://www.tezmos.net/');if(!sQueryHome) lnk.setHomePage('http://www.tezmos.net/');return false;}