function executeEvent(object_name, action_name, param1, param2, param3, param4)
{
	if (!param1) param1 = "";
	if (!param2) param2 = "";
	if (!param3) param3 = "";
	if (!param4) param4 = "";

	document.forms['wapp']._object.value = object_name;
	document.forms['wapp']._action.value = action_name;
	document.forms['wapp'].param1.value = param1;
	document.forms['wapp'].param2.value = param2;
	document.forms['wapp'].param3.value = param3;
	document.forms['wapp'].param4.value = param4;

	if (typeof document.forms['wapp'].onsubmit == "function") {
		document.forms['wapp'].onsubmit();
	}
	document.forms['wapp'].submit();
}


function checkboxToggle(elmid) {
 var elm = document.getElementById(elmid);
 if (elm) {
	elm.checked=!(elm.checked);
 }


}

function checkEnter(e){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
return true 
}
else{
return false 
}

}



// Dual list move function
function moveDualList( srcList, destList, moveAll, keepSource, noDuplicates) 
{
  //if (!keepSource) { keepSource=false; }
  srcList = (typeof srcList == "string") ? document.getElementById(srcList) : srcList;
  destList = (typeof destList == "string") ? document.getElementById(destList) : destList;
  // Do nothing if nothing is selected
  if (  ( srcList.selectedIndex == -1 ) && ( moveAll == false ) ){
     return;
  }

  if (document.all) {
  	var destLength=destList.length;
  	var srcLength=srcList.length;
  } else {
  	var destLength=destList.options.length;
  	var srcLength=srcList.options.length;
  }

  newDestList = new Array( destLength );
  var len = 0;

  for( len = 0; len < destLength; len++ )  {
    if ( destList.options[ len ] != null )   {
      newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
    }
  }

  for( var i = 0; i < srcLength; i++ ) { 
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )  {
        noinsert=false;
  	for( var i2 = destLength - 1; i2 >= 0; i2-- )   { 
    		if ( destList.options[i2] != null && ( destList.options[i2].value == srcList.options[i].value ) )  {
    			noinsert=(noDuplicates && true);
    		}
     	}
       // Statements to perform if option is selected
       // Incorporate into new list
       if (!(noinsert)) {
		newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );
         	len++;
       }
    }
  }

  // Populate the destination with the items from the new array
  for ( var j = 0; j < newDestList.length; j++ )  {
    if ( newDestList[ j ] != null )  {
      destList.options[ j ] = newDestList[ j ];
    }
  }

  // Erase source list selected elements
  for( var i = srcLength - 1; i >= 0; i-- )   { 
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )  {
       // Erase Source
       //srcList.options[i].value = "";
       //srcList.options[i].text  = "";
  	if (!(keepSource)) {
       		srcList.options[i]       = null;
  	} else {
       		srcList.options[i].selected       = false;
	}
    }
  }


} // End of moveDualList()


function deleteSelectedOptions ( srcList ) {
  srcList = (typeof srcList == "string") ? document.getElementById(srcList) : srcList;
  for( var i = srcList.length - 1; i >= 0; i-- )   { 
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true ) )  {
        srcList.options[i]       = null;
    }
  }
}

function addSelectOption( selectElement, optionText, optionValue )
{
	var oOption = document.createElement("OPTION") ;

	oOption.text	= optionText ;
	oOption.value	= optionValue ;	

	selectElement.options.add(oOption) ;

	return oOption ;
}

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;
}
 
