﻿function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


function setCookie(szName, szValue, szExpires, szPath, szDomain, bSecure)
{
 	var szCookieText = 	   escape(szName) + '=' + escape(szValue);
	szCookieText +=	 	   (szExpires ? '; EXPIRES=' + szExpires.toGMTString() : '');
	szCookieText += 	   (szPath ? '; PATH=' + szPath : '');
	szCookieText += 	   (szDomain ? '; DOMAIN=' + szDomain : '');
	szCookieText += 	   (bSecure ? '; SECURE' : '');
	
	document.cookie = szCookieText;
}

function getCookie(szName)
{
 	var szValue =	  null;
	if(document.cookie)	   //only if exists
	{
       	var arr = 		  document.cookie.split((escape(szName) + '=')); 
       	if(2 <= arr.length)
       	{
           	var arr2 = 	   arr[1].split(';');
       		szValue  = 	   unescape(arr2[0]);
       	}
	}
	return szValue;
}

function deleteCookie(szName)
{
 	var tmp = 	  			 	 getCookie(szName);
	if(tmp) 
	{ setCookie(szName,tmp,(new Date(1))); }
}


//function popup_window() {
//	// Create the popup
//	var w = window.open('', 'Survey_Invite', 'width=300, height=200, menubar=no, scrollbars=no, toolbar=no, location=no, resizable=yes, top=250, left=300');
//	var d = w.document;
//	// Create the popup's html
//	d.write("<head><title>Take a survey</title></head>");
//	d.write("<body>");
//	
//	// BEGINNING OF POPUP TEXT CONTENT
//	d.write("<b>Before You Go, Let Us Know!</b><br><br>");
//	d.write("We know you’re busy, but your feedback is important to us…and to other moms. We’d love to hear what you think of our site. Plus, fill us in on the foods your picky eater says \"No way!\" to.<br>");
//	d.write("<div style=\"background-color:Transparent; cursor: pointer; border:0 none;color:#24A5DC;font-family:Trebuchet MS;font-size:1.1em;font-weight:normal;letter-spacing:normal;line-height:1.3em;text-align:left;text-decoration:underline;text-transform:none;\" onclick=\"window.open('http://surveyimpact.com/SE/?SID=SV_eRRTAdAhf49GDxq&SVID=Prod&Preview=Survey&BrandID=abbottnutrition'); self.close();\">Share what’s on your mind ></div><br>");
//	// END OF POPUP TEXT CONTENT
//	
//	d.write("</div>");
//	d.write("</form>");
//	d.write("</body>");
//}


