/**
 * Browser
 * 
 * @author		Justen Holter
 */
if(typeof fse == "undefined") var fse = new Object();

fse.Browser = {
	
	_flashDivId: 'index',
	_flashSWFId: 'index',
	_flashHeight: 0,
	_flashWidth: 0,
	
	getFlash: function(){
		return document.getElementById(this._flashDivId);
	},
	
	getHeight: function(){
		
		if (typeof(window.innerHeight) == "number")
			
			return Number(window.innerHeight);
			
		else if (document.documentElement && document.documentElement.clientHeight)
				
			return Number(document.documentElement.clientHeight);
			
		else if (document.body && document.body.clientHeight)
				
			return Number(document.body.clientHeight)
	},
	
	setHeight: function(value){
		
		this._flashHeight = value;
		this.getFlash().style.height = (this._flashHeight > fse.Browser.getHeight()) ? value + 'px' : '100%';
	},
	
	getWidth: function(){
		
		if(typeof(window.innerWidth) == "number")
			
			return Number(window.innerWidth)
			
		else if (document.documentElement && document.documentElement.clientWidth)
			
			return Number(document.documentElement.clientWidth)
			
		else if (document.body && document.body.clientWidth)
			
			return Number(document.body.clientWidth);
	},
	
	setWidth: function(value){
		this._flashWidth = value;
		this.getFlash().style.width = (this._flashWidth > fse.Browser.getWidth()) ? value + 'px' : '100%';
	},
	
	getScroll: function(){
		
		if (typeof(window.pageYOffset) == "number")
			
			return Number(window.pageYOffset);
			
		else if (document.documentElement && typeof(document.documentElement.scrollTop) == "number")
			
			return Number(document.documentElement.scrollTop);
			
		else if (document.body && typeof(document.body.scrollTop) == "number")
			
			return Number(document.body.scrollTop);
	},
	
	setScroll: function(value){
		
	},
	
	getTitle: function(){
		return String(document.title);
	},
	
	setTitle: function(value){
		document.title = value;
	},
	
	onResize: function() {
		fse.Browser.setHeight(fse.Browser._flashHeight);
		fse.Browser.setWidth(fse.Browser._flashWidth);
		
		var flashID = document.getElementById(fse.Browser._flashSWFId)
		if(flashID.onResize){
			flashID.onResize(fse.Browser._flashHeight);
		}
	},
	
	onScroll: function() {
		var flashID = document.getElementById(fse.Browser._flashSWFId);
		if(flashID.onScroll){
			flashID.onScroll(fse.Browser.documentY());
		}
	},
	
	onUnload: function() {
		var flashID = document.getElementById(fse.Browser._flashSWFId);
		if(flashID.onUnload){
			flashID.onUnload();
		}
	}
}

window.onresize = fse.Browser.onResize;
window.onscroll = fse.Browser.onSCroll;


