	
var DonationLightboxHelpers = {
	setLightBox:function (content)
	{ 		
		$("body").append(unescape(content));	
		$("body").css("overflow","auto");	
		$.lightbox.showDom('#globe', {speed: 'slow', width: 811, height: 630, opacity: 0.8, closecallback: function(closer) {
							// CLOSE CALLBACK:
							if ( $('#globe_content').is('.success') ) return;
		
		
							}}, function(){ });
	},
	hideLightbox:function ()
	{
		if(typeof showForever == "undefined") 
		{
			DonationLightboxHelpers.createCookie("donationlightboxvisted","1",998989);
		}
		else
		{
			if(showForever == "1")
			{
			
				DonationLightboxHelpers.createCookie("donationlightboxvisted","1",999999);
			}
		}
		$.lightbox.hide();
	},
	createCookie:function (name,value,days) {
		if (days) {
			var date = new Date();
			if(days==898989)
			{
				date.setTime(date.getTime()+(60*60*1000));
			}
			else if(days==999999)
			{
				date.setTime(date.getTime()+1);
			}
			else
			{
				date.setTime(date.getTime()+(days*24*60*60*1000));
			}	
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	},
	
	readCookie:function (name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	
	eraseCookie:function (name) {
		createCookie(name,"",-1);
	}
};
var wDiff = 0;
$(document).ready(function(){	
	if(DonationLightboxHelpers.readCookie("totebag_program") && DonationLightboxHelpers.readCookie("donationlightboxvisted"))	
		return;
	if(DonationLightboxHelpers.readCookie("thanksgiving_program") && DonationLightboxHelpers.readCookie("donationlightboxvisted"))	
		return;
	if(DonationLightboxHelpers.readCookie("memorials_program") && DonationLightboxHelpers.readCookie("donationlightboxvisted"))
		return;
	
	if(DonationLightboxHelpers.readCookie("christmas_program") && DonationLightboxHelpers.readCookie("donationlightboxvisted"))
		return;

	if(DonationLightboxHelpers.readCookie("bluesealsemiles_program") && DonationLightboxHelpers.readCookie("donationlightboxvisted"))
		return;	
	
		
	if(typeof from_Page == "undefined") 
	{
		var from_Page="2";
	}	
	
	if(DonationLightboxHelpers.readCookie("valleywildlife_program_new") && from_Page=="1")
		return;	
		
	if(DonationLightboxHelpers.readCookie("valleywildlife_program") && from_Page=="1")
	{
		if(!DonationLightboxHelpers.readCookie("valleywildlife_program_new"))
			DonationLightboxHelpers.createCookie("valleywildlife_program_new",1,7);
	}
	
	
	if(DonationLightboxHelpers.readCookie("from_page")) 
	{
		var from_Page="1";
		DonationLightboxHelpers.eraseCookie("from_page");
	}
	else
	{
		var from_Page="2";
	}	
	
	if(DonationLightboxHelpers.readCookie("newmedia_program_new") && from_Page=="1")
	{
		DonationLightboxHelpers.eraseCookie("from_page");
		return;
	}	
	
	if(DonationLightboxHelpers.readCookie("newmedia_program") && from_Page=="1")
	{
		if(!DonationLightboxHelpers.readCookie("newmedia_program_new"))
			DonationLightboxHelpers.createCookie("newmedia_program_new",1,1);
	}
		
	$("body").append('<div id="hidden"><div id="globe"><div class="lightbox_close" onclick="DonationLightboxHelpers.hideLightbox()"></div><iframe id="donation_iframe" frameborder="0" src="'+donationFrameUrl+'" style="border:0px; margin:0px; height:630px; width:811px" scrolling="no"></iframe></div></div>');		




	
	$("body").css("overflow","auto");	
	
	$.lightbox.showDom('#globe', { speed: 'slow', width: 811, height: 630, opacity: 0.8, closecallback: function(closer){if(typeof sendToFriendLightboxContent != "undefined") SendToFriendLightbox.setLightBox() } }, function(){if(typeof lightboxIsVisibileHandler == "function")lightboxIsVisibileHandler() });

});



