  function cknumberlist()  {
   chosen=""
   hideSchool=""
   hidePgm=""
   hideDeg=""
   hideType=""
   hideRegCd=""
   hideCity=""
   len = document.forms[0].instTxt.value
    if(len!=""){
   chosen = chosen + "SCHOOL contains: "+ document.forms[0].instTxt.value + "\n"
   }
   len = null
   len = document.forms[0].pgmTxt.value
   if(len!=""){
   chosen = chosen + "PGM contains: "+ document.forms[0].pgmTxt.value + "\n"
   }
    len = document.forms[0].schoolNm.length
    i = 0 
    for (i = 0; i < len; i++) {
    if(document.forms[0].schoolNm[i].value != ""){
	if (document.forms[0].schoolNm[i].selected) {
		chosen = chosen + "SCHOOL: "+ document.forms[0].schoolNm[i].text + "\n"
		hideSchool = hideSchool + "," + "'"  + document.forms[0].schoolNm[i].value + "'" 
		} }}
	document.forms[0].hideSiteCd.value = hideSchool
	
	cipCntrl = document.forms[0].cipTopListCd;
	cipMidList = document.forms[0].cipMidListCd;
	cipMidFull = document.forms[0].cipMidFull

	len = cipCntrl.length
	cipselected = 0
	
	cipMidList.length=0
	cipMidList[cipMidList.length]=cipMidFull[0]
	cipMidList[0].selected=true

	for (i=0;i<len;i++){
		if (cipCntrl[i].value !="" && cipCntrl[i].selected){
			chosen += "CIP 2 digit: "+ cipCntrl[i].text + "\n"
			for (j=0;j<document.forms[0].cipMidFullLength.value;j++){
				if (cipCntrl[i].value== cipMidFull[j].value.substring(0,2)){
					cipMidList[cipMidList.length]=cipMidFull[j]
				}		
			}
			cipselected++;
		}
	}

	if (cipselected==0){
		cipCntrl[0].selected=true;
		for (j=1;j<document.forms[0].cipMidFullLength.value;j++){
			cipMidList[cipMidList.length]=cipMidFull[j]
		}
	} 
	if (cipCntrl[0].selected && cipselected>0){
		cipCntrl[0].selected=false;
	}
		
	len = cipMidList.length
	cipMidSelected = 0
	for (i=0;i<len;i++){
		if (cipMidList[i].value !="" && cipMidList[i].selected){
			chosen+="CIP 4 digit: "+cipMidList[i].text + "\n"
			cipMidSelected++
		}
	}	

	if (cipMidSelected>0 && cipMidList[0].selected)
		cipMidList[0].selected=false

    len = document.forms[0].pgmNmCd.length
    i = 0
    for (i = 0; i < len; i++) {
    if(document.forms[0].pgmNmCd[i].value != ""){
 			if (document.forms[0].pgmNmCd[i].selected) {
				chosen = chosen + "PGM: "+ document.forms[0].pgmNmCd[i].text + "\n"
				hidePgm = hidePgm + "," + document.forms[0].pgmNmCd[i].value
			} }}
	document.forms[0].hidePgmCd.value = hidePgm

		len = document.forms[0].schlTypCd.length
   		 i = 0
       for (i = 0; i < len; i++) {
        	if(document.forms[0].schlTypCd[i].value != ""){
 		if (document.forms[0].schlTypCd[i].selected) {
			chosen = chosen + "TYPE: "+ document.forms[0].schlTypCd[i].text + "\n"
			hideType = hideType + "," +  document.forms[0].schlTypCd[i].value 
			}}}
		document.forms[0].hideTypCd.value = hideType

	 len = document.forms[0].degLvlCd.length
    i = 0
  
     for (i = 0; i < len; i++) {
   	if(document.forms[0].degLvlCd[i].value != ""){
		if (document.forms[0].degLvlCd[i].selected) {
		chosen = chosen + "DEGREE: " + document.forms[0].degLvlCd[i].text + "\n"
		hideDeg = hideDeg + "," + "'" + document.forms[0].degLvlCd[i].value + "'"
		} }}
		document.forms[0].hideDegCd.value = hideDeg
		
		
   len = document.forms[0].regionCd.length
    i = 0
  
     for (i = 0; i < len; i++) {
  	 	if(document.forms[0].regionCd[i].value != ""){
		if (document.forms[0].regionCd[i].selected) {
		chosen = chosen + "REGION: " + document.forms[0].regionCd[i].text + "\n"
		hideRegCd = hideRegCd + "," + "'" + document.forms[0].regionCd[i].value + "'"
		} } }
		document.forms[0].hideRegCd.value = hideRegCd
		
    len = document.forms[0].city.length
    i = 0
  
     for (i = 0; i < len; i++) {
   	if(document.forms[0].city[i].value != ""){
		if (document.forms[0].city[i].selected) {
		chosen = chosen + "CITY: " + document.forms[0].city[i].text + "\n"
		hideCity = hideCity + "," + "'" + document.forms[0].city[i].value + "'"
		} }}
		document.forms[0].hideCity.value = hideCity
    document.forms[0].inpost.value = chosen
    document.forms[0].inpostLower.value =chosen
    return false
  
    }
     function reset()  {
     document.forms[0].reset()
     return false;

   }
       function submit()  {
    document.forms[0].submit();
   }
 function previousPage()
{
   var formId = getFormId();
   if (parent.checkModifications())
   {
     formId.action=formId.previousPage.value;

     if (formId.previousStartPage.value != null &&
         formId.previousStartPage.value > 0)
     formId.StartPage.value=formId.previousStartPage.value;

     formId.submit();	
   }
}

