function getWidth() {
  var width = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    width = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    width = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    width = document.body.clientWidth;
  }
  return width;
}

function getHeight() {
  var height = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    height = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    height = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    height = document.body.clientHeight;
  }
  return height;
}

function getSpeed(width, direction, speed) {
  var current = $("#photos").css('left').replace('px', '');
  if (direction == 'back') {
    return parseInt(-current * speed / width);
  }
  if (direction == 'forward') {
    var delta = parseInt(width + current);
    return parseInt(delta * speed / width);
  }
}