
function verLarva(url) 
     {win=window.open(url,"ampliar_foto",'width=700,height=580,location=no,toolbar=no, directories=no,menubar=no,resizable=yes,scrollbars=no,status=no');
      win.focus()};

function verForm(url) 
     {win=window.open(url,"comments",'width=500,height=480,location=no,toolbar=no, directories=no,menubar=no,resizable=no,scrollbars=no,status=no');
      win.focus()};

function despliega(nodo,url,tipo){
      switch(tipo){
         case 1:
                  html='<div id=' + nodo + ' > loading...';
                  break;
         case 2:
                  html='<div id=' + nodo + ' > <DT> <h3><img style="padding-right: 5px;" src="circleopam.gif" >loading...';
                  break;
         case 3:
                  html='<div id=' + nodo + ' > <DD> <li style=\"line-height: .2em;\" ><em><div class=\"small\">loading...';
                  break;
      }
      Element.replace(nodo,html);
      new Ajax.Updater(nodo,url,{asynchronous:true, method:'get', encoding: 'iso-8859-15'});
      return false;
}

function imprSelec(nombre)
      {
      var ficha = document.getElementById(nombre);
      var ventimp = window.open(' ', 'popimpr');
      ventimp.document.write( ficha.innerHTML );
      ventimp.document.close();
      ventimp.print( );
      ventimp.close();
}

// set cookie to accept Data Policy
//

function acceptDataPolicy(val){
 if(val==1){
  var date = new Date();
  date.setTime(date.getTime()+(30*24*60*60*1000)); //expires in 1 month
  setCookie('dp_accept',val,date);
  if (getCookie('dp_accept')==null) { 
    //try to store session cookie
    setCookie('dp_accept',val,null);
    if (getCookie('dp_accept')==null) {
     alert('You need to have cookies enabled to visit this website');
    }
   }
  document.location.href="http://opam.org.es/web/taxon/larvaSearch_form"; //refresh
 }else{
  document.location.href="http://opam.org.es/";
 }
}

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

// this function gets the cookie, if it exists
//
function getCookie(name) {
	
 var start = document.cookie.indexOf( name + "=" );
 var len = start + name.length + 1;
 if ( ( !start ) &&
 ( name != document.cookie.substring( 0, name.length ) ) )
 {
 return null;
 }
 if ( start == -1 ) return null;
 var end = document.cookie.indexOf(";",len);
 if ( end == -1 ) end = document.cookie.length;
 return unescape( document.cookie.substring(len,end));
}



