
var browsers = 'IE';


/* CODE AREA */

var initFooter = function(){
	var footer = document.getElementById('footer_flash');
	var main = document.getElementById('flash');
	var page = document.getElementById('page');
	if (ie || ff){
		var windowHeight = document.documentElement.clientHeight;
	} else if (opera){
		var windowHeight = document.body.clientHeight;
	} else if (safari){
		var windowHeight = self.innerHeight;
	}
	var pageHeight = page.offsetHeight;
	var footerHeight = footer.offsetHeight;

	if (windowHeight > pageHeight + footerHeight){
		footer.style.position = 'absolute';
		footer.style.left = '0px';
		footer.style.bottom = '0px';
	} else {
		footer.style.position = 'static';
		footer.style.left = 'auto';
		footer.style.bottom = 'auto';
	}

}

/* hovers */

var initHovers = function()
{
	for (var index in config.hovers){
		var conf = config.hovers[index];
		var topLevelElement = document.getElementById(conf.parentId);
		if (topLevelElement){
			var subElements = topLevelElement.getElementsByTagName(conf.tagName);
			for (var i = 0; i < subElements.length; i++){
				if (conf.tagPosition == 'all' || (conf.tagPosition == 'children' && subElements[i].parentNode.id == conf.parentId))
				{
					subElements[i].configIndex = index;
					subElements[i].onmouseover = function(){
						this.className += ' ' + config.hovers[this.configIndex].className;
					};
					subElements[i].onmouseout = function(){
						this.className = this.className.replace(config.hovers[this.configIndex].className,'');
					};
				}
			}
		}
	}
}

/* common */

var currentState = {};

var opera = window.opera;
var safari = navigator.appVersion.indexOf("Safari") != -1;
var ie = document.all && !window.opera;
var ff = navigator.userAgent.indexOf("Firefox") != -1;

var attachOnLoad = function(browsers,initMethod)
{
	if (opera && (browsers.match(/Opera/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (safari && (browsers.match(/Safari/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (ie && (browsers.match(/IE/) || browsers.match(/all/))) {
		window.attachEvent("onload", initMethod);
	} else if (ff && (browsers.match(/FF/) || browsers.match(/all/))) {
		window.addEventListener("load", initMethod, false);
	} else if (!ie && !ff && !safari && !opera) {
		if (window.addEventListener){
			window.addEventListener("load", initMethod, false);
		}
		else if (window.attachEvent){
			window.attachEvent("onload", initMethod);
		}
	} 
}

attachOnLoad(browsers,initHovers);
attachOnLoad('all',initFooter);
		if (window.addEventListener){
			window.addEventListener("resize", initFooter, false);
		}
		else if (window.attachEvent){
			window.attachEvent("onresize", initFooter);
		}
