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;
  }
}


function popUpImg(url, pageWidth, pageHeight) {
    var args = "width=" + (pageWidth + 20) + ",height=" + (pageHeight + 10) + "";
    var date = new Date();
    var now = date.getTime();
    var name = (now).toString(10);
    
    _w = window.open('',name,args);
    _w.document.open();
    _w.document.write("<html>\n<head><title>Viewing " + url + "</title>\n");
    _w.document.write("<meta http-equiv='imagetoolbar' content='no'>\n");
    _w.document.write("<link href='screen.css' type='text/css' rel='stylesheet'  media='screen' />\n");
    _w.document.write("<script language='javascript'><!--\n");
    _w.document.write("var i=0;\n");
    _w.document.write("function resize() {\n");
    _w.document.write("if (navigator.appName == 'Netscape') i=40;\n");
    _w.document.write("if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+100-i);\n");
    _w.document.write("self.focus();\n");
    _w.document.write("}\n");
    _w.document.write("//--></script></head>\n");
    _w.document.write("<body onload='resize();'>\n");
    _w.document.write("<table width='100%' border='0' cellpadding='0' cellspacing='0' style='height: 100%'>\n");
    _w.document.write("<tr><td><a href='javascript:window.close()' class='popup'>Close window</a></td></tr>\n");
    _w.document.write("<tr>\n<td align='center' valign='middle'>\n");
    _w.document.write("<a href='javascript:window.close()'><img src='" + url + "' alt='Click to close' border='0' /></a>\n");
    _w.document.write("</td></tr></table>\n");
    _w.document.write("</body>\n</html>");
    _w.document.close();
}
                                                



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 doPreview(param1, param2) {

  if (dom) {
    var src = document.getElementById(param1).value; 
  } else if (ie) {
    var src = document.all[param1].value; 
  }

  if (src.charAt(1)==":") src = "file:/" + src;

  if (dom) {
    document.getElementById(param2).src=src; 
  } else if (ie) {
    document.all[param2].src = src; 
  }
 
}


function doPreview1(param1, param2) {

  if (dom) {
    document.getElementById(param2).src=param1; 
  } else if (ie) {
    document.all[param2].src = param1; 
  }
 
}


function showtranscript(elemId,displayValue) {
  if (dom) {

      if (displayValue) {
         document.getElementById(elemId).style.display = displayValue;
         return 0;
      }

      if (document.getElementById(elemId).style.display == "none") {
         document.getElementById(elemId).style.display = "block";
      } else if (document.getElementById(elemId).style.display == "block") {
         document.getElementById(elemId).style.display = "none";
      } 
      
  } else if (ie) {

    if (displayValue) {
       document.all[elemId].style.display =  displayValue;
       return 0;
    }

    if (document.all[elemId].style.display == "block") {
       document.all[elemId].style.display = "none";
    } else if (document.all[elemId].style.display == "none") {
      document.all[elemId].style.display = "block";
    }

  }
}

function display(cookie_name, id) {
    var template_category_cookie;

    template_category_cookie = GetCookie(cookie_name);

    if (template_category_cookie) {
       SetCookie(cookie_name, "1", expiration, "", "","") 
       showtranscript(id, 'block');
    } else {
       SetCookie(cookie_name, "", expiration, "", "","") 
       showtranscript(id, 'none');
    }

    return true;                            
}


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)); 
} 
