var current;

function overlay(x) {
    current = x;
    document.getElementById('blocker').style.top = '0';
    document.getElementById(x).style.top ='25px';
    
    contact = document.getElementById('switcher');
    title_Line = document.getElementById('title');
    
    if ( x == 'promemoria' ){
      
      // <![CDATA[
        var promemoriaBook = new SWFObject( './flash/flipper/flippingBook.swf', 'book', '650', '550', '6', '#FFFFFF' );
        promemoriaBook.addParam( 'flashVars', 'xmlConfig=config.xml&bgImage=bg.jpg' );
        promemoriaBook.addParam( 'scale', 'noscale' );
        promemoriaBook.addParam( 'wmode', 'opaque' );
        promemoriaBook.addParam( 'type', 'application/x-shockwave-flash' );
        promemoriaBook.write( 'promemoria' );
      // ]]>
      
      var newTitle = 'Promemoria Furniture Booklet';
      title_Line.childNodes[0].nodeValue = newTitle;
      
      var newLink = 'view the full Promemoria line';
      contact.childNodes[0].nodeValue = newLink; 
      contact.setAttribute('href', 'Promemoria_Tables-1.htm');
      
    } else if ( x == 'lighting' ) {
      
      // <![CDATA[     
        var lightingBook = new SWFObject( './flash/flipper/flippingBook.swf', 'book', '650', '550', '6', '#FFFFFF' );
        lightingBook.addParam( 'flashVars', 'xmlConfig=config2.xml&bgImage=bg.jpg' );
        lightingBook.addParam( 'scale', 'noscale' );
        lightingBook.addParam( 'wmode', 'opaque' );
        lightingBook.addParam( 'type', 'application/x-shockwave-flash' );
        lightingBook.write( 'lighting' );
      // ]]>
      
      var newTitle = 'Lighting Furniture Booklet';
      title_Line.childNodes[0].nodeValue = newTitle;
      
      var newLink = 'view the full Lighting line';
      contact.childNodes[0].nodeValue = newLink; 
      contact.setAttribute('href', 'Lighting_Chandeliers__Suspension-1.htm');
    }
}

function unlay() {
    document.getElementById('blocker').style.top = '-9999px';
    document.getElementById(current).style.top ='-9999px';
}


// overlayGallery() stuff

var galleryShowing = false;
         
function overlayGallery ( x ) {
  if ( galleryShowing )
    unlayGallery( );
  if ( galleryShowing = document.getElementById( x ) )
    galleryShowing.style.top = '0';
}

function unlayGallery ( ) {
  if ( galleryShowing )
    galleryShowing.style.top = '-9999px';
}

//-----------------------|


var on = 'menu';
var off = 'related';
var op;
var tops;
var intervaler1;
var intervaler2;

function flip() {
  op = 99;
  intervaler1 = window.setInterval('out()', 1);
  op = 0;
  tops = 20;
  document.getElementById(off).style.opacity = '.00';
  document.getElementById(off).style.display = 'block';
  intervaler2 = window.setInterval('up()', 1);  
}

function out() {
    var id = document.getElementById(on);
    
    if (op > 9){
      id.style.opacity = '.' + op;
    }else {
      id.style .opacity = '.0' + op;
    }
    
    id.style.filter = 'alpha(opacity=' + op + ');';
    
    if (op <= 0 ){
      clearInterval(intervaler1); 
    }
    
    op --;
}

function up() {
  var id = document.getElementById(off); 
  
  if (op > 9){
    id.style.opacity = '.' + op;
  }else if (op < 100) {
    id.style .opacity = '.0' + op;
  }else {
    id.style .opacity = '1';
  }
  
  id.style.filter = 'alpha(opacity=' + op + ');';
    
  id.style.top = tops + 'px';
  
  if ( tops <= 0 ){
    clearInterval(intervaler2); 
    
    var temp = off;
    off = on;
    on = temp;
  }
  
  
  
  op += 5;
  tops--;
}