  function getParameter( data, param, delimiter ) 
		{
    var l = ""+data + delimiter;
				if ( l.indexOf(param) < 0 ) return null;
	   l = l.substring( (l.indexOf(param)+param.length+1) );
	   return l.substring(0, (l.indexOf(delimiter)) );
  }		
			
function retrieveCookie( cookieName )
{
	 return getParameter( document.cookie, cookieName, ";" );
}

function setCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure )
{
  if( !cookieName ) return false;
  if ( !lifeTime ) lifeTime = 2140000000;
  else if( lifeTime == "delete" ) lifeTime = -1000;
  document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) + ( lifeTime ? "; expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "; expires=" + ( new Date( "December 31, 2023" ).toGMTString() ) ) + ( path ? "; path=" + path : "; path=/" ) + ( domain ? "; domain=" + domain : "" ) + ( isSecure ? "; secure" : "" );
  if( lifeTime < 0 )
		{
    if( typeof( retrieveCookie( cookieName ) ) == "string" ) return false;
    return true;
		}
  if( typeof( retrieveCookie( cookieName ) ) == "string" ) return true;
  return false;
}

function cleanCookies()
{
//  setCookie( "seltabpk", "", "delete", "/" );
  var ca = document.cookie.split(";");
  var idx=0;
  for ( i=0; i<ca.length; i++)
		{
    if ( (idx=ca[i].indexOf(top.g_frameworkName)) > -1 )
				{
					 var nv = ca[i].split("=");
				  setCookie( nv[0].substring(idx), "", "delete", "/" );//cookie name has leadingspace on every one except first.  So this will trim it off.		
				}
		}
//    if ( (idx=ca[i].indexOf("selmenupk")) > -1 ) setCookie( ca[i].split("=")[0].substring(idx), "", "delete", "/" );
}

function deleteAllCookies()
{
  var ca = document.cookie.split(";");
  for ( i=0; i<ca.length; i++)
		{
			 var nv = ca[i].split("=");
				if ( nv[0].charAt(0) == ' ' ) nv[0] = nv[0].substring(1);
		  setCookie( nv[0], "", "delete", "/" );//cookie name has leadingspace on every one except first.  So this will trim it off.		
		}	
}

function displayCookies()
{
	  var ca = document.cookie.split(";");
var vals="";
  for ( i=0; i<ca.length; i++)
		  vals += ca[i] + "\n";
			alert(vals);
}
		