	
	
		//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 tabChange(objectId) {
			
			if (objectId == 'A')
				{
				
				document.getElementById("tabA").className = 'tabOn';
				document.getElementById("tabB").className = 'tabOff';
				document.getElementById("tabC").className = 'tabOff';
				document.getElementById("backgroundTabAContent").style.visibility = "visible";
				document.getElementById("backgroundTabBContent").style.visibility = "hidden";
				document.getElementById("backgroundTabCContent").style.visibility = "hidden";
				}
			else if (objectId == 'B')
				{
				
				document.getElementById("tabA").className = 'tabOff';
				document.getElementById("tabB").className = 'tabOn';
				document.getElementById("tabC").className = 'tabOff';			
				document.getElementById("backgroundTabAContent").style.visibility = "hidden";
				document.getElementById("backgroundTabBContent").style.visibility = "visible";
				document.getElementById("backgroundTabCContent").style.visibility = "hidden";
				}
			else
				{
				
				document.getElementById("tabA").className = 'tabOff';
				document.getElementById("tabB").className = 'tabOff';
				document.getElementById("tabC").className = 'tabOn';				
				document.getElementById("backgroundTabAContent").style.visibility = "hidden";
				document.getElementById("backgroundTabBContent").style.visibility = "hidden";
				document.getElementById("backgroundTabCContent").style.visibility = "visible";
				}
			}

			
		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;
			//	}
		//	}
		}
		function validmap(thisval) {
			if (thisval == "" || thisval == null) {
			return true; }
			else {
				
				var geoCoder;
				geoCoder = new GClientGeocoder();
					if (geoCoder) {
						var address = thisval;
						geoCoder.getLatLng( address, function(point){
							if (!point) {
								alert('Address Not Found in Google Maps');
								document.form.googleaddress.value='';
								document.form.googleaddress.focus();
								return false; }
							else{
								return true;
							} 
						});
					}
			}
		}
		
		function validate_form(thisform)
		{
		with (thisform)
		{
		if (validate_required(title,"Title must be filled out")==false)
		  {title.focus();return false;}
		
		
		if (validate_required(contactemail,"Contact Email must be filled out")==false)
		  {contactemail.focus();return false;}
		  
		if (validate_email(contactemail,"Contact Email is not a valid email address")==false)
  			{contactemail.focus();return false;}
			
		if (validateInt(maxattendees,"Max Attendees needs to be a number")==false)
  			{maxattendees.focus();return false;}

		  
		}
		
		}

		
		function validate_required(field,alerttxt)
		{
		with (field)
		{
		  if (value==null||value=="")
		  {
		  alert(alerttxt);return false;
		  }
		  else
		  {
		  return true;
		  }
		}
		}
		
		
		function validate_email(field,alerttxt)
		{
		with (field)
		{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
		  {alert(alerttxt);return false;}
		else {return true;}
		}
		}
		
		
		function validateInt(field,alerttxt)
		   {
		    with (field)
			{  
			
			if (!isInteger(value) && value!=null && value!="")
		  {alert(alerttxt);return false;}
		  else
		  	{return true;}
		  
		   }
		  }
		   
		   
		   function isInteger (s)
		   {
		      var i;
		
		      if (isEmpty(s))
		      if (isInteger.arguments.length == 1) return 0;
		      else return (isInteger.arguments[1] == true);
		
		      for (i = 0; i < s.length; i++)
		      {
		         var c = s.charAt(i);
		
		         if (!isDigit(c)) return false;
		      }
		
		      return true;
		   }
		   
		   function isEmpty(s)
		   {
		      return ((s == null) || (s.length == 0))
		   }
		
		   function isDigit (c)
		   {
		      return ((c >= "0") && (c <= "9"))
		   }


		
		

		
		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
		}		
			
			


