		
		//This function displays a pop-up window using the values from a select option. EAB 11-30-06
		function navigateToSelectedListItem(theSelectListName) {

			if (theSelectListName.options[theSelectListName.selectedIndex].value != ""){
			
				leftPos = 0;
				topPos = 0;
				
				if(screen){
					leftPos = (screen.width-600)/2;
					topPos = (screen.height-700)/2;
				}
				
				window.open(theSelectListName.options[theSelectListName.selectedIndex].value,'_blank','resizable=yes,titlebar=no,menubar=no,scrollbars=yes,width=600,height=700,top='+topPos+',left='+leftPos+'')
			}
		}

		
		function runOnLoaded(thePage) {
				print();
				if (window.onload) {
					window.close();
				}
			}	
	
			
		function classChange(styleChange, item) {
			item.className = styleChange;
			}
			
		function newwindow(URL){
			leftPos = 0;
			topPos = 0;
			if(screen){
				leftPos = (screen.width-617)/2;
				topPos = (screen.height-700)/2;
			}
	
			myWindow = window.open(URL,'_blank','resizable=yes,titlebar=no,menubar=no,scrollbars=yes,width=617,height=700,top='+topPos+',left='+leftPos+'')
			myWindow.focus()
		}
		
		function closeWindow(){
			this.window.close()
		}


		 function check_uncheck(){
		  for (var i = 0; i < document.documentList.elements.length; i++) {
		    var e = document.documentList.elements[i];
		    if ((e.name != 'select_all') && (e.type == 'checkbox')) {
		e.checked = document.documentList.select_all.checked;
		    }
		  }
		} 			
			
		function focusField(me){
			
		}
		
		function firstField(formName, formField){		
			//document[formName][formField].focus();
		}	


		function validateForm(formName){
			//var fields = formName.elements;
			//for(var i=0; i < fields.length; i++) {
			//	if(!fields[1].value){
			//		alert("Please fill in the title field before saving.");
			//		fields[1].focus();
			//		return false;
			//	}
		//	}
		}



		
		var url = null;
		
		//Do an Ajax update for the page. 
		var getUpdate = function(url){
			//Create a new Ajax object.
			var ajax = new Ajax();	
			//Run the ajax xmlhttprequest
			ajax.doGet(url);
		};
			
				
		
		//AJAX Class
		function Ajax(){
			this.req = null;
			this.url = null;
			this.method = 'get';
			this.async = true;
			this.status = null;
			this.statusText = null;
			this.postData = null;
			this.readyState = null;
			this.responseText = null;
			this.responseXML = null;
			this.handleResp = null;
			this.responseFormat = 'text', //'text', 'xml' or 'ojbect'
			this.mimeType = null;		
			
			this.init = function() {
				if(!this.req) {
					
					try {
						//Create a request object for Firefox, Safari, ie7, etc.
						this.req = new XMLHttpRequest();
					}
					catch(e){
						try{
							//Create a request object for later versions of ie.
							this.req = new ActiveXObject('MSXML2.XMLHTTP');
						}
						catch(e){
							try{
								//Create a request object for early versions of ie.
								this.req = newActiveXObject('Microsoft.XMLHTTP');	
							}
							catch(e){
								//Could not create an XMLHttpRequest object.
								return false;
							}
						}	
					}
				}
				return this.req;
			}; //End of function
			
			//Function to start a request.
			this.doGet = function(url) {
				this.url = url;
				this.doReq();
			};
			
			
			this.doReq = function() {
				if(!this.init()) {
					alert('Could not create a request.');
					return;
				}
				
				//Open the request object with the params.
				this.req.open(this.method, this.url, this.async);
				
				//Fix the loss of scope in inner function.
				var self = this;
				
				//The inner function event handler.
				this.req.onreadystatechange = function() {
					var resp = null;
					if(self.req.readyState == 4) {
						//Do stuff to handle the response.
						
						switch (self.responseFormat) {
							case 'text':
								resp = self.req.responseText;
								break;
							case 'xml':
								resp = self.req.resonseXML;
								break;
							case 'object':
								resp = self.req;
								break;
						}
						if (self.req.status >= 200 && self.req.status <=299) {		
									
							
							//alert(resp);			
							//var rowCount = theResult.getRowCount();
							//alert(rowCount);
							//var fk_person = document.getElementsByName('fk_person');
							//var results = resp.getElementsByTagName('title');
							
							//alert(results);
							//for(var i=0; i < rowCount; i++){
							//	option = document.createElement('option');
								//option.appendChild(document.createTextNode(personResult[i].firstChild.nodeValue));
							//	option.appendChild(document.createTextNode(i));
							//	fk_person.appendChild(option);
								//document.write(i);
							//}							
							
							
													 					
							self.handleResp(resp);						
						}
						else {
							self.handleErr(resp);
						}
					}
					

							
				}; //End of function
													
				this.handleResp = function() {
					//location.reload();
				};

				this.handleErr = function() {
					var errorWin;
					try {
						errorWin = window.open('', 'errorWin');
						errorWin.document.body.innerHTML = 'Oooops!';
						errorWin.document.body.innerHTML = this.responseText;
					}
					catch(e){
						alert('An error has occurred, but the error message cannot be displayed.');
					}
				};

				this.abort = function() {
					if(this.req) {
						//Reset the event handler.
						this.req.onreadystatechange = function() {};
						this.req.abort();
						//Destroy the req object
						this.req = null;
					}
				};

				this.setMimeType = function(mimeType){
					this.mimeType = mimeType;
				};
				

				//Send the request.
				this.req.send(this.postData);
				
			};  //End of function
		}		
			
			


