﻿
function textCounter(field, countfield, maxlimit) {
  //alert('hello - ' + field.value);
  if (field.value.length > maxlimit){ 
    field.value = field.value.substring(0, maxlimit);
	countfield.value = maxlimit - maxlimit;
  }
  else
    countfield.value = maxlimit - field.value.length;
}

function DelCmpny(unid, name)
{
    if(confirm('Are you sure you want to DELETE the Company ' + name +'?'))
        window.location = '/Admin/Index.aspx?act=DelCompany&CmpnyID=' + unid;
}

function openHelpWin(URL) {
  HistoryWin=window.open(URL,"Help","scrollbars=yes,resizable=no,toolbar=no,location=no,menubar=no,screenX=150,screenY=100,width=700,height=300");
	HistoryWin.focus();
}

function CloseWinIfEsc(e) // note: takes the event as an arg (IE doesn't)
{
    if (!e) e = window.event; // fix IE

    if (e.keyCode) // IE
    {
        if (e.keyCode == "27")
            window.close();
    }
    else if (e.charCode) // Netscape/Firefox/Opera
    {
        // MUST OPEN about:config in FIREFOX and set userpref dom.allow_scripts_to_close_windows to true
        if (e.charCode == "27")
            window.close();
    }
}
