﻿(function () {
	
	addEventListener(window, 'resize', tellScroll);
	addEventListener(window, 'scroll', tellScroll);
	
	
	if (!window["yuzuUtils"])
		window["yuzuUtils"] = {};
	var yuzuUtils = window["yuzuUtils"];
	yuzuUtils.getViewPortBottom = function ()
	{
		tellScroll();
	}
	
	function tellScroll()
	{
		var swf = getSwf("external_flashcontent");
		swf.resize(getViewPortHeight() + getScroll());
	}
	
	function getScroll()
	{
		return (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop; 
	}
	function getViewPortHeight()
	{
		return window.innerHeight || (document.documentElement && document.documentElement.clientHeight) || document.body.clientHeight;
	}
	
	function getSwf(id) 
	{
		return navigator.appName.indexOf("Microsoft") != -1 ? window[id] : document[id];
	}

	function addEventListener(target, type, func) 
	{
		if(target.attachEvent) 
			target.attachEvent("on" + type, func);
		else if(target.addEventListener)
			target.addEventListener(type, func, true);
	}
})();

