function init() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  document.getElementById('menu').style.height = myHeight-240;
}

var flexiBackground = function(){
 
/**
CONFIGURATION:
Define the size of our background image
*/
var bgImageSize = {
width : 1280,
height : 1024
};
 
/**
Declare and define variables
*/ 
var awindow,
abody,
imageID = "expando",
tallClass = 'tall',
wideClass = 'wide',
abgImage, awrapper, img, url, imgAR;
 
/**
Are we dealing with ie6?
*/
var ie6 = (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) <= 6);
 
/**
Set up the action that happens on resize
*/
var resizeAction = function() {
var win = {
height : awindow.height(),
width : awindow.width()
};
 
// The current aspect ratio of the window
var winAR = win.width / win.height;
 
// Determine if we need to show the image and whether it needs to stretch tall or wide
if (win.width < bgImageSize.width && win.height < bgImageSize.height) {
abody
.removeClass(wideClass)
.removeClass(tallClass);
} else if ((win.w < bgImageSize.width && win.height >= bgImageSize.height) || (winAR < imgAR)) {
abody
.removeClass(wideClass)
.addClass(tallClass);
// Center the image
abgImage.css('left', Math.min(((win.width - bgImageSize.width) / 2), 0));
} else if (win.width >= bgImageSize.width) {
abody
.addClass(wideClass)
.removeClass(tallClass);
abgImage.css('left', 0);
}
 
// Need to fix the height of the wrapper for IE6
if (ie6) {
awrapper.css('height', win.height);
}
};
 
return {
 
/*
Sets up the basic functionality
*/
initialize : function() {

// No need for any of this if the screen isn't bigger than the background image
if (screen.availWidth <= bgImageSize.width || screen.availHeight <= bgImageSize.height) {
return;
}
 
// Grab elements we'll reference throughout
awindow = jQuery(window);
abody = jQuery('body');
 
// Parse out the URL of the background image and drop out if we don't have one
url = abody.css('background-image').replace(/^url\(("|')?|("|')?\);?$/g, '') || false;
if (!url || url === "none" || url === "") {
return;
}
 
// Get the aspect ratio of the image
imgAR = bgImageSize.width / bgImageSize.height;
 
// Create a new image element
abgImage = jQuery('<img />')
.attr('src', url)
.attr('id', imageID);
 
// Create a wrapper and append the image to it.
// The wrapper ensures we don't get scrollbars.
awrapper = jQuery('<div></div>')
.css({
'overflow' : 'hidden',
'width' : '100%',
'height' : '100%',
'z-index' : '-1'
})
.append(abgImage)
.appendTo(abody);
 
// IE6 Doesn't do position: fixed, so let's fake it out.
// We'll apply a class which gets used in the CSS to emulate position: fixed
// Otherwise, we'll simply used position: fixed.
if (ie6) {
awrapper.addClass('ie6fixed');
} else {
awrapper.css({
'position' : 'fixed',
'top' : 0,
'left' : 0
});
}
 
// Set up a resize listener to add/remove classes from the body 
awindow.bind('resize', resizeAction);
 
// Set it up by triggering a resize
awindow.trigger('resize');
}
};
}();
jQuery(document).ready(flexiBackground.initialize);
jQuery(document).ready(function() {
	jQuery("a[rel='jc']").colorbox();
	Cufon.replace('#menu', { fontFamily: 'mw' });
});
