

if(!document.getElementById){
  if(document.all)
  document.getElementById=function(){
    if(typeof document.all[arguments[0]]!="undefined")
    return document.all[arguments[0]]
    else
    return null
  }
  else if(document.layers)
  document.getElementById=function(){
    if(typeof document[arguments[0]]!="undefined")
    return document[arguments[0]]
    else
    return null
  }
}


function FrameNavigate(strFrameID, strURL) {
	var objFrame = document.getElementById(strFrameID);
	if (objFrame) 
		objFrame.src = strURL;
	else
		alert('function "FrameNavigate" error: Frame "' + strFrameID + '" could not be found.');
}


function AddOption(ListBox, OptionValue, OptionText, OptionIsSelected) {
	//Appends a new option to a list box
	ListBox.options[ListBox.options.length] = new Option(OptionText, OptionValue);
	if(OptionIsSelected) {
		ListBox.options[ListBox.options.length-1].selected = true;
		ListBox.options[ListBox.options.length-1].defaultSelected = true;
	}
}

function GetListBoxText(ListBox) {
	if (typeof(ListBox) == 'string') ListBox = document.getElementById(ListBox);
	var ListBoxSelectedIndex = ListBox.selectedIndex;
	if(ListBoxSelectedIndex == -1)
		return "";
	else
		return ListBox[ListBoxSelectedIndex].text;
}

function GetListBoxValue(ListBox) {

	if (typeof(ListBox) == 'string') ListBox = document.getElementById(ListBox);

	var ListBoxSelectedIndex = ListBox.selectedIndex;
	if(ListBoxSelectedIndex == -1)
		return "";
	else
		return ListBox[ListBoxSelectedIndex].value;
}

function SetListBoxValue(ListBox, ListBoxValue) {
	if (typeof(ListBox) == 'string') ListBox = document.getElementById(ListBox);
	if (ListBox) {
		for (var i=0; i<ListBox.length; i++) {
			if (ListBox[i].value == ListBoxValue) {
				ListBox[i].selected = true;
				return;
			}
		}
	}
}


function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement &&
      ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getScrollX() {
	var arrScrollXY = getScrollXY();
	return arrScrollXY[0];
}
function getScrollY() {
	var arrScrollXY = getScrollXY();
	return arrScrollXY[1];
}

