function trim(strText) { 
    // gets rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // gets rid of trailing spaces
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

function removeExcessQueryString(strText) { 
  //alert('strText = ' + strText);
  
  firstLetter = strText.substring(1,2);
  //alert('first letter in string = ' + firstLetter);
  lastLetter = strText.substring(strText.length-1,strText.length);
  //alert('last letter in string = ' + lastLetter);
  
  if(strText.indexOf('?')>0) {
    //alert('index of = ' +strText.indexOf('?'))  
    strText = strText.substring(0, strText.indexOf('?'));
  }
  //alert('strText = ' + strText);
  return strText;
} 

function removeLastDir(strText) { 
  //alert('strText = ' + strText);
  if(strText.indexOf('/')>0) {
		while (strText.substring(strText.length-1,strText.length) != '/')
    	strText = strText.substring(0, strText.length-1);
		//alert('strText = ' + strText);
		return strText;
  } 
  
  if (strText.indexOf('\\')>0) {
    //alert('index of = ' +strText.indexOf('\\'));  
    strText = strText.substring(0, strText.indexOf('\\'));
		//alert('strText = ' + strText);
		return strText;
  } 
} 

function removeStartingSlashes(strText) { 
  //alert('strText = ' + strText);
  if(strText.indexOf('/')>0) {
		while (strText.substring(0,1) != '/')
    	strText = strText.substring(1, strText.length);
		//alert('strText = ' + strText);
    strText = strText.substring(1, strText.length);
		return strText;
  } 
  
  if (strText.indexOf('\\')>0) {
    //alert('index of = ' +strText.indexOf('\\'));  
    strText = strText.substring(0, strText.indexOf('\\'));
		//alert('strText = ' + strText);
		return strText;
  } 
} 


// USEFUL CODE
//    var menuItemText = menuOptionStr.substring(0, menuOptionStr.indexOf("="));
/*
  var menuOptions = menuOptionsStr.split("~");
  var menuItemDivs = "";

  for (var i=0; i<menuOptions.length; i++) {
    var menuOptionStr = menuOptions[i];
    var menuItemText = menuOptionStr.substring(0, menuOptionStr.indexOf("="));
    var menuItemActionRef = menuOptionStr.substr(menuOptionStr.indexOf("=")+1);

    if (menuItemActionRef.lastIndexOf(";") < menuItemActionRef.length-1){
      menuItemActionRef = menuItemActionRef + ";"     
    }
    menuItemActionRef = menuItemActionRef + "closePopup();";
*/

/*
   var nm = "Bill Guttman";
   var sz1 = nm.substr(5,4);
   var sz2 = nm.substring(5,9);
   alert(sz1);
   alert(sz2);
*/