leftdisabled = true
rightdisabled = true
widthLength = 220

function timedtitle()
{
var t=setTimeout("drop('titol')",8000);
var f1=setTimeout("drop('foto_0')",16000);
var f1=setTimeout("drop('foto_1')",16000);
var f1=setTimeout("drop('foto_1')",20000);
var f1=setTimeout("drop('foto_2')",20000);
var f1=setTimeout("drop('foto_2')",24000);
var f1=setTimeout("drop('foto_3')",24000);
var f1=setTimeout("drop('foto_3')",28000);
var f1=setTimeout("drop('foto_4')",28000);
var f1=setTimeout("drop('foto_4')",32000);
var f1=setTimeout("drop('foto_5')",32000);
var f1=setTimeout("drop('foto_5')",36000);
var f1=setTimeout("drop('foto_6')",36000);
var f1=setTimeout("drop('foto_6')",40000);
var f1=setTimeout("drop('foto_7')",40000);
var f1=setTimeout("drop('foto_7')",44000);
var f1=setTimeout("drop('foto_8')",44000);
var f1=setTimeout("drop('foto_8')",48000);
var f1=setTimeout("drop('foto_9')",48000);
var f1=setTimeout("drop('foto_9')",52000);
var f1=setTimeout("drop('foto_10')",52000);
var f1=setTimeout("drop('foto_10')",56000);
var f1=setTimeout("drop('foto_11')",56000);
var f1=setTimeout("drop('foto_11')",60000);
var f1=setTimeout("drop('foto_12')",60000);
var f1=setTimeout("drop('foto_12')",64000);
var f1=setTimeout("drop('foto_13')",64000);
var f1=setTimeout("drop('foto_13')",68000);
var f1=setTimeout("drop('foto_14')",68000);
var f1=setTimeout("drop('foto_14')",72000);
var f1=setTimeout("drop('foto_15')",72000);
var f1=setTimeout("drop('foto_15')",76000);
var f1=setTimeout("drop('foto_16')",76000);
}
function timedflash()
{
var t=setTimeout("drop('flash')",80000);
}

function drop( targetId ){ 
       target = document.getElementById( targetId );
       if (target.style.display == "none") {
           target.style.display = ""; 
       } else {
           target.style.display = "none";
       }
}
function dropt( targetId ){ 
       target = document.getElementById( targetId );
       if (target.style.display == "none") {
           target.style.display = "table"; 
       } else {
           target.style.display = "none";
       }
}
function dropb( targetId ){ 
       target = document.getElementById( targetId );
       if (target.style.display == "none") {
           target.style.display = "block"; 
       } else {
           target.style.display = "none";
       }
}

function fp_ShowImg(src, sWidth, sHeight, sID, iIndex)
{   
    var nomfoto = src.lowsrc;
    var i = nomfoto.search("th_");
    var el = document.images["fpGalleryMainImg_" + sID];
    if (el) {
        if(fp_ie4()) {
            el.style.visiblity = "hidden";
            el.src = src.lowsrc;
            el.width = sWidth;
            el.height = sHeight;
                
            var caption = document.all["fpGalleryCaptions_" + sID].all.tags("div")
            var sCaptionTxt;
            var sCaptionHTML;
            
            //if (caption && caption[iIndex]) {
            //  sCaptionTxt = caption[iIndex].innerText
            //  sCaptionHTML = caption[iIndex].innerHTML
            //} else {
            //  sCaptionTxt = "";
            //  sCaptionHTML = "";
            //}
            sCaptionTxt= nomfoto.substr(i,25);
            sCaptionHTML= nomfoto.substr(i,25);
            el.title = sCaptionTxt;
            el.style.visiblity = "visible";
            
            var el = document.all["fpGalleryCaptionCell_" + sID];
            if (el) {
                el.innerHTML = sCaptionHTML;
            }
            
            var el = document.all["fpGalleryDescCell_" + sID];
            if (el) {
                var sDesc = document.all["fpGalleryDescriptions_" + sID].all.tags("div")
                el.innerHTML = sDesc && sDesc[iIndex]?sDesc[iIndex].innerHTML:"";
            }
        } else {
            el.src = src.lowsrc
            el.style.width = sWidth
            el.style.height = sHeight

            caption = document.getElementById("fpGalleryCaptions_" + sID).getElementsByTagName("div")           
            if (caption && caption[iIndex]) {
                sCaptionTxt = caption[iIndex].innerText
                sCaptionHTML = caption[iIndex].innerHTML
            } else {
                sCaptionTxt = ""
                sCaptionHTML = ""
            }
        
            el.title = sCaptionTxt          
            var e = document.getElementById("fpGalleryCaptionCell_" + sID)
            if (e) {
                e.innerHTML = sCaptionHTML
            }
            
            var e = document.getElementById("fpGalleryDescCell_" + sID)
            if (e) {
                var sDesc = document.getElementById("fpGalleryDescriptions_" + sID).getElementsByTagName("div")
                e.innerHTML = sDesc[iIndex]?sDesc[iIndex].innerHTML:""
            }

        }
    }
}

