//(function(){
YAHOO.namespace("gaia.app.flash");

// scoped YAHOO objects for shorthand and simplicity
var DOM     = YAHOO.util.Dom;

YAHOO.gaia.app.flash = function() {
	
	return {
		launch: function(obj, srv, sid, params) {
			//call the header launcher without returning anything
			header_launcher(obj, srv, sid, params);
		},
		close: function() {
			window.close();
		},
		elapsed_time: function(game,start_time,main_server) {
			var end_time = new Date();	
			var total_time = end_time.getTime() - start_time.getTime();
			total_time /= 1000;
			var tracking_image = new Image(1,1);
			tracking_image.src = 'http://'+main_server+'/internal/prd_t.php?pid=' + Math.floor(total_time) +
								'&prd=84&loc='+game+'&tm=' + end_time.getTime();
			return 'track';
		},
		getInnerSize: function () {
			var x,y;
			if (self.innerHeight) // all except Explorer
			{
				x = self.innerWidth;
				y = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientHeight)
				// Explorer 6 Strict Mode
			{
				x = document.documentElement.clientWidth;
				y = document.documentElement.clientHeight;
			}
			else if (document.body) // other Explorers
			{
				x = document.body.clientWidth;
				y = document.body.clientHeight;
			}
			return [x,y];
		},
		resizeToInner: function (w, h, x, y) {
			// make sure we have a final x/y value
			// pick one or the other windows value, not both
			if (x==undefined) x = window.screenLeft || window.screenX;
			if (y==undefined) y = window.screenTop || window.screenY;
			
			// for now, move the window to the top left
			// then resize to the maximum viewable dimension possible
			window.moveTo(0,0);
			window.resizeTo(screen.availWidth,screen.availHeight);
			
			// now that we have set the browser to it\'s biggest possible size
			// get the inner dimensions.  the offset is the difference.
			var inner = this.getInnerSize();
			var ox = screen.availWidth-inner[0];
			var oy = screen.availHeight-inner[1];
			
			// now that we have an offset value, size the browser and position it					
			window.resizeTo(w+ox, h+oy);					
			window.moveTo(x,y);
		}
	};
}();
// end anonymous function scope
//})();

var gaf = YAHOO.gaia.app.flash;
