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 + 30) + "";
    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></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>\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>\n");
    _w.document.write("<tr><td align='center'><a onclick='javascript:window.close();' href='#' style='color: #000000;'>Close</a></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;
  src = src.replace(/\\/, '/'); // Fix Windows paths

  if (dom) {
    document.getElementById(param2).src=src; 
  } else if (ie) {
    document.all[param2].src = src; 
  }
 
}

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)); 
} 




//PHONE NUMBER
<!-- This script is based on the javascript code of Roman Feldblum (web.developer@programmer.net) -->
<!-- Original script : http://javascript.internet.com/forms/format-phone-number.html -->
<!-- Original script is revised by Eralper Yilmaz (http://www.eralper.com) -->
<!-- Revised script : http://www.kodyaz.com -->

var zChar = new Array(' ', '(', ')', '-', '.');
var maxphonelength = 13;
var phonevalue1;
var phonevalue2;
var cursorposition;

function ParseForNumber1(object){
phonevalue1 = ParseChar(object.value, zChar);
}
function ParseForNumber2(object){
phonevalue2 = ParseChar(object.value, zChar);
}

function backspacerUP(object,e) { 
if(e){ 
e = e 
} else {
e = window.event 
} 
if(e.which){ 
var keycode = e.which 
} else {
var keycode = e.keyCode 
}

ParseForNumber1(object)

if(keycode > 48){
ValidatePhone(object)
}
}

function backspacerDOWN(object,e) { 
if(e){ 
e = e 
} else {
e = window.event 
} 
if(e.which){ 
var keycode = e.which 
} else {
var keycode = e.keyCode 
}
ParseForNumber2(object)
} 

function GetCursorPosition(){

var t1 = phonevalue1;
var t2 = phonevalue2;
var bool = false
for (i=0; i<t1.length; i++)
{
if (t1.substring(i,1) != t2.substring(i,1)) {
if(!bool) {
cursorposition=i
bool=true
}
}
}
}

function ValidatePhone(object){

var p = phonevalue1

p = p.replace(/[^\d]*/gi,"")

if (p.length < 3) {
object.value=p
} else if(p.length==3){
pp=p;
d4=p.indexOf('(')
d5=p.indexOf(')')
if(d4==-1){
pp="("+pp;
}
if(d5==-1){
pp=pp+")";
}
object.value = pp;
} else if(p.length>3 && p.length < 7){
p ="(" + p; 
l30=p.length;
p30=p.substring(0,4);
p30=p30+")"

p31=p.substring(4,l30);
pp=p30+p31;

object.value = pp; 

} else if(p.length >= 7){
p ="(" + p; 
l30=p.length;
p30=p.substring(0,4);
p30=p30+")"

p31=p.substring(4,l30);
pp=p30+p31;

l40 = pp.length;
p40 = pp.substring(0,8);
p40 = p40 + "-"

p41 = pp.substring(8,l40);
ppp = p40 + p41;

object.value = ppp.substring(0, maxphonelength);
}

GetCursorPosition()

if(cursorposition >= 0){
if (cursorposition == 0) {
cursorposition = 2
} else if (cursorposition <= 2) {
cursorposition = cursorposition + 1
} else if (cursorposition <= 5) {
cursorposition = cursorposition + 2
} else if (cursorposition == 6) {
cursorposition = cursorposition + 2
} else if (cursorposition == 7) {
cursorposition = cursorposition + 4
e1=object.value.indexOf(')')
e2=object.value.indexOf('-')
if (e1>-1 && e2>-1){
if (e2-e1 == 4) {
cursorposition = cursorposition - 1
}
}
} else if (cursorposition < 11) {
cursorposition = cursorposition + 3
} else if (cursorposition == 11) {
cursorposition = cursorposition + 1
} else if (cursorposition >= 12) {
cursorposition = cursorposition
}

var txtRange = object.createTextRange();
txtRange.moveStart( "character", cursorposition);
txtRange.moveEnd( "character", cursorposition - object.value.length);
txtRange.select();
}

}

function ParseChar(sStr, sChar)
{
if (sChar.length == null) 
{
zChar = new Array(sChar);
}
else zChar = sChar;

for (i=0; i<zChar.length; i++)
{
sNewStr = "";

var iStart = 0;
var iEnd = sStr.indexOf(sChar[i]);

while (iEnd != -1)
{
sNewStr += sStr.substring(iStart, iEnd);
iStart = iEnd + 1;
iEnd = sStr.indexOf(sChar[i], iStart);
}
sNewStr += sStr.substring(sStr.lastIndexOf(sChar[i]) + 1, sStr.length);

sStr = sNewStr;
}

return sNewStr;
} 