// Beginning dropdown menu code
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS6 = (bName == "Netscape" && bVer >= 5);
 var NS4 = (bName == "Netscape" && bVer >= 4 && bVer < 5);
 var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
 var menuActive = 0, menuOn = 0, onLayer, onLayer, onLayer2, onLayer3, timeOn = null;
 
// Layer switching code
if (NS4 || IE4 || NS6) {
 if (NS4) {
 layerStyleRef="layer.";
 layerRef="document.layers";
 styleSwitch="";
  }else if(NS6){
 styleSwitch=".style";
 }else{
 layerStyleRef="layer.style.";
 layerRef="document.all";
 styleSwitch=".style";
 }
}

var testDiv;
// This function will do the right thing, and either expand or collapse the DIVs
function changeDiv(layerName){
	if (NS4 || IE4) {
		if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility') == 'hidden'){
			showDiv(layerName);
		} else {
			hideDiv(layerName);
		}
	} 
	if (NS6) {
		if (eval('document.getElementById("'+layerName+'")'+styleSwitch+'.visibility') == 'hidden') {
	 		showDiv(layerName);
		} else {
			hideDiv(layerName);
		}
	} 
}
// SHOW DIV
function showDiv(layerName){
	if (NS4 || IE4 || NS6) {
		if (NS4 || IE4) {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.position="relative"');
		} 
		if (NS6) {
		 eval('document.getElementById("'+layerName+'")'+styleSwitch+'.visibility="visible"');
		 eval('document.getElementById("'+layerName+'")'+styleSwitch+'.position="relative"');
		} 
	}
}// HIDE DIV
function hideDiv(layerName){
	if (NS4 || IE4) {
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.position="absolute"');
	}
	if (NS6) {
		eval('document.getElementById("'+layerName+'")'+styleSwitch+'.visibility="hidden"');
		eval('document.getElementById("'+layerName+'")'+styleSwitch+'.position="absolute"');
	}
}

var url = "/oraclenews/displaynews.cfm?"; // The server-side script
var isWorking = false;

function handleHttpResponse() {
  if (http.readyState == 4) {
    if (http.responseText.indexOf('invalid') == -1) {
	// Dump the raw data to the page!
	var xmlDocument = http.responseText; 
	 document.getElementById("HomePageNews").innerHTML = xmlDocument;
      isWorking = false;
    }
  }
}

function updateNews(x){
  if (!isWorking && http) {
    http.open("GET", url + x, true);
	// http.open("GET", url + escape(x), true);
	//alert(url + escape(x));
	//http.open("GET", url, true);
    http.onreadystatechange = handleHttpResponse;
    isWorking = true;
    http.send(null);
  }

}

function SearchNews(f){
  var urldata = "mode=search";
  urldata = urldata + '&SearchText=' + f.SearchText.value;
  urldata = urldata + '&SearchSource=0';
  for(x=0; x < f.SearchSource.length; x++){
  	if (f.SearchSource[x].checked) urldata = urldata + ',' + f.SearchSource[x].value;
  }
  //urldata = urldata + '' + f.SearchEndDate.value;
  //urldata = urldata + '' + f.SearchStartDate.value;
  //alert(urldata);
  updateNews(urldata);
  return false;
}


function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
	  xmlhttp.overrideMimeType("text/xml"); 
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