function loadCipMidFull(){
	document.forms[0].cipMidFullLength.value = document.forms[0].cipMidListCd.length
	for (i=0;i<document.forms[0].cipMidListCd.length;i++){
		document.forms[0].cipMidFull[i]=document.forms[0].cipMidListCd[i]
	}
}
function showNextPage( pageNumber ) 
{ 
      document.forms[0].startPage.value=pageNumber; 
      document.forms[0].submit(); 

} 
function showHelp(helpPage)
{
   open("/ProgramInventory/help/"+ helpPage,"","scrollbars=yes,toolbar=yes,width=600, height=400");
}

function showMapHelp(helpPage)
{
   open("/ProgramInventory/help/"+ helpPage,"","scrollbars=yes,toolbar=yes,width=700, height=500");
}

/*********************************************************************************
*  setError()
*
*  This is a java script utility  displays validation errors returned from a
*  servlet.
**********************************************************************************/
function setError(objName) {
	var error = objName;
	if (error.value != "null"){
		alert(error.value);
	}
	}
	function getFormAsString(formName){
        
  //Setup the return String
  returnString ="";
        
  //Get the form values
  formElements=document.forms[formName].elements;
  alert(formElements);
        
  //loop through the array, building up the url
  //in the format '/strutsaction.do&name=value'
 
  for(var i=formElements.length-1;i>=0; --i ){
        //we escape (encode) each value
        returnString+="&" 
        +escape(formElements[i].name)+"=" 
        +escape(formElements[i].value);
 }
        
 //return the values
 return returnString; 
}
	function retrieveURL(url,nameOfFormToPost) {
    alert("RETRIEVEURL");
  //convert the url to a string
  url=url+getFormAsString(nameOfFormToPost);
  alert(url);
    
  //Do the AJAX call
  if (window.XMLHttpRequest) { 
     
    // Non-IE browsers
    req = new XMLHttpRequest();
    req.onreadystatechange = processStateChange;
    try {
          req.open("GET", url, true); 
    } catch (e) {
      alert("Server Communication Problem\n"+e);
    }
    req.send(null);
  } else if (window.ActiveXObject) {
    // IE
   
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if (req) {
      req.onreadystatechange=processStateChange;
      req.open("GET", url, true);
      req.send();
    }
  }
}
function processStateChange() {
  
  if (req.readyState == 4) { // Complete
    if (req.status == 200) { // OK response
        
    //Split the text response into Span elements
    spanElements = 
        splitTextIntoSpan(req.responseText);
    
    //Use these span elements to update the page
    replaceExistingWithNewHtml(spanElements);
    
    } else {
      alert("Problem with server response:\n " 
        + req.statusText);
    }
  }
}
  
function replaceExistingWithNewHtml 
        (newTextElements){
 
  //loop through newTextElements
  for(var i=newTextElements.length-1;i>=0;--i){
  
    //check that this begins with <span
    if(newTextElements[i]. 
        indexOf("<span")>-1){
                        
          //get the span name - sits
      // between the 1st and 2nd quote mark
      //Make sure your spans are in the format
      //<span id="someName">NewContent</span>
          startNamePos=newTextElements[i]. 
              indexOf('"')+1;
      endNamePos=newTextElements[i]. 
              indexOf('"',startNamePos);
      name=newTextElements[i]. 
              substring(startNamePos,endNamePos);
                        
      //get the content - everything 
      // after the first > mark
      startContentPos=newTextElements[i]. 
               indexOf('>')+1; 
      content=newTextElements[i].
               substring(startContentPos);
                        
     //Now update the existing Document 
     // with this element, checking that 
     // this element exists in the document
     if(document.getElementById(name)){
                document.getElementById(name). 
                innerHTML = content;
     }
  }
}
function splitTextIntoSpan(textToSplit){
 
  //Split the document
  returnElements=textToSplit. 
            split("</span>")
        
  //Process each of the elements        
  for(var i=returnElements.length-1;i>=0;--i){
                
    //Remove everything before the 1st span
    spanPos = returnElements[i]. 
             indexOf("<span");               
                
    //if we find a match, take out 
    //everything before the span
    if(spanPos>0){
          subString=returnElements[i].
              substring(spanPos);
          returnElements[i]=subString;
    } 
  }
  return returnElements;
}

}