function fp_ScrollLeft(sID) {
    var el = document.all["fpGalleryListCell_" + sID];
    if (el && fp_ie4()) {
        var coll = el.children.tags("A");
        var count = 20;

        if (coll) {
            for (i=1;i<coll.length;i++) {
                if (coll(i).style.display != "none") {
                    coll(i-1).style.display = "inline";
                    break;  
                }
            }
            
            for (i=0;i<coll.length;i++) {
                if (coll(i).style.display != "none") {
                    var images = coll[i].children.tags("img");
                    count = count + 20 + images[0].width;
                    
                    if (count > widthLength)                
                        coll(i).style.display = "none";
                }
            }

            if ((el.scrollWidth - 5) >= el.clientWidth) {
                var btn = document.all["fpGalleryRightBtn_" + sID]
                if (btn && rightdisabled) {
                    rightdisabled = false;
                    te = btn.src
                    btn.src = btn.lowsrc
                    btn.lowsrc = te
                }
            }
            
            if (coll(0).style.display != "none") {
                var btn = document.all["fpGalleryLeftBtn_" + sID]
                if (btn && !leftdisabled) {
                    leftdisabled = true;
                    te = btn.src
                    btn.src = btn.lowsrc
                    btn.lowsrc = te
                }
            }
        }
        
    }
}

function fp_ScrollRight(sID) {
    var el = document.all["fpGalleryListCell_" + sID];
    if (el && fp_ie4()) {
        if (!rightdisabled)
        {
            var coll = el.children.tags("A");
            if (coll) {
                var state = 0;
                var count = 20;
                for (i=0;i<coll.length;i++) {
                    if (state == 0)
                    {
                        if (coll(i).style.display != "none") {
                            coll(i).style.display = "none"; 
                            state = 1;
                        }
                    }
                    else{
                        var images = coll[i].children.tags("img");
                        count = count + 20 + images[0].width;
                        if (count < widthLength)
                            coll(i).style.display = "inline";
                        else
                            coll(i).style.display = "none";
                    }
                }
            }
        
            var btn = document.all["fpGalleryRightBtn_" + sID];
            if (btn && coll(coll.length - 1).style.display != "none") {
                rightdisabled = true
                te = btn.src
                btn.src = btn.lowsrc
                btn.lowsrc = te
            }
            
            var btn = document.all["fpGalleryLeftBtn_" + sID];
            if (btn && leftdisabled) {
                te = btn.src
                btn.src = btn.lowsrc
                btn.lowsrc = te
                leftdisabled = false
            }
        }       
    }
}
 
function obre( targetid ) {
         target = document.getElementById( targetid );
         target.style.background ='#B9B832';
         target.style.background ='#869A00';
         var t_mes =  targetid + '_menu' ;
         dropb( t_mes );
         var t_mes =  targetid + '_mes' ;
         dropb( t_mes  );
         var t_mes = targetid + '_menys';
         dropb( t_mes );
}
function obrep( targetid ) {
         target = document.getElementById( targetid );
         target.style.color ='#BE6521';
         var t_mes =  targetid + '_menu' ;
         dropb( t_mes );
         var t_mes =  targetid + '_mes' ;
         dropb( t_mes  );
         var t_mes = targetid + '_menys';
         dropb( t_mes );
}
function marca( targetid ){
         target = document.getElementById( targetid );
         target.style.color ='#4B5B4F';
}
function marcag( targetid ){
         target = document.getElementById( targetid );
         target.className ='sep_menu cf_verdtuareg';

}
function marcap( targetid ){
         target = document.getElementById( targetid );         
         target.className = 'vermellteula';
}
function busca( targetid ){
         target = document.getElementById( targetid );
        // target.style.background ='url(/2011/fotos/checkbox_true.gif) no-repeat 10px  2px';
         var l = target.href.length;
         target.href = target.href.substring(0,l-9) + '&e=a#buscador';
     //    target.href = "http://www.tuareg.com/2011/encuentra_tu_viaje.php";
         target.className = 'active';
       //  alert( target.href);
}
function obrebusca( targetid ) {
         target = document.getElementById( targetid );
         target.style.color ='#BE6521';
         var t_mes =  targetid + '_menu' ;
         alert( t_mes );
      //   drop( t_mes );


}
// this fixes an issue with the old method, ambiguous values
// with this test document.cookie.indexOf( name + "=" );
function get_cookie( check_name ) {
  // first we'll split this cookie up into name/value pairs
  // note: document.cookie only returns name=value, not the other components
  var a_all_cookies = document.cookie.split( ';' );
  var a_temp_cookie = '';
  var cookie_name = '';
  var cookie_value = '';
  var b_cookie_found = false; // set boolean t/f default f

  for ( i = 0; i < a_all_cookies.length; i++ )
  {
    // now we'll split apart each name=value pair
    a_temp_cookie = a_all_cookies[i].split( '=' );


    // and trim left/right whitespace while we're at it
    cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

    // if the extracted name matches passed check_name
    if ( cookie_name == check_name )
    {
      b_cookie_found = true;
      // we need to handle case where cookie has no value but exists (no = sign, that is):
      if ( a_temp_cookie.length > 1 )
      {
        cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
      }
      // note that in cases where cookie is initialized but no value, null is returned
      return cookie_value;
      break;
    }
    a_temp_cookie = null;
    cookie_name = '';
  }
  if ( !b_cookie_found )
  {
    return null;
  }
}


