$(document).ready(init);
window.onresize = resizeFuncs;

function init()
{
	//$(document).pngFix();
	resizeFuncs();
	$('#pic1').show();
	slideShow(0);
	$('#APP_POPUP').css({opacity: 0.9});
}

function resizeFuncs()
{
	headerBgPos();
	checkWebsitePos();
}

function headerBgPos()
{
	var p = $('#APP_CONT')[0].offsetLeft - 976;
	$('body').css('background-position', p +'px 0');
}

function checkWebsitePos()
{
	if($('body')[0].offsetWidth < 986)
	{
		$('#APP_CONT').css('left', 493);
	}
	else
	{
		$('#APP_CONT').css('left', '50%');
	}
}

var tmpPic = 1;
function slideShow(n)
{
	var pics = 4;
	var t = 3000;

	if(n == 0)
	{
		window.setTimeout('slideShow(1)', t);
	}
	else
	{
		var n2 = (n + 1 > pics)? 1 : n + 1;
		$('#pic'+ n2).css('z-index', 12);
		$('#pic'+ tmpPic).css('z-index', 10);
		tmpPic = n2;
		$('#pic'+ n2).animate({opacity: 'toggle'}, 3000, function(){ $('#pic'+ n).css('display', 'none'); window.setTimeout('slideShow('+ n2 +')', t); });
	}
}
