function createCookie(name, value, days){
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else {
    var expires = "";
  }
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name){
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  
  for(var i=0; i < ca.length; i++) 
  {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
   }
  return null;
}

function eraseCookie(name){
    createCookie(name, "", -1);
}

function paginationCookieHandle(name, value, days){
    if (readCookie(name) != null){
        // Erase old cookie
        createCookie(name, "", -1);
        // Create a new cookie with the new value
        createCookie(name, value, days);
    }
    else
    {
        createCookie(name, value, days);
    }
}

function checkFlash() {
    if ((navigator.appName == "Microsoft Internet Explorer" &&
	        navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) ||

	        (navigator.plugins) && (navigator.plugins["Shockwave Flash"] || navigator.plugins["Shockwave Flash 2.0"])) {
        //Load a pre-defined HTML page with Flash Player in it into the browser window.
    }
    else {
        //Load a pre-defined HTML page without Flash Player into the browser window.
        window.location = document.location.href + '?noflash=1'
    }
}

