( function ( $ ) {
	
	//Private vars
	var POPUPCONTAINER = '#bigbreakPanel';
	var SHOWPOPUP 		= "BIGBREAKWINNER.SHOWPOPUP";
	var OVERLAYID		= "modalOverlay";
	
	//private functions
	function onPopupOpen( dialog ){
					dialog.overlay.fadeIn( 'slow',
						function () {
							dialog.container.fadeIn(
								'slow',
								function () {
									dialog.data.show(); 
									$(".bigbreakPanel").show();
									
								}
							);
						}
					);
				}
	$.extend
	({
		bigbreakWinner: {
			
			launchPopup : function()
			{
			
				//if (!$.cookie(SHOWPOPUP)) { $.cookie(SHOWPOPUP, "true",{expires:365}); }//init the value if required
				//if( $.cookie( SHOWPOPUP ) == "true")
				
					$( POPUPCONTAINER ).modal({
						containerCss:{
							width			: '770px',
							marginLeft		: '-385px',
							height			: '535px',
							left			: '50%',
							top				: '30px',
							/*marginTop		: '-340px',*/
							backgroundColor	: '#fff',
							overflow		: 'hidden',
							borderWidth		: '1px',
							borderColor		: '#fff',
							borderStyle		: 'solid'
						}
					,	overlayCss:{
							backgroundColor	: '#000',
							overflow		: 'hidden'
						}
					,	overlay		: 70
					,	close		: false
					,	persist		: true
					,	onOpen		: onPopupOpen
					,	overlayId	: OVERLAYID
					});	p
					
					$("#"+OVERLAYID).click( function(e){
		            	$.bigbreakWinner.close();
		            });
				
			}
			, close : function()
			{
				//$.cookie(SHOWPOPUP,"false",{expires:365});//only show the popup once
				$.modal.close();				
			}
		}
	});
	
})(jQuery);


//custom function for flash invoke
function prelaunchPopup(){
	$.bigbreakWinner.launchPopup();	
}
