﻿var flashPlay = false;

$(document).ready(function() {	
 
	//Cancel the link behavior
	//e.preventDefault();
	
	//Get the div
	var id = '#CampaignWindow';

	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();

	//Set heigth and width to mask to fill up the whole screen
	$('#Mask').css({'width':maskWidth,'height':maskHeight});
	
	//transition effect		
	$('#Mask').fadeIn(200);	
	$('#Mask').fadeTo("fast",0.7);	

	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();
          
	//Set the popup window position
//	$(id).css('top',  winH/2-$(id).height()/2);
	$(id).css('top',  200);
	$(id).css('left', winW/2-$(id).width()/2);

	//transition effect
	$(id).fadeIn(100); 

    if(flashPlay){
        $('#FlashWin').html(myFlash);     	
     }


	
	//if close button is clicked
	$('.Window .Close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		CloseWin();

	});		
	
	//if mask is clicked
/*	$('#Mask').click(function () {
		$(this).hide();
		$('.Window').hide();
	});			
*/	


});

function CloseWin()
{
    if(flashPlay){
        $("#FlashWin").html('');
        flashPlay=false;
    }
	
	$('#Mask').hide();
	$('.Window').hide();
}

$(window).resize(function() { 

	var id = '#CampaignWindow';

	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();

	//Set heigth and width to mask to fill up the whole screen
	$('#Mask').css({'width':maskWidth,'height':maskHeight});

	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();
          
	//Set the popup window to center
	$(id).css('top',  200);
	$(id).css('left', winW/2-$(id).width()/2);

}); 