Index: splash.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/splash/splash.module,v
retrieving revision 1.1
diff -u -r1.1 splash.module
--- splash.module	16 Nov 2007 12:04:15 -0000	1.1
+++ splash.module	2 Feb 2008 17:45:47 -0000
@@ -20,11 +20,17 @@
   	$splash		= TRUE;
   	$redirect	= variable_get('splash_redirect', '');
   	$cookie		= variable_get('splash_cookie', 'splash');
-
+  	$cookie_popup = variable_get('splash_cookie_popup', 'splash_popup');
+  	
   	// We are not on the front page
   	if (!drupal_is_front_page()) {
   		$splash = FALSE;
-  		
+  		  		
+  	// Popup that doesnt require a redirect
+  	} elseif ($_COOKIE[$cookie_popup] == 1) {
+  		$splash = FALSE;
+  		splash_popup(0);
+	
   	// We come from an internal page
   	} elseif (($parsed_url = parse_url($base_url)) && stristr(referer_uri(), $parsed_url['host'])) {
   		$splash = FALSE;
@@ -85,4 +91,43 @@
 	return system_settings_form($form);
 }
 
+
+function splash_popup( $state = 1 ) {
+
+	$cookie_popup = variable_get('splash_cookie_popup', 'splash_popup');
+
+	if($state == 1)
+		setcookie($cookie_popup, $state, time() + 3600, '/');
+	else
+		setcookie($cookie_popup, $state, time() - 3600, '/');
+	
+}
+
+/**
+ * @desc add to header of the page-content_type.tpl that contains a popup
+ * @example <?php print splash_js(); ?>
+ */
+
+function splash_js() {
+	
+	$module_path = base_path() . drupal_get_path('module', 'splash');
+
+	$js = '<script type="text/javascript" src="'. $module_path .'/js/cookie.js"></script>';
+
+	return $js;
+}
+/**
+ * @desc add this in the javascript function that handles the popup (before calling window.open())
+ * @example <?php print splash_popup_cookie() ?>
+ */
+
+function splash_popup_cookie() {
+
+	$cookie_popup = variable_get('splash_cookie_popup', 'splash_popup');
+	
+	$js = 'setCookie( "' . $cookie_popup . '", 1, 1, "/" );';
+	
+	return $js; 
+}
+
 ?>
\ No newline at end of file
Index: modules/splash/js/cookie.js
===================================================================
RCS file: modules/splash/js/cookie.js
diff -N modules/splash/js/cookie.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/splash/js/cookie.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,28 @@
+/**
+ * Cookie getter/setter
+ *
+ */
+ 
+function setCookie(c_name, value, expiredays, path)
+{
+	var exdate=new Date();
+	exdate.setDate(exdate.getDate()+expiredays);
+	document.cookie=c_name+ "=" +escape(value)+";path="+path+
+	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
+}
+
+function getCookie(c_name)
+{
+	if (document.cookie.length>0)
+	{
+		c_start=document.cookie.indexOf(c_name + "=");
+	  	if (c_start!=-1)
+	    { 
+		    c_start=c_start + c_name.length+1; 
+		    c_end=document.cookie.indexOf(";",c_start);
+		    if (c_end==-1) c_end=document.cookie.length;
+		    return unescape(document.cookie.substring(c_start,c_end));
+	    }
+	}
+	return "";
+}
