
$(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,1);

  /*$('#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,sSpeed){
  sCurrentLocation = sEle;
  $('#intro').slideUp(sSpeed);
  $('#features').slideUp(sSpeed);
  $('#specification').slideUp(sSpeed);
  $('#photo').slideUp(sSpeed);
  $('#animation').slideUp(sSpeed);
  $('#brochures').slideUp(sSpeed);
  $('#request_information').slideUp(sSpeed);
  $('div.product-menu ul li').removeClass('active');
  $('#li_'+sEle).addClass('active');
  $('#'+sEle).slideDown(sSpeed);
}

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,'slow');
    }
  }
}



