
$(document).ready(function(){
  var sHash = 'intro';
  var sCurrentLocation = '';
  if(location.hash !='')  {
    var sTmpHash = location.hash;
    sTmpHash = sTmpHash.replace('#','');
    if(typeof(document.getElementById('#'+sTmpHash)) != null && typeof(document.getElementById('#'+sTmpHash)) != 'undefined') {
      sHash = sTmpHash;
    }
  }
  setInterval("CheckForHash()", 300);    
  SwapTiles(sHash);
  
  /*$('#li_intro').click(function() {
    SwapTiles('intro');
  })
  
  $('#li_brochures').click(function() {
    SwapTiles('brochures');  
  })
  
  $('#li_features').click(function() {
    SwapTiles('features');
  })

  $('#li_specification').click(function() {
    SwapTiles('specification');
  })
  
  $('#li_video').click(function() {
    SwapTiles('video');
  })

  $('#li_photo').click(function() {
    SwapTiles('photo');
  })
  
  $('#li_animation').click(function() {
    SwapTiles('animation');
  })
  
  $('#li_request_information').click(function() {
    SwapTiles('request_information');
  })
  */
  $('#specification table tr:even').addClass('dark');
  $('#specification table tr:odd').addClass('light');
  
	$('#photos li a').lightBox({
	  fixedNavigation:false,
	  imageLoading: '/img/lightbox-ico-loading.gif',
	  imageBtnClose: '/img/lightbox-btn-close.gif',
	  imageBtnPrev: '/img/lightbox-btn-prev.gif',
	  imageBtnNext: '/img/lightbox-btn-next.gif'
	  
	});
	
  $('#animations li a').lightBox({
	  fixedNavigation:false,
	  imageLoading: '/img/lightbox-ico-loading.gif',
	  imageBtnClose: '/img/lightbox-btn-close.gif',
	  imageBtnPrev: '/img/lightbox-btn-prev.gif',
	  imageBtnNext: '/img/lightbox-btn-next.gif'
	  
	});
  
});

function SwapTiles(sEle){
  sCurrentLocation = sEle;
  $('#intro').slideUp('slow');
  $('#features').slideUp('slow');
  $('#specification').slideUp('slow');
  $('#photo').slideUp('slow');
  $('#animation').slideUp('slow');
  $('#brochures').slideUp('slow');
  $('#request_information').slideUp('slow');
  $('div.product-menu ul li').removeClass('active');
  $('#li_'+sEle).addClass('active');
  $('#'+sEle).slideDown('slow');  
}

function CheckForHash() {
    var sTmpHash = location.hash
  if(location.hash=='') {
    var sCurHash = 'intro';
  } else {
    var sCurHash = sTmpHash.replace('#',''); 
  }
  if(sCurHash != sCurrentLocation)  {
    if(typeof(document.getElementById('#'+sCurHash)) != null && typeof(document.getElementById('#'+sCurHash)) != 'undefined') {
      SwapTiles(sCurHash);
    }
  }
}


