//DESCRIBES VARIABLES
//describe the minmum width and height
var flashWidthMin = 1000;
var flashWidthMax = false;

var heightMin = 650;
var heightMax = false;

var flashWidth = 0;
var sideBarWidth = 0;

//limit for srinking of window 
var winW = 0;
var winH = 0;
var calH = 0;


//functions amends all page content if page is siz eis smaller than limit
function onResize()
{
	//gets the height for the window
	getWindowData();

	//calculates the height for the window
	//in respect to the set min and max
	processHeight();
		
	//calculate two other elements widths
	calculateFlash();
		
	var flash = document.getElementById('flash');

	if(calH <= heightMin)
	{
		flash.style.height = calH +"px";
	}
	else
	{
		flash.style.height = "100%";	
	}
	
	if(flashWidth <= flashWidthMin)
	{
		flash.style.width = flashWidth + "px";
	}
	else
	{
		flash.style.width = "100%";	
	}
	
	//flash.innerHTML = flashWidth+' x '+calH;
	
	if(heightMax)
	{
		if(winH > heightMax)
		{
			flash.style.top = ((winH-heightMax)/2)+ "px";
		}
		else
		{
			flash.style.top = "auto";
		}
	}
	
	
	
	//address.innerHTML = curPos+' , '+addPos;

	return false;
}

function getWindowData() 
{
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		winW = window.innerWidth;
		winH = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		winW = document.documentElement.clientWidth;
		winH = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		winW = document.body.clientWidth;
		winH = document.body.clientHeight;
	}
}

function processHeight()
{
	calH = winH;	
	if(heightMin)
	{
		if(calH < heightMin)
		{
			calH = 	heightMin;
		}
	}
	
	if(heightMax)
	{
		if(calH > heightMax)
		{
			calH = 	heightMax;
		}
	}
}

function calculateFlash()
{
	flashWidth = winW;
	if(flashWidthMin)
	{
		if(flashWidth < flashWidthMin)
		{
			flashWidth = flashWidthMin;
		}
	}
	
	if(flashWidthMax)
	{
		if(flashWidth > flashWidthMax)
		{
			flashWidth = flashWidthMax;
		}
	}
	return false;
}

