var ResizeIframe = {    
  wrapperId : "tinc_content",
                
  resize : function ( oDoc, sId ) 
  {
    // retrieve iframe's content size and resize vertically
    var iframeDoc = oDoc.getElementById( sId ).contentWindow.document;
    if ( iframeDoc == null ) return;
    if ( window.addEventListener )
    {
      var pv = iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue;
      var height = iframeDoc.body.clientHeight
                    + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "margin-top" ) )
                    + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "margin-bottom" ) )
                    + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "padding-top" ) )
                    + parseInt( iframeDoc.defaultView.getComputedStyle( iframeDoc.body, "" ).getPropertyValue( "padding-bottom" ) );
    } else if ( window.attachEvent ) {
      var wrapper = iframeDoc.getElementById( this.wrapperId );
      if ( wrapper == null ) return;
      wrapper.style.height = "0px"; 
      var height = wrapper.offsetHeight 
                  + wrapper.offsetTop 
                  + parseInt( iframeDoc.body.currentStyle.marginTop ) 
                  + parseInt( iframeDoc.body.currentStyle.marginBottom )
                  + parseInt( iframeDoc.body.currentStyle.paddingTop ) 
                  + parseInt( iframeDoc.body.currentStyle.paddingBottom );
    }
    oDoc.getElementById( sId ).setAttribute("height", height);    
    // in case the height is also set as a style property
    oDoc.getElementById( sId ).style.height = height + "px";   
    // seems to fix a Gecko bug, sometimes the iframe was cut at the bottom when resizing smaller
    oDoc.getElementById( sId ).style.display = "block";
    
    // let non-tinc links load in the parent document. this might need some adjustment
    var links = iframeDoc.getElementsByTagName( "a" );
    for ( var i = 0; i < links.length; i++ )
    {
      if ( links[i].href.indexOf( "/tinc" ) == -1 ) links[i].target = "_parent";
    }
  }
};

/* functions to display images slide show */
var rotate_delay = 2000; // delay in milliseconds (7000 = 7 secs)
current = 0;
function next() {
if (document.gest.slide[current+1]) {
document.images.show.src = document.gest.slide[current+1].value;
document.gest.slide.selectedIndex = ++current;
   }
else first();
}
function previous() {
if (current-1 >= 0) {
document.images.show.src = document.gest.slide[current-1].value;
document.gest.slide.selectedIndex = --current;
   }
else last();
}
function first() {
current = 0;
document.images.show.src = document.gest.slide[0].value;
document.gest.slide.selectedIndex = 0;
}
function last() {
current = document.gest.slide.length-1;
document.images.show.src = document.gest.slide[current].value;
document.gest.slide.selectedIndex = current;
}
function ap(text) {
document.gest.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
rotate();
}
function change() {
current = document.gest.slide.selectedIndex;
document.images.show.src = document.gest.slide[current].value;
}
function rotate() {
if (document.gest.slidebutton.value == "Stop") {
current = (current == document.gest.slide.length-1) ? 0 : current+1;
document.images.show.src = document.gest.slide[current].value;
document.gest.slide.selectedIndex = current;
window.setTimeout("rotate()", rotate_delay);
   }
}