//COOKIE SETTINGS
 function deleteCookie(name, path, domain)
  {
    if(getCookie(name))
	{
	  document.cookie = name+ "=" + 
	  ((path) ? "; path=" + path : "") +
	  ((domain) ? "; domain=" + domain: "") +
	  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
  }
//	var userid = getCookie("userid")
	//var passwd = getCookie("password")
  function getCookie(name)
  {
    var cookieFound = false;
    var start = 0;
	var end = 0;
	var cookieString = document.cookie;
	var cookieValue;
	var i = 0;
	
	//scan the Cookie for the name
	while (i <= cookieString.length)
	{
	  start = i;
	  end = start + name.length;
	  if(cookieString.substring(start, end) == name)
	  {
	    cookieFound = true;
		break;
	  }
	  i++;
	}
	
	//is name found/
	if(cookieFound)
	{
	  start = end+1;
	  end = document.cookie.indexOf(";",start);
	  if(end < start)
	  end = document.cookie.length;
	  
	  cookieValue = document.cookie.substring(start, end);
	  start = 0;
	  end = cookieValue.indexOf(" ", start);
	  
	  if(end < start)
	  end = cookieValue.length;
	  
	  return cookieValue.substring(start, end);
	}
	return "";
  }

function Set_Cookie(name,value,expires,path,domain,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}