function redirect_page(subdir,filename) {
   var version = navigator.appVersion;
   var pg = "http://www.bgchousing.com/jobfiles/jobfiles.php?page=record_file&file="+filename+"&subdir="+subdir;
   if (version.indexOf("MSIE") >= -1 ) {
	window.location.href = pg;
   } else {
	window.open("pg",target="_self");
   }
} // end of function redirect_page

  function toupper(item) {
        var i = item.value;
        item.value = i.toUpperCase();
  }

// -----------------------------------------------
// CHANGES IMAGES ACCORDING TO MOUSE MOVEMENT
// -----------------------------------------------
function ImgOn(imgName) {
	var imgNameon = new Image();
        imgNameon.src = "menus/"+imgName+"_on.gif";

        if (document.images)
         document[imgName].src = imgNameon.src;
        } // end of ImgOn


function ImgOff(imgName) {
	var imgNameoff = new Image();
        imgNameoff.src = "menus/"+imgName+".gif";

        if (document.images)
          document[imgName].src = imgNameoff.src;
        } // end of ImgOff

// ---------------------------------------------
   function checknum(item) {
	var i = parseInt(item.value)
	if (isNaN(i)) {
	   alert("You have not entered a valid number. Pls try again");
	   item.focus();
	   item.value="0";
	} else {
	   var val = removeCommas(item.value);
	   item.value=val;
	} 
   } // end of checknum

  function toupper(item) {
	var i = item.value;
	item.value = i.toUpperCase();
  }

function removeCommas( strValue ) {
/************************************************
DESCRIPTION: Removes commas from source string.

PARAMETERS: 
  strValue - Source string from which commas will 
    be removed;

RETURNS: Source string with commas removed.
*************************************************/
  var objRegExp = /,/g; //search for commas globally
  var objRegExp_sp = /\s/g; //search for commas globally
 
  //replace all matches with empty strings
  no_commas = strValue.replace(objRegExp,'');
  no_spaces =  no_commas.replace(objRegExp_sp,'')
  return no_spaces;
  // return strValue.replace(objRegExp,'');

}

function addCommas( strValue ) {
/************************************************
DESCRIPTION: Inserts commas into numeric string.

PARAMETERS: 
  strValue - source string containing commas.
  
RETURNS: String modified with comma grouping if
  source was all numeric, otherwise source is 
  returned.
  
REMARKS: Used with integers or numbers with
  2 or less decimal places.
*************************************************/
  var objRegExp  = new RegExp('(-?[0-9]+)([0-9]{3})'); 

    //check for match to search criteria
    while(objRegExp.test(strValue)) {
       //replace original string with first group match, 
       //a comma, then second group match
       strValue = strValue.replace(objRegExp, '$1,$2');
    }
  return strValue;
}

function printIt(obj) {
 if (document.all) {
   winId=window.open('','printwin','left=0,top=0,width=850,height=400');
   winId.document.write(obj.innerHTML);
   winId.document.close();
   winId.focus();
   winId.print();
   winId.close();
 }
}

