//<![CDATA[
$(function()
{
	$(window).resize(function() {
		initWindow();			
	});
	setTimeout("initWindow(1);", 250);
	
	$('#fontControls').jfontsizer({
		applyTo: 'body',
		changesmall: '1',
		changelarge: '3',
		changedefault: '1.0',
		expire: 50
	});
});

function initWindow(setPixel)
{
	var refPos = $('.footer').position();
	var refPos2 = $('.logo').position();
	var wrapperHeight = $('.wrapper').height();
	var textHeight = $('.text').height();
	var infoHeight = $('.info.boxes').height();
	
	addInt = 0;
	addTop = 0;
	
	if ($('body').height() < 800 && navigator.userAgent.indexOf("Firefox") > -1) addTop = -1;

	if (setPixel == 1)
	{
		if ($('body').height() > 800)
		{
			addInt = 8;
			if (infoHeight == null)  addInt = 0;
			if (navigator.userAgent.indexOf("Firefox") > -1 && navigator.userAgent.indexOf("Macintosh") > -1 && infoHeight == null)
			{
				addTop = -1;
			}
			else if (navigator.userAgent.indexOf("Firefox") > -1 && navigator.userAgent.indexOf("Windows") > -1 && infoHeight == null)
			{
				addTop = -1;
			}
		}
		else
		{
			if (navigator.userAgent.indexOf("Firefox") > -1 && navigator.userAgent.indexOf("Windows") > -1 && infoHeight == null)
			{
				addTop = 0;
			}
			else if (navigator.userAgent.indexOf("Firefox") > -1 && navigator.userAgent.indexOf("Windows") > -1 && infoHeight != null)
			{
				addTop = 0;
			}
		}
	}
	
	if (navigator.userAgent.indexOf("MSIE 7.0") > -1)
	{
		if (setPixel == 1)
		{
			addTop = 141;
			if (infoHeight > 0) addTop = 148;
		}
		else
		{
			addTop = -46;
		}
		addInt = 0;
	}
	
	if (navigator.userAgent.indexOf("MSIE 9.0") > -1)
	{
		if (setPixel == 1)
		{
			addInt = 10;
		}
	}
	
	if (textHeight > 500)
	{	
		addInt = 0;
		$('.footer').css({ 'top' : -200 + 'px' });
		$('.foots').css({ 'top' :  (parseInt(refPos.top, 10) - (568 + addTop)) + 'px' });
	}
	else
	{
		$('.foots').css({ 'top' :  (parseInt(refPos.top, 10) - (368 + addTop)) + 'px' });
	}
	
	$('.foots').css({ 'left' :  (parseInt(refPos2.left, 10) + (625 + addInt)) + 'px' });
	
	if (navigator.userAgent.indexOf("MSIE 7.0") > -1)
	{
		if (wrapperHeight > 800)
		{
			if (setPixel == 1)
			{
				$('.footer').css({ 'top' :  '-201px' });
				if (infoHeight == null) $('.foots').css({ 'top' :  (wrapperHeight - 369) + 'px' });
			}
			else
			{
				$('.foots').css({ 'top' :  (wrapperHeight - 369) + 'px' });
				
			}
		}
		else
		{
			$('.footer').css({ 'top' :  '-187px' });
		}
	}
}

//]]>
