//Rutinas generales para la manipulacion de la nueva ficha
function expand_colaps(tabla)
{
  if(document.getElementById(tabla).style.display == "none")
    { document.getElementById(tabla).style.display="block"; }
  else
    { document.getElementById(tabla).style.display="none"; }
}

function insertaComentario(selloProcedencia)
{
  if(document.getElementById('comentarios').value.length > 1000)
  {
    alert("El campo COMENTARIOS puede contener 1000 caracteres como máximo");
    return false;
  }
  document.getElementById('id_sello_web').value=selloProcedencia;
  document.getElementById('formulario').submit();
}

function iluminaEstrella(estrella)
{
  for(contador=estrella+1;contador<=5;contador++)
    document.getElementById('estrella'+contador).src="/imggeneral/fichaObra/generales/estrella_vacia.gif";
  for(contador=1;contador<=estrella;contador++)
    document.getElementById('estrella'+contador).src="/imggeneral/fichaObra/generales/estrella_completa.gif";
}

function insertaEstrellas(estrellas,selloProcedencia)
{
  document.getElementById('estrellas').value=estrellas;
  document.getElementById('id_sello_web').value=selloProcedencia;
  document.getElementById('formulario').submit();
}

function fbookmark(ptipo)
{
  v_location=location.href;
  v_title=document.title; 
  v_url="";

  switch (ptipo)
  {
    case "delicious":
      v_url='http://del.icio.us/post?url=' + encodeURIComponent(v_location) +'&title=' + encodeURIComponent(v_title );
      break;
    case "digg":
      v_url='http://www.digg.com/submit?url='+ v_location + '&title=' + v_title;
      break;
    case "facebook":
      v_url='http://www.facebook.com/sharer.php?u=' + encodeURIComponent(v_location) +'&t=' + encodeURIComponent(v_title);
      break;
    case "meneame":
      v_url='http://meneame.net/submit.php?url=' + encodeURIComponent(v_location);
      break;
    case "mister":
      v_url='http://www.mister-wong.es/index.php?action=addurl&bm_url=' + encodeURIComponent(v_location) + '&bm_description=' + encodeURIComponent(v_title);
      break;
    case "myspace":
      v_url='http://www.myspace.com/Modules/PostTo/Pages/?u=' + encodeURIComponent(v_location) + '&t=' + encodeURIComponent(v_title);
      break;
    case "yahoo":
      v_url='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u='+encodeURIComponent(v_location)+'&t='+encodeURIComponent(v_title);
      break;
    case "chuza":
      v_url='http://chuza.org';
      break;
    default:   
      break;
  }
  abre_ventana(v_url,'bookmark','toolbar=0,status=0,resizable=1,scrollbars=1,width=900,height=700');
  return false;
}

function showInfo(event,id)
{
  var objDiv = document.getElementById(id);
  objDiv.style.top =  event.clientY+document.body.scrollTop+10;
  objDiv.style.left =  event.clientX+document.body.scrollLeft+10;
  objDiv.style.visibility="visible";
}

function hideInfo(id)
{
  var objDiv = document.getElementById(id);
  objDiv.style.visibility="hidden";
}

function expand_colapsLibAutor(id_autor)
{
  document.getElementById('info').style.display = "none";
  if(document.getElementById('libros_Autor'+id_autor).style.display == "none")
  {
    document.getElementById('libros_Autor'+id_autor).style.display="block";
    document.getElementById('masMenos'+id_autor).src="/imggeneral/fichaObra/generales/minus.gif";
  }
  else
  {
    document.getElementById('libros_Autor'+id_autor).style.display="none";
    document.getElementById('masMenos'+id_autor).src="/imggeneral/fichaObra/generales/plus.gif";
  }
}


//***************************************************************************************
//*
//* @funcion para abrir en pantalla nueva los vídeos promocionales
//
//***************************************************************************************
winVideo = null;
window.onunload = unloadVideoWin;

/*
function openVideo(params)
{
  
  winVideo = window.open('http://fstreaming.anaya.es/anaya/embeded.html?' + params + '','fstreaming','width=700,height=600,scrollbars=no,titlebar=no,location=no');
  return false;
  
}
*/

function openVideo(params)
{
  
	obj = document.getElementById('IDvideolink');
	obj.href = "http://fstreaming.anaya.es/anaya/embeded_ficha.html?" + params + "&TB_iframe=true&height=480&width=530&background=#298ded";
	return true;
  
}




function unloadVideoWin()
{
  if (winVideo!=null)
    winVideo.close();
}
