// JavaScript Document

 function ClearList(OptionList, TitleName) 
	    {   OptionList.length = 0;
        }
		
		//takes in a value and a list, searches list and returns true if found.
	    function notInList(theValue, theList)
		{
		  for (var i = 0; i < theList.length; i++)
		  {  
		    if (theValue == theList[i].value) 
			{
		      return false;
		    }	
		  }
		  //Go throught input list and check again theValue
		  return true;
		}
		
		
function moveItemListtoList(fromList, toList) {
				
		//Lists
		var list1;
		var list2;
		var tempList;
		
		//Counters
		var i, j, k;
		
		list1 = fromList;
		list2 = toList;
		
		//Go through all items in the fromList
		for (j = 0; j < list1.length; j++) 
		  {
			//If item j is selected and item j is not in tempList then add it
		    if (list1.options[j].selected) {
			  
			  var temp;
			  temp = list1.options[j].value;
			  
			  //alert('Item select is:  ' + temp);
			  if (notInList(temp, list2))  {
				
				k = list2.length;
				
		        list2.options[k] = new Option();
		        list2.options[k].value = temp;
		        list2.options[k].text =  temp;
			  }
		    }
		}
}
		
function moveItemTextboxtoList(fromBoxValue, toList) {
		
		var theTextbox;
		var theList;
		
		var temp;
		
		theList = toList;
		temp = fromBoxValue;
		
		//If item is not in the list, create a new option/add it
		if (notInList(temp, theList))  {
				
		  var i;
				
	      i = theList.length;
	      theList.options[i] = new Option();
	      theList.options[i].value = temp;
	      theList.options[i].text =  temp; 
		}
}

function selectAllKeyWords(listName, formName) {
              
              var addEntries;
			  var i;
			  
              addEntries = eval('document.' + formName + '.' + listName + '.length');              
                for(i = addEntries - 1; i > -1; i--) {
				   //Set all items in list to null
				 eval('document.' + formName + '.' + listName + '.options[' + i + '].selected = true');
                }
  }  
  
  
function resetList(listName, formName) {
              
              var addEntries;
			  var i;
			  var theList
			  
			  theList = eval('document.' + formName + '.' + listName);
			  
             addEntries = eval('document.' + formName + '.' + listName + '.length');              
               for(i = addEntries - 1; i > -1; i--) {
				   //Set all items in list to null
                  eval('document.' + formName + '.' + listName + '.options[' + i + '] = null');
                }
}    

function removeItem(listName, formName) {

  var i;
  var test;
  var theList
  theList = eval('document.' + formName + '.' + listName);
  
  for (i = theList.length - 1; i > -1; i--) {
 
    if (theList.options[i].selected == true) {
	  theList.options[i] = null;
	}
  }

}			


function openKB() {

var newWindow

newWindow = window.open("http://eh2o.saic.com:5800","","status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=800,height=600");
}

function getURL() {
  alert('this');
}

function openKB() {

var newWindow

newWindow = window.open("http://eh2o.saic.com:5800","","status=yes,toolbar=yes,resizable=yes,scrollbars=yes,width=800,height=600");
}

function showGetURL() {
 
 window.urlDIV.style.visibility = 'visible';
}

function hideGetURL(formName, boxName) {

var urlSTR;
var portalNumber;
var i, j;


if (document.getURLForm.radiobutton[0].checked == true) {
  portalNumber = document.getURLForm.radiobutton[0].value;
}
else {
  portalNumber = document.getURLForm.radiobutton[1].value;
}

urlSTR = 'http://151.200.101.13:5850/article.asp?article=' + document.getURLForm.articleID.value + '&p=' + portalNumber;

window.urlDIV.style.visibility = "hidden";

eval('document.' + formName + '.' + boxName + '.value = urlSTR;');

}

function showAboutUpload() {

}

function hideAboutUpload() {

}
