var request = null;
function httpRequest(reqType,url,asynch,respHandle)
{
	if(window.XMLHttpRequest)
	{
		request = new XMLHttpRequest();
		if(reqType.toLowerCase() != "post") 
		{
			initReq(reqType, url,asynch,respHandle);
		} 
		else 
		{
			var args = arguments[4];
			if(args != null && args.length > 0)
			{
				initReq(reqType,url,asynch,respHandle,args);
			}
		}
	} 
	else if (window.ActiveXObject)
	{
		request=new ActiveXObject("Msxml2.XMLHTTP");
		if (! request)
		{
			request=new ActiveXObject("Microsoft.XMLHTTP");
		}
		if(request)
		{
			if(reqType.toLowerCase() != "post") 
			{
				initReq(reqType,url,asynch,respHandle);
			} 
			else 
			{
				var args = arguments[4];
				if(args != null && args.length > 0)
				{
					initReq(reqType,url,asynch,respHandle,args);
				}
			}
		} 
		else 
		{
			alert("Your browser does not permit the use of all of this application's features!");
		}
	} 
	else 
	{
		alert("Your browser does not permit the use of all of this application's features!");
	}
}
function initReq(reqType,url,bool,respHandle)
{
	try
	{
		request.onreadystatechange=respHandle;
		request.open(reqType,url,bool);
		if(reqType.toLowerCase() == "post") 
		{
			request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
			request.send(arguments[4]);
		} 
		else 
		{
			request.send(null);
		}

	} 
	catch (errv) 
	{
		alert("The application cannot contact the server at the moment. Please try again in a few seconds.\n")
		
	}
}
function newWindow(mypage,myname,w,h,features) {

  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
function Show_HelpIE55(ctlRef,ctlCnt,wt,ht)
{

try
	{	
	var oPopup = window.createPopup();
		oPopup.document.body.innerHTML =  document.getElementById(ctlCnt).innerHTML;
		oPopup.show(8, 8,wt,ht,ctlRef);
	}
	catch(er){alert(er.description);}	
}
function doGoogleSearch(objSearch)
		{
			window.location.href = 'http://search.nycenet.edu/search?q=' + objSearch.value + '&btnG=DOE+Search&site=default_collection&client=default_frontend&output=xml_no_dtd&proxystylesheet=default_frontend';
		}
function onkeydownG(e, objSearch)
{
	if  (e.keyCode == 13) 
	{
		doGoogleSearch(objSearch);
		return false;
	}
	return true;
}
