
<!-- Script For VMS interstitial -->
	var MWINDOW_WIDTH = 602;
	var MWINDOW_HEIGHT = 367;
	
	function beginInterstitial(){
		var _overlay = $("<div id='overlay'></div>").appendTo("body").css("opacity",0);
		var _overlay_header = $('<div id="overlay_header"></div>').appendTo("body").css({
									'position':'fixed',
									'top': 0,
									'left': 0,
									'height': '67px',
									'width':'100%',
									'background-color': 'transparent',
									'display':'none',
									'z-index':10000
								});
		
		
		var _mwindow = $("<div id='m_window'><div id='bang-flash'></div></div>").appendTo("body").css(
			{
				"display":"none",
				"width":0,
				"height":0
				
			}
		);
		var _overlay_close = $('<a href="#" id="ad-close-btn">close x</a>').appendTo(_mwindow).css({
									
									'font-size':'12px',
									'position':'absolute',
									'background-color':'#EBEBEA',
									'border':'1px solid #C1BDB7',
									'right':'-10px',
									'top':'-10px',
									'padding':'3px 5px',
									'color':'#666666',
									'text-decoration':'none'
								});
		_overlay.height($(document).height()).animate(
			{
				'opacity':.95
			},
			650,
			function(){
				//_overlay_header.show();
				// setup close win
				_overlay.bind('click',function(){
					_mwindow.hide().remove();
					_overlay.remove();
					_overlay_header.remove();
					$(window).unbind('resize').unbind('scroll');
					return false;
				});
				_overlay_close.bind('click',function(){
					_mwindow.hide().remove();
					_overlay.remove();
					_overlay_header.remove();
					$(window).unbind('resize').unbind('scroll');
					return false;
				});
				// setup window resize and scroll events
				$(window).bind('resize',function(){
					var win_width = $(window).width();
					var win_height = $(window).height();
					var m_width = _mwindow.width();
					var m_height = _mwindow.height();
					_overlay.css({
						'width':$(document).width(),
						'height':$(document).height()
					});
					_overlay_header.css({
							'width':win_width			
										
						});
					_mwindow.css(
						{
							'left':win_width/2 - m_width/2,
							'top':(win_height/2 - m_height/2) + $(window).scrollTop() 
						}
					);
				});
				$(window).bind('scroll',function(){
					var win_width = $(document).width();
					var win_height = $(window).height();
					var m_width = _mwindow.width();
					var m_height = _mwindow.height();
					
					_mwindow.css(
						{
							'left':win_width/2 - m_width/2,
							'top':(win_height/2 - m_height/2) + $(window).scrollTop() 
						}
					);
				});
				// scale in interstitial background
				_mwindow.show().animate(
					{
						'width': MWINDOW_WIDTH,
						"height":MWINDOW_HEIGHT
					},
					{
						duration:750,
						step: function(now,fx){
							var win_width = $(window).width();
							var win_height = $(window).height();
							
							if (fx.prop === 'width')
							{
								//adjust left position
								_mwindow.css(
									'left', win_width/2 - now/2
								);
							}
							if (fx.prop === 'height')
							{
								// adjust top position
								_mwindow.css(
									'top', (win_height/2 - now/2)  + $(window).scrollTop() 
								);
							}
						},
						complete: function(){
							// display bang animation
							flashvars = false;
							params = {'wmode':'opaque'};
							swfobject.embedSWF("images/ads/bang-intersitial.swf", "bang-flash", "602", "367", "10.0.0","Scripts/swfobject/expressInstall.swf",flashvars,params);
						}
					}
				);
			}
		);
	} 
	$(
		function( ){
			//Code for popup version
			var marquee_banner = $('#marqueeContent').clone();
			var marquee = $('#marquee');
			/*$('a[href="#vms8.0"]').live('click',function(){
				marquee.empty().append(marquee_banner);								  
				beginInterstitial();
				return false;									 
			});*/
			
			$('#marqueeContent a#vmsbanner').trackEvent().live('click',function()
			{
				
				
				marquee.css({'background':'none','height':'auto'});
				flashvars = false;
				params = {'wmode':'opaque'};
				
				swfobject.embedSWF("images/ads/bang-intersitial.swf", "marqueeContent", "280", "170", "10.0.0","Scripts/swfobject/expressInstall.swf",flashvars,params);
				
				var enlarge_btn = $('<a href="#vms8.0">view larger</a>').trackEvent()
									.css(
									{
										'display':'block',
										'color':'white',
										'text-decoration':'none',
										'font-size':'12px',
										'background-color':'#F59328',
										'text-align':'center',
										'font-weight':'bold',
										'padding':'5px 0px',
										'border':'1px solid #3F90EB'
									}).appendTo(marquee)
									.click(function(){
										marquee.empty().append(marquee_banner);								  
										beginInterstitial();
										return false;	
									});
				return false;
			});
			
		}
	);

