  var currentPage = "";
  
  // Will jump to a local anchor on the selected page
  function jumpToSection(sec)
  {
    document.location.href = currentPage + '#' + sec;
  }
  
  // Toggle showing/hiding of an HTML entity
  function toggleObject(fieldName, show)
  {
    var obj = document.getElementById(fieldName);
    if (obj != null)
    {
      obj.style.display = (show) ? '' : 'none';
    }
  }

  function toggleDIV(id)
  {
    // Hide all other toggleable DIVs
    var divColl = document.getElementsByTagName('DIV');
    for (var i=0; i<divColl.length; i++)
    {
      if (divColl[i].id.indexOf('divToggle') == 0 && divColl[i].id != id)
      {
        divColl[i].style.display = 'none';
      }
    }

    var div = document.getElementById(id);
    // Show selected DIV    
    toggleObject(id, (div.style.display == 'none'));
    
    return false;
  }
    
  //
  // FUNCTION roundNum
  //------------------------------------------------------------------------
  // Accepts any number and the number of decimal places required
  // Returns:
  //	 Rounded number by the decimal places specified
  //------------------------------------------------------------------------
  //
  function roundNum(number, decimalPlaces)
  {
    var returnVal = Math.round(number * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces);
    var iPos = Number(returnVal.toString().indexOf(".")) + 2;
    if (number !=0 && iPos == returnVal.toString().length)
    {
      returnVal = returnVal + "0";
    }

    if (returnVal.toString().indexOf('.') == -1)
    {
      returnVal += ".00";
    }
    return returnVal;
  }
  
  //
  // FUNCTION getInteger
  //------------------------------------------------------------------------
  // Accepts any value that can be read as a string.
  // Returns:
  //	 0   - for an empty string, or string "0";
  //	-1   - for any string that cannot be converted to an integer
  //	 int - for any string that can be converted to an integer.
  //
  // "conversion" consists of removing any decimal value, and stripping any
  // formatting commas or spaces.
  //------------------------------------------------------------------------
  //
  function getInteger(val) {
    //ensure val is a string:
    val = val + "";

    //return zero for an empty string.
    if(val.length==0){
	    return 0;
    }

    //strip the decimal point, and all digits to the right of it.
    if(val.indexOf(".")>0) {
	    val = val.substring(0,val.indexOf("."));
    }

    //strip all commas and spaces
    val = val.replace(/[, ]/g,"");

    //return the integer, or -1 if that is not possible
    if(isNaN(val)) {
	    return -1;
    } else {
	    return parseInt(val,10);
    }
  } // END FUNCTION getInteger

  //
  // FUNCTION formatInteger
  //------------------------------------------------------------------------
  // Accepts an integer (which will be treated as a string)
  // Returns the integer in string format, all formatted.
  // eg formatInteger(1284572.38927) would return "1,284,572"
  //------------------------------------------------------------------------
  //
  function formatInteger(val)
  {
    //ensure val a pure integer, in string format:
    val = getInteger(val) + "";

    //return a blank string if val < 1
    if(val < 1) 
    {
	    //add commas. (negative numbers)
	    if(val.length > 10) 
	    {
		    val = val.slice(0,-9) + "," + val.slice(-9,-6) + "," + val.slice(-6,-3) + "," + val.slice(-3)
	    } 
	    else 
	    {
		    if(val.length > 7) 
		    {
			    val = val.slice(0,-6) + "," + val.slice(-6,-3) + "," + val.slice(-3)
		    } 
		    else 
		    {
			    if(val.length >4) 
			    {
				    val = val.slice(0,-3) + "," + val.slice(-3)
			    }
		    }	
	    }
    } 
    else 
    {
	    //add commas.
	    if(val.length > 9) 
	    {
		    val = val.slice(0,-9) + "," + val.slice(-9,-6) + "," + val.slice(-6,-3) + "," + val.slice(-3)
	    } 
	    else 
	    {
		    if(val.length > 6) 
		    {
			    val = val.slice(0,-6) + "," + val.slice(-6,-3) + "," + val.slice(-3)
		    } 
		    else 
		    {
			    if(val.length >3) 
			    {
				    val = val.slice(0,-3) + "," + val.slice(-3)
			    }
		    }	
	    }
    }
    return val;
  } // END FUNCTION formatInteger
  
	function popup(file, width, height, scrollbars)
		{
		topPos = (screen.availHeight-height)/2;
		leftPos = (screen.availWidth-width)/2;
		win=window.open(file,'Aurum','left=' + leftPos + ',top=' + topPos + ', width=' + width + ',height= ' + height + ',location=0,status=0, scrollbars=' + scrollbars + ', resizable=0');
		win.focus();
	}

