
//Copied from Weeks Login_Body.jsp to NOT BREAK EXISTING CODE
//This method creates a cookie valid for one year.
function SetCookie(cookieName,cookieValue) {
        


	deleteCookie(cookieName);
	var today = new Date();
	var expire = new Date();
	var nDays = 365;
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue)
   	           + ";expires="+expire.toGMTString();
}



//Always pass valid cookieName, cookieValue
//Pass null for cookiePath if you want to use the 
//default(i.e path of page from where this was called)
//If lifeInDays is passed as null, it is defaulted to null
function SetCookie(cookieName,cookieValue,cookiePath,lifeInDays) {

    
    deleteCookie(cookieName);
    var today = new Date();
    var expire = new Date();
    var nDays = 1;
    var path  = "";

    if (lifeInDays !=null && (lifeInDays>0) )
        nDays = lifeInDays;

     expire.setTime(today.getTime() + 3600000*24*nDays);
     
     if (cookiePath != null)
           path = cookiePath;




     
     var cookieDomain  = "";
     if (typeof(gFpcDom)!="undefined" && (gFpcDom!="") ) 
     {
        //gFpc is configured
        cookieDomain = ';domain=' + gFpcDom; 
     } 


     document.cookie = cookieName+"="+escape(cookieValue)
                       + ";expires="+expire.toGMTString()
                       + ";path=" + path + cookieDomain;
	 //alert(document.cookie);

}


//Deletes (or actually expires) an existing cookie
function deleteCookie (cookie_name) {

  
  var cookie_date = new Date();  // current date & time
  cookie_date.setTime( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();	
  //alert("Deleted "+cookie_name);
}

function SetMNCookie(cookieName,cookieValue,cookiePath) {

    //alert("cookieName :: "+cookieName+" :: / :: cookieValue :: "+cookieValue );
    deleteCookie(cookieName);
    if (cookiePath != null)
           path = cookiePath;
 
    var cookieDomain  = "";//preceding . is required as indicated in Cookie Manual

	 //alert("escape(cookieValue)" +escape(cookieValue));
	 //alert("cookieName+'='+escape(cookieValue) + ';expires='+expire.toGMTString();path=' +path+';domain='+cookieDomain; :: "+cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString()+";path=" +path+";domain="+cookieDomain )
     document.cookie = cookieName+"="+cookieValue+ ";path=" +path+";domain=.rci.com";
	 //alert (document.cookie);
}

