
// Example:

// alert( readCookie("myCookie") );

function readCookie(name)

{

  var cookieValue = "";

  var search = name + "=";

  if(document.cookie.length > 0)

  { 

    offset = document.cookie.indexOf(search);

    if (offset != -1)

    { 

      offset += search.length;

      end = document.cookie.indexOf(";", offset);

      if (end == -1) end = document.cookie.length;

      cookieValue = unescape(document.cookie.substring(offset, end))

    }

  }

  return cookieValue;

}

// Example:

// writeCookie("myCookie", "my name", 24);

// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours, path)

{

  var expire = "";

  if(hours != null)

  {

    expire = new Date((new Date()).getTime() + hours * 3600000);

    expire = "; expires=" + expire.toGMTString();

  }
  if(path!=null)
  {
	   path = "; path=" + path;
  }

  document.cookie = name + "=" + escape(value) + expire + path;

}
function showpop(id)
{
//kiem tra cookie coi co chua
var popup=readCookie("popup123");

if(popup==null || popup=="")
{
	writeCookie("back",id,3,"/");	
	writeCookie("popup123","1",3,"/");
	var agreewin=dhtmlmodal.open("agreebox", "iframe", "/surveyattention_people.html", "Tell Us About Your Situation", "width=500px,height=300px,center=1,resize=0,scrolling=1", "");
	
	agreewin.onclose=function(){ //Define custom code to run when window is closed
		return true;
	}
}
}


