$(document).ready(function()
{		
		resizeEvent();
		window.onresize = resizeEvent;
});

function resizeEvent(){

	var pageSizeList = getPageSize();	
	var targetList = document.body.getElementsByTagName("div");

	for (var i=0; i<targetList.length; i++)
	{
		var target = targetList[i];
		
		if (target.getAttribute("id")=="wrappar")
		{
			
			if(navigator.appName == "Opera")
			{
				if(pageSizeList[1]>=524)
				{
					target.style.marginTop = (-262 + 'px');
					target.style.top = "50%";
				}
				else
				{
					target.style.marginTop = (0 + 'px');
					target.style.top = "0";
				}
				
				if(pageSizeList[0]>=1024)
				{
					target.style.marginLeft = (-512 + 'px');
					target.style.left = "50%";
				}
				else
				{
					target.style.marginLeft = (0 + 'px');
					target.style.left = "0";
				}
				
			}
			else
			{
				if(pageSizeList[3]>=524)
				{
					target.style.marginTop = (-262 + 'px');
					target.style.top = "50%";
				}
				else
				{
					target.style.marginTop = (0 + 'px');
					target.style.top = "0";
				}
				
				if(pageSizeList[2]>=1024)
				{
					target.style.marginLeft = (-512 + 'px');
					target.style.left = "50%";
				}
				else
				{
					target.style.marginLeft = (0 + 'px');
					target.style.left = "0";
				}
				
			}
			
			break;
			
		}
	}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY)
	{	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else
	{
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight)
	{
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	}
	else
	{ 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth)
	{	
		pageWidth = windowWidth;
	}
	else
	{
		pageWidth = xScroll;
	}

	pageSizeList = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return pageSizeList;
}