// Java Scripts Inserted into each Page
function refreshParent() {
  window.opener.location.href = window.opener.location.href;
  if (window.opener.progressWindow)
 {
    window.opener.progressWindow.close()
  }
  window.close();
}
function isEmpty(s)
    { return ((s == null) || (s.length == 0)) }
	
function isWhitespace (s)
{
    var i;
    var whitespace = " \t\n\r";
    // Is s empty?
     if (isEmpty(s)) return true;
          // Search through string's characters one by one
          // until we find a non-whitespace character.
          // When we do, return false; if we don't, return true.
          for (i = 0; i < s.length; i++)
           {
                // Check that current character isn't whitespace.
                var c = s.charAt(i);
                if (whitespace.indexOf(c) == -1) return false;
           }
           // All characters are whitespace.
           return true;
}

function badEmail(theEmail) 
{ 
	var sEmail = "" + theEmail; 
	if (sEmail.indexOf('@') == -1) return true; 
	if (sEmail.indexOf('.') == -1) return true; 
} 

//closes window//
function closeWin() {
	window.close();
}

//prints page//
function printPage() {
	window.print();
}

//delete confirmation//
function ConfirmDelete() { 
	if (confirm("Are you sure you want to delete this record?  You will not be able to undo this action.")) { 
		delete_record = true;
		return delete_record;
	} else {  
		delete_record = false;
	    return delete_record;
	}
}

//opens new window//
function newWin(url) {
	window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=650,height=460');
}
//opens new small window//
function newSmallWin(url) {
    window.open(url,'','width=250,height=250,resizeable=no,scrollbars=no,location=no,status=no')
}
//opens new medium window//
function newMedWin(url) {
    window.open(url,'','width=450,height=400,resizeable=no,scrollbars=no,location=no,status=no')
}
//opens new medium window//
function AddrBookWin(url) {
    window.open(url,'','width=500,height=300,resizeable=no,scrollbars=no,location=no,status=no')
}
//opens new PopUp window//
function PopUpWin(url) {
    window.open(url,'','width=550,height=390,resizable=1,scrollbars=yes,location=no,status=no')
}

function bookmarkMe( url, title ) { 
   window.external.addFavorite( url, title ); 
} 

// limit characters in text area
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

