﻿$(document).ready(function(){

  // shift everything with offset left
  $('div.offsetleft').css({left: $('div.page').offset().left+540, top:60});
  $('div.pageslidertop').css({top:185});
  //$('div.offsetleft').fadeIn('fast');
  // setup a resize handler to do the same
  $(window).resize(function() {
    $('div.page').each(function(){
      $('div.offsetleft').css({left: $(this).offset().left+540});
    });
  });

  // sort out the menu
  var thispage = GetFilename($(location).attr('href'), 'aspx');
  if(thispage == null || thispage == '')
    thispage='Default.aspx';
    
  $('div.option').removeClass('selected');
  $('div.option a[href='+thispage+']').parent().addClass('selected');
  
});

///
function GetFilename(url, ext)
  {
  if (url)
  {
    url = url.replace(window.location.protocol+"//"+window.location.host, "");
    var m = url.toString().match(/.*\/(.+?)\./);
    if (m && m.length > 1)
      return m[1]+'.'+ext;
  }
  return "";
}

