function moveOver(aBox,cBox)  
{
   var boxLength = cBox.length;
   var selectedItem = aBox.selectedIndex;
   var selectedText = aBox.options[selectedItem].text;
   var selectedValue = aBox.options[selectedItem].value;
   var arrLookup = new Array();
   var arrTbox = new Array();
   var i;
   var isNew = true;
   if (boxLength != 0) {
      for (i = 0; i < boxLength; i++) {
         thisitem = cBox.options[i].text;
         if (thisitem == selectedText) {
            isNew = false;
            break;
         }
		 else {
           arrLookup[cBox.options[i].text] = cBox.options[i].value;
           arrTbox[i] = cBox.options[i].text;
//           alert(i+"-"+arrLookup[cBox.options[i].text]+"-"+cBox.options[i].text);
         }
	  }
   } 
   if (isNew) {
      if (boxLength != 0) {
         var tLength = arrTbox.length;
	     arrTbox[tLength] = selectedText;
		 arrLookup[arrTbox[tLength]] = selectedValue;

         arrTbox.sort();

	     boxLength = 0;
         var c;
         for(c = 0; c < arrTbox.length; c++) 
         {
            var no = new Option();
            no.value = arrLookup[arrTbox[c]];
            no.text = arrTbox[c];
            cBox.options[c] = no;
         }
      }
	  else {
         newoption = new Option(selectedText, selectedValue);
         cBox.options[boxLength] = newoption;
	//	 alert(selectedText+"-"+selectedValue);
	  }
   }
   aBox.selectedIndex=-1;
}


function removeMe(cBox) 
   {
   var boxLength = cBox.length;
   arrSelected = new Array();
   var count = 0;
   for (i = 0; i < boxLength; i++) {
      if (cBox.options[i].selected) {
         arrSelected[count] = cBox.options[i].value;
      }
      count++;
   }
   var x;
   for (i = 0; i < boxLength; i++) {
      for (x = 0; x < arrSelected.length; x++) {
         if (cBox.options[i].value == arrSelected[x]) {
            cBox.options[i] = null;
         }
      }
      boxLength = cBox.length;
   }
}

function removeAll(cBox) 
   {
   var boxLength = cBox.length;
   arrSelected = new Array();
   var count = 0;
   for (i = 0; i < boxLength; i++) {
      arrSelected[count] = cBox.options[i].value;
      count++;
   }
   for (i = 0; i < boxLength; i++) {
      for (x = 0; x < arrSelected.length; x++) {
         if (cBox.options[i].value == arrSelected[x]) {
            cBox.options[i] = null;
         }
      }
	  boxLength = cBox.length
   }
}

function addMe(aBox,cBox) 
   {
   var aboxLength = aBox.length;
   var arrSelectedText = new Array();
   var arrSelectedValue = new Array();
   var arrTbox = new Array();
   var arrLookup = new Array();
   var count = 0;
   var x;
   for (i = 0; i < aboxLength; i++) {
      if (aBox.options[i].selected) {
         arrSelectedText[count] = aBox.options[i].text;
         arrSelectedValue[count] = aBox.options[i].value;
		 arrLookup[arrSelectedText[count]] = arrSelectedValue[count];
         count++;
      } 
   }
   var cBoxLength = cBox.length;
   if (cBoxLength !=0) {
      for (i = 0; i < cBoxLength; i++) {
	     isNew = true;
         for (j = 0; j < arrSelectedText.length; j++) {
            thisitem = cBox.options[i].text;
			if (thisitem == arrSelectedText[j]) {
			   isNew = false;
               break;
            }
		 }
		 if (isNew) {
			arrLookup[cBox.options[i].text] = cBox.options[i].value;
			arrSelectedText[count] = cBox.options[i].text;
			count++;
		 }
	  }
   }
   arrSelectedText.sort();
   cBoxLength = 0;
   var c
   for (c = 0; c < arrSelectedText.length; c++) {
      var newoption = new Option();
      newoption.value = arrLookup[arrSelectedText[c]];
	  newoption.text = arrSelectedText[c];
	  cBox.options[c] = newoption;
   }
   aBox.selectedIndex=-1;
}

function saveMe()
{
   var strValuesC = "";
   var counti = 0;
   var boxLengthC = document.choiceForm.choiceBoxC.length;
   var countC = 0;
   if (boxLengthC != 0) {
      for (i = 0; i < boxLengthC; i++) {
         if (countC == 0) {
            strValuesC = document.choiceForm.choiceBoxC.options[i].value;
         }
         else {
            strValuesC = strValuesC + ", " + document.choiceForm.choiceBoxC.options[i].value;
         }
         countC++;
      }
   }
   if (strValuesC.length == 0) {
  //    alert("You have not made any selections");
   }
   else {
   document.choiceForm.Country.value = strValuesC;
   }
   var strValuesY = "";
   var boxLengthY = document.choiceForm.choiceBoxY.length;
   var countY = 0;
   if (boxLengthY != 0) {
      for (i = 0; i < boxLengthY; i++) {
         if (countY == 0) {
            strValuesY = document.choiceForm.choiceBoxY.options[i].value;
         }
         else {
            strValuesY = strValuesY + "," + document.choiceForm.choiceBoxY.options[i].value;
         }
         countY++;
      }
   }
   if (strValuesY.length == 0) {
 //     alert("You have not made any selections");
   }
   else {
   document.choiceForm.Year.value = strValuesY;
   }
}

function saveMeC()
{
   var strValuesC = "";
   var boxLengthC = document.choiceForm.choiceBoxC.length;
   var countC = 0;
   if (boxLengthC != 0) {
      for (i = 0; i < boxLengthC; i++) {
         if (countC == 0) {
            strValuesC = document.choiceForm.choiceBoxC.options[i].value;
         }
         else {
            strValuesC = strValuesC + ", " + document.choiceForm.choiceBoxC.options[i].value;
         }
         countC++;
      }
   }
   if (strValuesC.length == 0) {
  //    alert("You have not made any selections");
   }
   else {
   document.choiceForm.Country.value = strValuesC;
   }
}

function saveMeY()
{
   var strValuesY = "";
   var boxLengthY = document.choiceForm.choiceBoxY.length;
   var countY = 0;
   if (boxLengthY != 0) {
      for (i = 0; i < boxLengthY; i++) {
         if (countY == 0) {
            strValuesY = document.choiceForm.choiceBoxY.options[i].value;
         }
         else {
            strValuesY = strValuesY + "," + document.choiceForm.choiceBoxY.options[i].value;
         }
         countY++;
      }
   }
   if (strValuesY.length == 0) {
 //     alert("You have not made any selections");
   }
   else {
   document.choiceForm.Year.value = strValuesY;
   }
}

function openMe(newin) {
        flyout=window.open(newin,"term","resizable=np,scrollbars=yes,width=375,height=150,top=250,left=250");
        flyout.focus();
 }

function openMe2(newin) {
        flyout=window.open(newin,"term","resizable=np,scrollbars=no,width=375,height=250,top=0,left=0");
        flyout.focus();
 }

function openMe3(newin) {
        flyout=window.open(newin,"term","resizable=np,scrollbars=no,width=525,height=220,top=0,left=0");
        flyout.focus();
 }

function checkAll(checkname, exby) {
  for (i = 0; i < checkname.length; i++)
  checkname[i].checked = exby.checked? true:false
}

function go(loc) {
window.location.href = loc;
}

function ShowText(id) { 
document.getElementById(id).style.display = 'block'; 
} 
function HideText(id) { 
document.getElementById(id).style.display = 'none'; 
} 



