<!--


function thisConfirmDelete( message)
{
  if (message=="null" || !message){
message="This will remove this entry.  \r\n\r\nAre you sure you wish to remove this entry?";
}
var deleteEntry=confirm(message);
if (deleteEntry) return true ;
else return false ;
}


function updateList(d,u,a, highlightFromList) {
      var i = 0,j=0;
      var limit=null;
      var to;
      var from;
         if (d == 1) {
               to =   u.options;
               from = a.options;
            } else {
               to =   a.options;
               from = u.options;
            }
      var tlength = 0;
      if (to && to.length)tlength=to.length
      var flength = 0;
      if (from && from.length)flength=from.length

      var list = new Array(); 
      var newlist = new Array();

      for (i=0;i<flength;i++) {
         if (from[i] == null) continue;
         if (from[i].selected) {
            if (!d && limit && limit < tlength+1) { flimit=1; list[j] = i;j++; continue; }
            to[tlength]  = new Option(from[i].text,from[i].value);
            tlength++;
         } else {
            list[j] = i; 
            j++;
         }
      }

      //-- save from list 
      for (i=0,j=0;i<list.length;i++,j++) {
         newlist[j] = new Option(from[list[i]].text,from[list[i]].value);
      }

      //-- zero out the from list 
      from.length = 0;

      //-- repopulate the from list 
      for (i=0,j=0;i<newlist.length;i++,j++) {
         from[j] = new Option(newlist[i].text,newlist[i].value);
         //if(highlightFromList==true) from[j].selected=true;
      }
      
   }


function addOption(obj, name,val){
	var length=obj.options.length;
	var opt= new Option(name,val);
	obj.options[length]=opt;
}

//add and select an option
function addSelectOption(obj, name,val){
	var length=obj.options.length;
	var opt= new Option(name,val);
	opt.selected=true;
	obj.options[length]=opt;
}

function moveOptionUp(obj){
  var length=obj.options.length;
  var newOpts=new Array();
  var index=-1;
  //find the index of the object to move
  for (i=0; i<length; i++){
        if (obj.options[i].selected==true){
            index=i;
  	    break;
        }
  }
  if (index<=0) return;
  
  for (i=0; i<index-1; i++){  	
   newOpts[i]=new Option(obj.options[i].text,obj.options[i].value);
  }
  newOpts[index-1]=new Option(obj.options[index].text,obj.options[index].value);
  newOpts[index]=new Option(obj.options[index-1].text,obj.options[index-1].value);
  for (i=index+1; i<length; i++){  	
     newOpts[i]=new Option(obj.options[i].text,obj.options[i].value);
  }
  for (var j=0; j<length; j++){
    	obj.options[j]=newOpts[j];
  	}
  obj.options[index-1].selected=true;
}

function moveOptionDown(obj){
  var length=obj.options.length;
  var newOpts=new Array();
  var index=-1;
  //find the index of the object to move
  for (i=0; i<length; i++){
        if (obj.options[i].selected==true){index=i;
  		break;
        }
  }
  if (index<0) return;
  if (index==length-1)return;
  
  for (i=0; i<index; i++){ 
   newOpts[i]=new Option(obj.options[i].text,obj.options[i].value);
  }
  newOpts[index+1]=new Option(obj.options[index].text,obj.options[index].value);
  newOpts[index]=new Option(obj.options[index+1].text,obj.options[index+1].value);
  for (i=index+2; i<length; i++){  	
     newOpts[i]=new Option(obj.options[i].text,obj.options[i].value);
  }
  for (var j=0; j<length; j++){
  	obj.options[j]=newOpts[j];
  	}
  obj.options[index+1].selected=true;
}


function removeSelectOption(obj, val){
  var length=obj.options.length;
  var newOpts=new Array();
  var count=0;
   for (i=0; i<length; i++){
      if (obj.options[i].value== val){}
      else{
      	newOpts[count]=obj.options[i];
      	count=count+1;
      }
   }
  obj.options.length=0;
  for (j=0;j<newOpts.length;j++) {
    obj.options[j]=newOpts[j];
  }
}

function removeOptions(obj){
  var length=obj.options.length;
  var newOpts=new Array();
  var count=0;
   for (i=0; i<length; i++){
      if (obj.options[i].selected == true){}
      else{
      	newOpts[count]=obj.options[i];
      	count=count+1;
      }
   }
  obj.options.length=0;
  for (j=0;j<newOpts.length;j++) {
    obj.options[j]=newOpts[j];
  }
}



function selectAll(field){
var opt=field.options;
      if (opt.length==0) opt[opt.length]=new Option('',0);
      for (i=0;i<opt.length;i++) {opt[i].selected=true;}
}

function processCheck(checkVal, obj, name,val){

if (checkVal==true){
addSelectOption(obj,name,val);
}
else {
removeSelectOption(obj,val);
}
}



function hideLayer(whichLayer) {

if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "hidden";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "hidden";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "hidden";
}

}

function showLayer(whichLayer) {

if (document.getElementById) {
// this is the way the standards work
document.getElementById(whichLayer).style.visibility = "visible";
}
else if (document.all) {
// this is the way old msie versions work
document.all[whichlayer].style.visibility = "visible";
}
else if (document.layers) {
// this is the way nn4 works
document.layers[whichLayer].visibility = "visible";
}

}


function addField (form, fieldType, fieldName, fieldValue) {
  if (document.getElementById) {
    var input = document.createElement('INPUT');
      if (document.all) { // what follows should work 
                          // with NN6 but doesn't in M14
        input.type = fieldType;
        input.name = fieldName;
        input.value = fieldValue;
        input.size=1;
      }
      else if (document.getElementById) { // so here is the
                                          // NN6 workaround
        input.setAttribute('type', fieldType);
        input.setAttribute('name', fieldName);
        input.setAttribute('value', fieldValue);
        input.setAttribute('style','visibility:hidden;');
      }
    form.appendChild(input);
  }
}

function IsFormComplete(theForm, ids)
	{

	var FormOk  = true

	for (var i=0; i<ids.length; i++)
	   {
	     if (theForm.elements[ids[i]].value == '')
	     {
	        alert('Not all required data has been entered.  Please enter all required values');
	        theForm.elements[ids[i]].focus()
	        FormOk = false
	        break;
	     }

	   }
	return FormOk
	}


//Retrieve the parameter from the url
function getParameter (parameterName ) {

var temp = window.location.href.split("?");
if (temp.length<=1) {return '';}
var queryString = temp[1];

// Add "=" to the parameter name (i.e. parameterName=value)
var parameterName = parameterName + "=";
if ( queryString.length > 0 ) {
// Find the beginning of the string
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 ) {
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 ) {
end = queryString.length
}
// Return the string
return unescape ( queryString.substring ( begin, end ) );
}
// Return "null" if no parameter has been found
return '';
}
}

-->

