
function popup(url) {
	newwindow=window.open(url,'Rules','height=550,width=500,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
	// if (window.focus) {newwindow.focus()}
}

// overlay(s)
	launchoverlay = function(id) {
		//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':584,'height':559});
		
		//transition effect		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("fast",0.8);	
		
		//transition effect
		$(id).fadeIn(500); 
	};
	
	$(document).ready(function() {
		//if close button is clicked
		$('.window .close').click(function (e) {
			//Cancel the link behavior
			e.preventDefault();
			$('#mask, .window').hide();
		});		
			
		$('.gallery_thumbs a, #winner_display a').click(function(e){
			launchoverlay('#vidplayer');
			loadmovie($(this).attr('href'));
			e.preventDefault();
		});
		
		$('#mask').click(function () {
			closeOverlay();
		});
	});
	
	function loadmovie (url) {
		var params = {
				// base:"swf/",
				allowScriptAccess: "always",
				bgcolor: "#000",
				wmode: "window"
			};
			var flashvars = {videoToPlay: url};
			var attributes = {id:"flashcontent"};
			swfobject.embedSWF("swf/flipVideo.swf", "flashcontent", "478", "308", "9.0.45", "swf/expressinstall.swf", flashvars, params, attributes);
		}

		function closeOverlay () {
			$('#mask').hide();
			$('.window').hide();
			$('#flashcontent').replaceWith('<div id="flashcontent">' + '</div>');
		};	
		
	
		var Kellogg = {
			debug: false // set to true to enable console logging 
		};
		
		
		
		// tracking functions
		Kellogg.trackers = [];
		
		Kellogg.track = function (str) {
			for (var i = 0, l = Kellogg.trackers.length; i < l; i++) {
				if (typeof Kellogg.trackers[i]._trackPageview === "function") {
					if (str) {
						Kellogg.trackers[i]._trackPageview(str);
					} else {
						Kellogg.trackers[i]._trackPageview();
					}
				}
			}
		};


