var bikky = document.cookie;
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days

function getCookie(name) {
  var index = bikky.indexOf(name + "=");
  if (index == -1) return null;
  index = bikky.indexOf("=", index) + 1;
  var endstr = bikky.indexOf(";", index);
  if (endstr == -1) endstr = bikky.length;
  return unescape(bikky.substring(index, endstr));
}

function setCookie(name, value) {
  document.cookie=name + "=" + escape(value) + "; expires=" + expiry.toGMTString();
  bikky = document.cookie;
}

function deleteCookie(name) {
  document.cookie=name + "=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
  bikky = document.cookie;
}

function object(name) {
  if (document.all) return document.all(name);
  else if (document.getElementById) return document.getElementById(name);
  else return eval('document.'+name);
}

function number_format(value, decimals) {
  return Math.round(value * Math.pow(10, decimals)) / Math.pow(10, decimals);
}

function price_format(value) {
  value = number_format(value, 2).toString();
  if (value.search(/[.][0-9]$/) >= 0) return '$' + value + '0';
  else if (value.search(/[.]/) == -1) return '$' + value + '.00';
  else return '$' + value;
}

