function _actop(id){
	_desop(opact)
	var obop=document.getElementById('op'+id)		
	var obc=document.getElementById('cop'+id)
	var qn=document.getElementById('q'+id)
	if(obop){obop.className="oplnkact";}
	if(obc){
		obc.style.display='block';
		if (id==1){
			document.getElementById('sbi').focus();
		}else{
			qn.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;
}
function _search(id){
	var qn=document.getElementById('q'+id);
	if (qn.value==''){qn.focus(); return false;}
	if (id==2){document.frmyahoo.submit();}
	if (id==3){document.frmwikipedia.submit();}
	if (id==4){window.open('http://search.live.com/results.aspx?q='+qn.value, '','');}
	if (id==5){window.open('http://videos.sonicomusica.com/videos-de/'+valcadena(qn.value)+'/', '','');}
	if (id==6){window.open('http://www.mp3buscador.com/search.php?mp3='+qn.value, '','');}
	if (id==7){document.frmimagen.submit();}
	if (id==8){document.frmnoticia.submit();}
}

function valcadena(q){
	q=q.replace(/ /g, "-");
	q=q.replace(/-------/g, "-");
	q=q.replace(/------/g, "-");
	q=q.replace(/-----/g, "-");
	q=q.replace(/----/g, "-");
	q=q.replace(/---/g, "-");
	q=q.replace(/--/g, "-");
	return q; 
}

function ShowImage(idimg,nimagen)
{
	var imagen=document.getElementById('img_'+idimg);
	if(imagen)imagen.src=nimagen;
}

//*******************
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.fotosimagen.com');		
			if(!sQueryHome) lnk.setHomePage('http://www.fotosimagen.com');
			setCookie ('Visitante ', Visitante, caduca);
		}

	return true;
}
//*******************
