var sourcesizes = {width:1684, height:1074};
var minsizes = {width:980, height:660};
var ratio = minsizes.width/minsizes.height;
var flash_content;
var footer_content;
var footer;
var wrapper;
var flyout;

$( window ).resize( resizeHandler );
//$( document ).ready ( resizeHandler );

function findus()
{
	flyout = flyout || $('#flyout');
	if(flyout.css("display") == "none")
	{
		flyout.css("display","block");
	}
	else
	{
		flyout.css("display","none");
	}
	return false;
}

function resizeHandler()
{
	flash_content = flash_content || $( '#flashContent' );
	footer_content = footer_content || $( '#inner-footer' );
	footer = footer || $('#footer');
	wrapper = wrapper || $('#wrapper');
	flyout = flyout || $('#flyout');
	
	var my_width = $( window ).width();
	var my_height = $( window ).height();
	
	wrapper.height(my_height);

	var my_width = ( ( my_width > minsizes.width ) ? my_width : minsizes.width );
	var my_pos = 0;
	/*if(my_width < minsizes.width)
	{
		my_width = minsizes.width;
	}*/
	if(my_width/my_height > ratio)
	{
		my_width = my_height*ratio;
		my_pos = Math.round(($( window ).width() - my_width)/2);
	}
	
	flash_content.width(my_width);
	footer_content.width(my_width);	
	wrapper.css("left", my_pos);
	footer.css("left", my_pos);
	flash_content.height(my_width * sourcesizes.height/sourcesizes.width);	
	
	
	var aim = flash_content.height();
	if(aim > (my_height-88))
	{
		aim = (my_height-88);
	}
	footer.css("top", aim);
	footer.css("display", "block");
	
	flyout.css("left",my_pos + (my_width-235));
	flyout.css("top",aim-10);
}

function as2jsTrackPage( f_page )
{
    piwikTracker.setDocumentTitle( f_page );
    piwikTracker.trackPageView(); 
}

