
LeaveWarning = {
	show: function(url, track, trackingTitle) {
		var newLeft = 400;
		var newTop = 250;
		if(document.viewport) {
			var offsets = document.viewport.getScrollOffsets();
			var dims = document.viewport.getDimensions();
			newLeft = ((dims.width - 400) / 2) + offsets[0];
			newTop = ((dims.height - 400) / 2) + offsets[1];
			newTop = (newTop > 250)? newTop : 250;
		} 
		if(!$('leave-warning-container')) {
			$(document.body).insert('<div id="leave-warning-container" style="position:absolute; display:none;top:250px; left:400px; z-index:500;"><div style="position:absolute; border:1px;border-color:#FFFFFF; border-style:solid; z-index:500; background-color:#03797D;"><table width="400" border="0" cellspacing="0" cellpadding="0"><tr><td width="400" height="325"><img src="/images/leavewarning/leave-warning_01.jpg" width="400" height="325" border="0" /></td></tr><tr><td border="0"><a id="leave-warning-link" href="#" onClick="LeaveWarning.hide();" target="_blank"><img src="/images/leavewarning/leave-warning_02.jpg" width="400" height="75" border="0" alt="Continue" /></a></td></tr></table><div style="position:absolute; display:block; right:5px; top:5px;"><a href="javascript:void(null);" style="color:#FFFFFF; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px; text-decoration:none;" onClick="LeaveWarning.hide();"><strong>Close [x]</strong></a></div></div></div>');
		}
		$('leave-warning-link').href = url;
		$('leave-warning-container').setStyle({left:newLeft, top:newTop});
		//	Effect.Appear('leave-warning-container', {duration:0.3});
		$('leave-warning-container').setStyle({display:'block'});
		LeaveWarning.special(true);
		if(track) {
			LeaveWarning.trackLink(trackingTitle);
		}
	},
	
	hide: function() {
		// if($('leave-warning-container') != '') $('leave-warning-container').fade({duration:0.3});
		if($('leave-warning-container') != '') 	$('leave-warning-container').setStyle({display:'none'});

		LeaveWarning.special(false);
	},
	
	//put all known special cases in here where we have to do some manipulation...
	//not the best solution in the world but too bad
	special: function(show) {
		if((Prototype.Browser.IE || Prototype.Browser.WebKit)&& document.location.pathname == '/games/play.php') {
			if(show) {
				if($('framey')) $('framey').setStyle({visibility:'hidden'});
			} else {
				if($('framey')) $('framey').setStyle({visibility:'visible'});
			}
		} else if(document.location.pathname == '/blast/index.php' 
				  || document.location.pathname == '/blast/' 
				  || document.location.pathname == '/winit/index.php' 
				  || document.location.pathname == '/winit/index.php') {
			if(show) {
				if($('bigBoxContainer')) $('bigBoxContainer').setStyle({visibility:'hidden'});
			} else {
				if($('bigBoxContainer')) $('bigBoxContainer').setStyle({visibility:'visible'});
			}
		}
	},
	
	trackLink: function(trackingTitle) {
		var s=s_gi('astralfamilyca' ); 
		s.tl(this,'o', trackingTitle);	
	}
}