function MM_findObj(n, d) { //v4.0
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
	
function textCounter( field, countfield, maxlimit ) {
	if( field.value.length > maxlimit )
		{
		field.value = field.value.substring( 0, maxlimit );
		alert('Warning!\nYou have exceeded the maximum character length for this field.\nYour text may be truncated.');
		}
	else 
		countfield.value = maxlimit - field.value.length;
	}
	
	function textCounter2( field, countfield, maxlimit ) {
	if( field.value.length > maxlimit )
		field.value = field.value.substring( 0, maxlimit );
	else 
		MM_findObj(countfield,document).innerHTML = maxlimit - field.value.length + ' characters(s) remaining.';
	}

function deleteDocument(id){

if (confirm('Are you sure you want to delete this file')){
	document.frmDocuments.action='viewDocumentList.asp?deleteID=' + id;
	document.frmDocuments.submit();
	}

	return false;	
	
} 

function confirmDelete(){

	return confirm('Are you sure you want to delete this record?');

}

function ShowProgress()
{
  strAppVersion = navigator.appVersion;
   if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
   {
     winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
    window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
   }
   else
   {
     window.open('<% = barref %>&b=NN','','width=370,height=115', true);
   }
  return true;
}
