var jqBody;
var jqMain;
var jqMenu;
	    
$(document).ready(function() {
	jqBody = $('#objBody');
	jqMain = $('#objMain');
	jqMenu = $('#objMenu');

	handleResize();
        $(window).resize(handleResize);

	if ( jqMenu.css('position') != "fixed" ) {
	    $(window).scroll(function() {
		jqMenu.css('top', $(window).scrollTop()+10);
	    });
	}

	$('.tabs a').click(function() {
	    $this = $(this);
	    $('.panel').hide();
	    $('.tabs a.active').removeClass('active');
	    $this.addClass('active').blur();
	    var panel = $this.attr('href');
	    $(panel).fadeIn(250);
	    return false;
	}); // end click
	$('.tabs li:first a').click();

	$('.fancybox').fancybox({
		transitionIn: 'none',
		transitionOut: 'none',
		titlePosition: 'over',
		cyclic: true
	});

}); // end ready

var currWidth;
function handleResize() {
	var newWidth = document.body.clientWidth;
	if (currWidth != newWidth) {
	    if (newWidth > 1120) {
		// this is a fix for browsers that do not understand
		// min-width and max-width.
	        var bodyWidth = parseInt(jqBody.css('width'), 10);
		newLeft = (newWidth - bodyWidth) / 2 + 15;
		jqMenu.css('left', newLeft);
	    } else if (currWidth > 1120) {
		newLeft = 15;
		jqMenu.css('left', newLeft);
	    }
	    currWidth = newWidth;
	    //log.debug("something");
	}
}

