var openWindow;
//------------------------------------------------------------------------------------------------------------------------------
function checkWindowSize(objImage)
{
	var strLeft = window.screen.availWidth;
	if(strLeft > 1030){
		//display the largest image  1024x768
		objImage.src = "opening_page_1240.jpg";
		objImage.useMap = "#Map1240"
	}
	else if(strLeft > 970){
		//display the 980 image
		objImage.src = "opening_page_980.jpg";
		objImage.useMap = "#Map980"
	}
	else{
		//display the 760 image
		objImage.src = "opening_page_760.jpg";
		objImage.useMap = "#Map760"
	}
}
//------------------------------------------------------------------------------------------------------------------------------
function resetWindow()
{
	top.window.moveTo(0,0); 
	 top.window.resizeTo(screen.availWidth,screen.availHeight); 
	 if (top.window.outerHeight < window.screen.availHeight || top.window.outerWidth < window.screen.availWidth){ 
		top.window.outerHeight = top.screen.availHeight; 
		top.window.outerWidth = top.screen.availWidth; 
	} 
}
//------------------------------------------------------------------------------------------------------------------------------
function showModallessWindow(pURL,pFacilityName,pTitle,pExport,pHeight,pWidth,pHasScrollBars)
{
	var strWindowWidth = pWidth;
	var strWindowHeight = pHeight;
	var strURL = pURL;
	var strLeft = window.screen.availWidth;
	var strTop = window.screen.availHeight;
	
	strLeft = ( (strLeft - strWindowWidth) / 2);
	strTop = ( (strTop - strWindowHeight) / 2);
	strURL =  strURL + "&strFacilityName=" + pFacilityName + "&strPageTitle=" + pTitle + "&strExportButton="+ pExport;
	
	if(openWindow){
		if(!openWindow.close()){
			openWindow.close();
		}
	}
openWindow = window.open(''+strURL+'',"","top="+strTop+",left="+strLeft+",height="+strWindowHeight+",width="+strWindowWidth+",status=0,resizeable=0,scrollbars="+pHasScrollBars+",toolbar=0");
}
//------------------------------------------------------------------------------------------------------------------------------
function doHourglass()
{
  //document.body.style.cursor = '../images/dinosaur.ani';
  document.body.style.cursor = 'wait';
}
//------------------------------------------------------------------------------------------------------------------------------
function ShowWarningMessage(pMessage)
{
	if(!confirm(pMessage)){
		return false
	}
	return true
}
//------------------------------------------------------------------------------------------------------------------------------
function ShowExportWarningMessage(pMessage,pImageName)
{
	if(!confirm(pMessage)){
		return false
	}
	document.getElementById('DaughterTop1_imgExport').src =  "../images/imgProcessingData.gif";
	setTimeout('SetImage()',2000);
	return true
}
function SetImage()
{
	document.getElementById('DaughterTop1_imgExport').src =  "../images/view_in_excel_button.gif";
}
//------------------------------------------------------------------------------------------------------------------------------
function Rollover(pObject, pClassName)
{
	pObject.classname = pClassName;
}
//------------------------------------------------------------------------------------------------------------------------------
function RolloverLargeImage(pArrayNumber)
{
	document.images['imgLargePic'].src=img[pArrayNumber].src;
}
//------------------------------------------------------------------------------------------------------------------------------
function PrintPage()
{
	var exists = eval(document.getElementById("divNoPrint"));
	if(exists){
		document.getElementById("divNoPrint").className='noprint';
		document.getElementById("DaughterTop1_lnkPrintPage").style.visibility='hidden';
		window.print();
		document.getElementById("DaughterTop1_lnkPrintPage").style.visibility='visible';
		document.getElementById("divNoPrint").className='';
	}
	else{
		document.getElementById("DaughterTop1_lnkPrintPage").style.visibility='hidden';
		window.print();
		document.getElementById("DaughterTop1_lnkPrintPage").style.visibility='visible';
	}
}
//------------------------------------------------------------------------------------------------------------------------------
function ClearListBox(pField)
{
	//remove from the listbox 
	if(pField.options.length != 0){
		//make sure they are double-clicking on a real list item and not just the box
		pField.selectedIndex = -1
	}
}
//------------------------------------------------------------------------------------------------------------------------------
function AutoComplete(dropdownlist,caseSensitive) 
{
	// check the keypressBuffer attribute is defined on the dropdownlist
	var undefined; 
	if (dropdownlist.keypressBuffer == undefined) { 
		dropdownlist.keypressBuffer = ''; 
	} 
	
	// get the key that was pressed 
	var key = String.fromCharCode(window.event.keyCode); 
	dropdownlist.keypressBuffer += key;
	if (!caseSensitive) {
		// convert buffer to lowercase
		dropdownlist.keypressBuffer = dropdownlist.keypressBuffer.toLowerCase();
	}
	
	// find if it is the start of any of the options 
	var optionsLength = dropdownlist.options.length; 
	for (var n=0; n < optionsLength; n++) { 
		var optionText = dropdownlist.options[n].text; 
		if (!caseSensitive) {
			optionText = optionText.toLowerCase();
		}
		if (optionText.indexOf(dropdownlist.keypressBuffer,0) == 0) { 
			dropdownlist.selectedIndex = n; 
			return false; // cancel the default behavior since we have selected our own value 
		} 
	} 
	// reset initial key to be inline with default behavior 
	dropdownlist.keypressBuffer = key; 
	return true; // give default behavior 
} 