﻿			/**			 * Function to handle calls to the server.	 * Creates an XMLHTTP or XMLHttpRequest object			 * then retrieves the url 'url' and passes the return to alertContents() function.			 * @param String url The url to retrieve from the server.			 * NOTE: url must not reside on a third-party server, as HTTP request object prevents it.			 * @return Boolean False returned if an XMLHTTP or XMLHttpRequest instance cannot be created.			*/			function loadUrlIntoContentPane (url, contentPane) {							var http_request = false;								//check to see if it can find an XMLHttpRequest attribute				//should find one if user is using a Mozilla or Safari based browser..				if(window.XMLHttpRequest) {					http_request = new XMLHttpRequest();										//not sure what this does yet...					if(http_request.overrideMimeType) {						http_request.overrideMimeType('text/xml');					}									//couldn't find an XMLHttpRequest, 				//so lets try & see if we have ActiveXObject attribute				//if so, then user is using an IE based browser				} else if(window.ActiveXObject) {					try {						//try & create an Msxml2 version						http_request = new ActiveXObject("Msxml2.XMLHTTP");					} catch (e) {						try {						//if we can't make an Msxml2 version, try with the Microsoft version							http_request = new ActiveXObject("Microsoft.XMLHTTP");						}catch (e) {}					}				}								//if we can't make a XMLHTTP or XMLHttpRequest instance,				//let the user know. They are probably using an old version of browser,				//or dont have JavaScript enabled.. in which case an alert would be useless?				if(!http_request) {					alert('Giving up :( Cannot create an XMLHTTP instance');					return false;				}								//define onreadystatechange as being an on-the-fly function that calls alertContents()				http_request.onreadystatechange = function() { updateContentPane(http_request, contentPane); };								//make requests to server.				//open() parameters = HTTP request method type, url of page to request, whether call is asynchronous or not								try {				http_request.open('GET', url, true);				//POST parameters to send				//should be in form of a query string. eg. parameter=value&2ndparameter=2ndvalue&so=on				//note: if using POST need to change mime-type:				//http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				http_request.send("");				} catch (e) {}							}//end of makeRequest() function						/**			 * Function to return data from server.			 * @param XMLHTTP http_request An XMLHTTP or XMLHttpRequest object being returned by the server			*/			function updateContentPane(http_request, contentPane) {				//check if our http_request has its state as 'completed'				//readyState values:				//0 (uninitialized);				//1 (loading);				//2 (loaded);				//3 (interactive);				//4 (completed);				if(http_request.readyState == 4) {					//check to see that the Status code is '200' (OK).					//for full list of status codes see:					//www.w3.org/Protocols/rfc2616/rfc2616-sec10.html					//if you are running from localhost under windows status will return 0.					//only put this in for windows developers.					if(http_request.status == 200 || http_request.status == 0) {						//if its all OK, then alert() out the text.						try {						response = http_request.responseText;						document.getElementById(contentPane).innerHTML = response;						} catch (e) {}					} else {						//if not, then notify user it died.						alert('There was a problem with the request.');					}//end of else											}//end of if readyState == 4			}//end of alertContents() function									/**			deprecated for the new way of passing arrays in.. makes things easier						function loadUrlsIntoPanes(masterUrl, masterPane, subUrl, subPane) {				loadUrlIntoContentPane(masterUrl, masterPane);				loadUrlIntoContentPane(subUrl, subPane);			}			**/									/**			 * Function to handle multiple pane updates.			 * cycles thru both the urls & panes arrays.			 * if both the url & pane are set, it'll update.			 *			 * Note: when calling this function remember to get your			 * urls & panes in order.. don't go trying to update panes that don't exist			 */			function loadUrlsIntoPanes(urls, panes) {				//loop thru the urls array				for(i= 0; i < urls.length; i++) {					//check that the url & pane are valid					if((urls[i] != "" && urls[i] != null) && (panes[i] != "" && panes[i] != null)) {						//if so load the url into the pane						loadUrlIntoContentPane(urls[i], panes[i]);											}				}			}									/**			 * Function to toggle display of an element, used in the left menu to show / hide sections			 * @param String targetId the id assigned to the element to be toggled.			*/			function toggle(targetId, targetImg){			plus = "images/plus.gif";			minus = "images/minus.gif";						  				if (document.getElementById){        			target = document.getElementById( targetId );        			img = document.getElementById(targetImg);        				           		if (target.style.display == "none"){	              		target.style.display = "";	              		img.src = minus;	           		} else {	              		target.style.display = "none";	              		img.src = plus;	           		}     			}			} 