/*

PETRA CLASS

Global JavaScript Actions

Version 1.0
Author: futurepruf.com

*/


$(document).ready(function() {

	/*global x, y */
  // Background resizer, thank you Jeff

  if($.browser.safari) {
    var img = $('#background img');
    img.load(function() {
      var o = {
        width: img.width(),
        height: img.height(),
        p: img.width()/img.height()
      };

      $(window).resize(function() {
        var self = $(this);
        var width = self.width();
        var height = self.height();
        img.css({
          width: (y = (width > (x = Math.round(height * o.p)))) ? width : x,
          height: (y ? Math.round(width / o.p) : height)
        });
      });
      $(window).trigger('resize');
    });
  }

});