// JavaScript Document

function toggleLayer( whichLayer )
{  
	var elem, vis;  
	if( document.getElementById ) // this is the way the standards work    
		elem = document.getElementById( whichLayer );  
	else if( document.all ) // this is the way old msie versions work      
		elem = document.all[whichLayer];  
	else if( document.layers ) // this is the way nn4 works    
		elem = document.layers[whichLayer];  
	vis = elem.style;  
	// if the style.display value is blank we try to figure it out here  
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)    
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'inline-block':'none';  
		vis.display = (vis.display==''||vis.display=='inline-block')?'none':'inline-block';
}

var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
 browserType= "gecko"
}

function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

function setFocus( whichLayer )
{
     document.getElementById( whichLayer ).focus();
}

function switchclass(id, newClass) {
	document.getElementById(id).className = newClass
}

function submitForm ( selectedaction )
{
  document.messages.action.value = selectedaction ;
  document.messages.submit() ;
}

function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}



