/**
 * popWinName    the Cookie name. need the same as the other javascript phishing_alert_popup.js under 
 *               singapore_51\content\core\Main_Contents\HUB_PIB\IDV\js
 * popWinNameValue       the value of the Cookie. Must the same as the other javascript phishing_alert_popup.js under 
 *                       singapore_51\content\singapore\personal\services\phishing_alert\js
 * year          year of expire date
 * month         month of expire date
 * day           day of expire date
 *
 * Method to trigger the Phising aler page again:
 * 1. change the cookie name popWinName to another, and also do the same thing at phishing_alert_popup.js.
 * 2. change the value of the cookie popWinNameValue, and also for the phishing_alert_popup.js.
 *
 */

var popWinName = "PopupPhishingAlert";
var popWinNameValue = "20080515used";
var year=2020;
var month=00;
var day=01;

/**
 * Deal with the cookie when the input box checked add the cookie, or delete the cookie.
 */
function ifCookieStore()
{
	if(document.StoreCookie.Cookie.checked==true)
	{	
		setCookie(popWinName,popWinNameValue,new Date(year, month, day), "/");
	}
	else
	{
		deleteCookie(popWinName, "/");
	}
}

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Delete the Cookie with the given name and path
 *
 * name       Name of the cookie
 * [path]     Path where the cookie is valid (default: path of calling document)
 */
function deleteCookie(name, path) {
	var tempCookie=document.cookie;
	var passDate=new Date();
	passDate.setTime(passDate.getTime()-10000);
	if (tempCookie!=null)
	{
		setCookie(name, "deleted", passDate, path) 
	}
} 
