function confirm_del() {
  var reply = confirm("This will permanantly delete this record! You can't restore it in future.");

  if (reply) {
     return true;
  } else {
     return false;
  }
}

opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
ie = (document.all && !opera)? true : false;
dom = (document.getElementById && !ie && !opera)? true : false;

var expiration = new Date();
expiration.setTime(expiration.getTime() + 3600*3600*3600);




function onCookieChange(cookie_name, id) {
     if (dom) {
      if (document.getElementById(id).style.display == "none") {
         SetCookie(cookie_name, "", expiration, "", "","")
      } else if (document.getElementById(id).style.display == "block") {
         SetCookie(cookie_name, "1", expiration, "", "","")
      }

  } else if (ie) {

    if (document.all[id].style.display == "block") {
       SetCookie(cookie_name, "1", expiration, "", "","")
    } else if (document.all[id].style.display == "none") {
       SetCookie(cookie_name, "", expiration, "", "","")
    }

  }
}


function SetCookie(name, value, expires, path, domain, secure) {

   var mycookie = name + "=" + escape(value);
   var myexpires = new Date();
   myexpires.setTime(myexpires.getTime() + 5000);
   mycookie = mycookie + "; myexpires=" + myexpires.toGMTString();
   document.cookie = mycookie;
}


function GetCookie(name) {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;

   while (i < clen) {
     var j = i + alen;
     if (document.cookie.substring(i, j) == arg)  return getCookieVal (j);
     i = document.cookie.indexOf(" ", i) + 1;
     if (i == 0) break;
   }

   return null;
}


function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function trim( str ) {  
     return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}  
