/**
 * SWFResize (resize swfobject) is (c) 2010 Sargis Saribekyan (http://www.creativearmenia.com)
 * This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
 */
var minWidth=-1;
var minHeight=-1;
	
function setMinimumSize(flashWidth,flashHeight)
{
	minWidth = flashWidth;
	minHeight = flashHeight;
	divResize();
}

function setScrollPosition(x_offset,y_offset)
{
	window.scrollTo(x_offset,y_offset);
	callOffset();
}

window.onload=function()
{
	divResize();
}
window.onresize=function()
{
	divResize();
}


function getWindowSize()
{
	var winH, winW;
	if (parseInt(navigator.appVersion)>3) {
		if ( document.body.offsetWidth ){ // Gecko / WebKit
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		} else if ( document.body.offsetWidth ){ // MS
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	return { height: winH, width: winW };
}
function divResize()
{
	var winSize = getWindowSize();
	var w, h, min_w, min_h;
	
	if(minWidth == -1 )
	{
		min_w = "0px";
		w="100%"
	}else{
		w = winSize.width < minWidth ? minWidth+"px" : "100%";
		min_w = minWidth+"px";
	}
	
	if(minHeight == -1)
	{
		min_h = "0px";
		h = "100%";
	}else{
		h = winSize.height < minHeight ? minHeight+"px" : "100%";
		min_h = minHeight+"px";		
	}
	if( document.all ) document.body.scroll = ( w!="100%" || h!="100%" )? "auto" : "no";
	
	document.getElementById("flashContainer").style.minWidth = min_w;
	document.getElementById("flashContainer").style.minHeight = min_h;
	document.getElementById("flashContainer").style.width = w;
	document.getElementById("flashContainer").style.height = h;
	
	var obj = swfobject.getObjectById(attributes.id);
	if( typeof( obj.pageResize ) == 'function' )
	{
		
		obj.pageResize();
	}
	callOffset();
}

window.onscroll = function()
{
    callOffset()
}

function callOffset()
{
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	var dsocleft=document.all? iebody.scrollLeft : window.pageXOffset
	var dsoctop=document.all? iebody.scrollTop : window.pageYOffset
	
	var winSize = getWindowSize();
	
	var dsocright=minWidth-winSize.width-dsocleft;
	var dsocbottom=minHeight-winSize.height-dsoctop;
	
	var obj = swfobject.getObjectById(attributes.id);
	if( typeof( obj.pageOffset ) == 'function' )
	{
		obj.pageOffset( dsoctop , dsocleft, dsocright, dsocbottom);
	}
}
