  // Set a cookie and redirect to a location
  function setCookieAndGo(cookieName, cookieValue, url,c2,v2) {
    document.cookie = cookieName + '=' + escape(cookieValue) + ';path=/';
    if(c2) {
        document.cookie = c2 + '=' + escape(v2) + ';path=/';
    }
    document.location = url;
    
    
    return;
  }
  
  // Just set a cookie 
  function setCookie(cookieName, cookieValue) {
    document.cookie = cookieName + '=' + escape(cookieValue) + ';path=/';
    return;
  }

  // Returns the cookie value or null if not found
  function getCookie(name) {
    var cookies = document.cookie.split(';');
    var namexpr = new RegExp('^\\s*'+name+'(=|$)');   // ugly hack. Thanks, IE!
    for (var i = 0; i < cookies.length; i++) {
      var cookie = cookies[i];
      if (cookie.match(namexpr)) return unescape(cookie.replace(namexpr, ''));
    }
    return null;
  }


  // this deletes the cookie when called
  function delCookie( name) {
    document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT";
}  

  function openModalWindow(url,window_features,height,width,window_title) {
      if(!window_features){
          window_features = 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,dependent=1,width=' + width + ',height=' + height;    
      }
      popup = window.open(url, window_title, window_features);    
    return;
  }
  

