function SetFocus(controlToFocus)
{
document.all(controlToFocus).focus();
}
function confirm_delete()
{
if (confirm("Are you sure you want to delete this item?")==true)
return true;
else
return false;
}
function canAddCharacter(textarea, maxChars) 
{ 
     if(typeof(textarea.onkeypress.arguments[0]) != 'undefined') 
          var keyCode = textarea.onkeypress.arguments[0].keyCode; 
     else 
     { 
          if(document.selection.createRange().text.length != 0) return true; 
          var keyCode = event.keyCode; 
     } 

     var allowedChars = new Array(8, 37, 38, 39, 40, 46);     //Backspace, delete and arrow keys 
     for(var x=0; x<allowedChars.length; x++) if(allowedChars[x] == keyCode) return true; 

     if(textarea.value.length < maxChars) return true; 

     return false; 
}
function trimLength(textarea, maxChars) 
{ 
     if(textarea.value.length <= maxChars) return; 

     textarea.value = textarea.value.substr(0, maxChars) 
}
function openWindow(url) 
{ 
var newWin = window.open(url, 'newWin'); 
}

//toggles a div to be visible or not
		
function toggleLayer(whichLayer)
{
    if (document.getElementById)
    {
        // this is the way the standards work
        var style2 = document.getElementById(whichLayer).style;
        style2.display = style2.display? "":"block";
    }
    else if (document.all)
    {
        // this is the way old msie versions work
        var style2 = document.all[whichLayer].style;
        style2.display = style2.display? "":"block";
    }
    else if (document.layers)
    {
        // this is the way nn4 works
        var style2 = document.layers[whichLayer].style;
        style2.display = style2.display? "":"block";
    }
}