
/**
 * This dummy function can be used to validate your HTML import path<br><br>
 * <b>Welcome to the Framework</b><br><br>
 * The struction of the application assumes that each
 * <br> page of your application must have the following:
 * <br><br>1) A servlet of some name "<i>YOURPAGENAME.java</i>"
 * <br>2) A JavaScript file of the same name "<i>YOURPAGENAME.js</i>"
 * <br>3) An XXL file of the same name "<i>YOURPAGENAME.xsl</i>"
 * <br><br>
 * <b>NOTE:</b><i> Make sure you import all the 'YOURPAGENAME.js' scripts in the Index.html file</i><br>
 * <br>
 * @return null - this is a dummy script call.
 */
function SBSystem(){
	alert("Be Sure to read all the JavaScipt Docs!");
}
function logVisit(inTitle){
	//alert(document.title);
	AjaxExecutePHP("/html/howto/userlog.php", document.title);
}

/**
 * START OF REAL APPLICATION
 *
 * Global Variables - Passed to server.
 *
 * *IMPORTANT: global variables that are passed to the Framework need to be
 * named in the following format:<br>
 * 1) the name must start with a lowercase 'sys'
 * 2) they must be added to the java script which loads gloabl variables
 *
 * Session State Variables - MUST BE PRESENT
 *
 * @see FWSession.java
 */
var sysAccess				= "Page";
var sysLastForm				= "";
var sysCurrentForm			= "";
var sysSessionStartDateTime	= "";
var sysSessionEndDateTime	= "";
var sysAction				= "";
var localTransitionForm		= "";
var gDebug = false;
/**
 * The context area relates to a DIV tag in the Start.html page
 * and is used by the default response functions to load html data.
 */
var FormContextArea			= "ajaxcontextarea";
var FormTopArea				= "ajaxtoparea";
var FormHeaderArea			= "ajaxheaderarea";
var FormBottomArea			= "ajaxbottomarea";
var FormFooterArea			= "ajaxfooterarea";

/**
 * UI Variables not passed to server
 */
var Dirty 					= false;


/**
 * This function returns an HTTP Request object to be used when establishing
 * an Ajax call.
 *
 * @return HTTP Request Object
 */
function getRequestObj(){
	var req = null;
	try{
		document.getElementById("specialMsg").innerHTML = "<p>Request</p>";
	}catch(e){
		
	}
	if (window.XMLHttpRequest)     // Object of the current windows
	{
		req = new XMLHttpRequest();     // Firefox, Safari, ...
	}
	else
	 if (window.ActiveXObject)   // ActiveX version
	 {
		 req = new ActiveXObject("Microsoft.XMLHTTP");  // Internet Explorer
	 }
	return req;
}

/**
 * Performs a page level AJAX call to the specified Servlet (href). This function is
 * used when you need to simply capture well formed HTML.
 * This function automaticly loads all form if bLoadFormValues = true or
 * if false, only loads global sys* values.
 *
 * NOTE: No Supporting page functions are required.
 *
 * <br>
 * @see AjaxRequest()
 * @see getAllFormValues()
 * @param href String parameter containing the name of the servlet to be called.
 * @param target String name of the target HTML object which will be loaded with the returned .text value of the request object
 * @param IncludeFormData boolean used to indicate if formvalues should be sent.
 * @return null
 */
function AjaxRequestPage(servletName, Action, Access, Target) {

	try{
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= Access;
		setGlobalFormValuesFromMemory(sysCurrentForm);

		var cmd;
		var method 			= 'POST';
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake

		var req = getRequestObj();
		if(req){
			try{
				req.onreadystatechange=function(){
					//xmlSimpleResponse(req, Target);
					xmlResponse(req, Target,"Request_Return");
				};
				try{
					document.getElementById("imgPleaseWait").style['visibility']="visible";
				}catch(err){
					alert("[sbGeneral].AjaxRequestPage."+localTransitionForm+": ERROR 0250: Object 'imgPleaseWait' not found on page. \nRemove all references from your JavaScript, or added the image object to the Parent HTML file.");
				}

				var toSend = getGlobalValuesFromMemory(sysCurrentForm);
				req.open(method, url, true);
				req.setRequestHeader("Content-length", toSend.length);
				req.setRequestHeader("content-type","application/x-www-form-urlencoded");

				req.send(toSend);
			}catch(err){
				req = null;
				document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPage."+localTransitionForm+": ERROR 0251:"+err.description;
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
			}
		}else{
			req = null;
			document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPage."+localTransitionForm+": ERROR 0252: Your browser does not seem to support XMLHttpRequest.";
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
		}
	}catch(err){
		req = null;
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPage."+localTransitionForm+": ERROR 0253:"+err.description+"";
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}
}
/**
 * Performs a page level AJAX call to the specified Servlet (href). This function is
 * used when you need to simply capture well formed HTML and you want to display the page in a pop-up window.
 * This function automaticly loads all form if bLoadFormValues = true or
 * if false, only loads global sys* values.
 *
 * NOTE: No Supporting page functions are required.
 *
 * <br>
 * @see AjaxRequestPage()
 * @see getAllFormValues()
 * @param href String parameter containing the name of the servlet to be called.
 * @param target String name of the target HTML object which will be loaded with the returned .text value of the request object
 * @param IncludeFormData boolean used to indicate if formvalues should be sent.
 * @return null
 */
function AjaxRequestPopUp(servletName, Action, Access, Target) {

	try{
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= Access;
		setGlobalFormValuesFromMemory(sysCurrentForm);

		var cmd;
		var method 			= 'POST';
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake

		var req = getRequestObj();
		if(req){
			try{
				req.onreadystatechange=function(){
					//xmlSimpleResponse(req, Target);
					xmlPopUpResponse(req, Target,"Request_Return");
				};
				try{
					document.getElementById("imgPleaseWait").style['visibility']="visible";
				}catch(err){
					alert("[sbGeneral].AjaxRequestPopUp."+localTransitionForm+": ERROR 0250: Object 'imgPleaseWait' not found on page. \nRemove all references from your JavaScript, or added the image object to the Parent HTML file.");
				}
				var toSend = getGlobalValuesFromMemory(sysCurrentForm);
				req.open(method, url, true);
				req.setRequestHeader("Content-length", toSend.length);
				req.setRequestHeader("content-type","application/x-www-form-urlencoded");

				req.send(toSend);
			}catch(err){
				req = null;
				document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPopUp."+localTransitionForm+": ERROR 0259:"+err.description+"";
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
			}
		}else{
			req = null;
			document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPopUp."+localTransitionForm+": ERROR 0259: Your browser does not seem to support XMLHttpRequest.";
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
		}
	}catch(err){
		req = null;
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestPopUp."+localTransitionForm+": ERROR 0259:"+err.description+"";
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}
}

/**
 * Performs a page level AJAX call to the specified Servlet (href). This function is
 * used when you need to simply capture well formed HTML.
 * This function automaticly loads all form if bLoadFormValues = true or
 * if false, only loads global sys* values.
 *
 * NOTE: No Supporting page functions are required.
 *
 * <br>
 * @see AjaxRequest()
 * @see getAllFormValues()
 * @param href String parameter containing the name of the servlet to be called.
 * @param target String name of the target HTML object which will be loaded with the returned .text value of the request object
 * @param IncludeFormData boolean used to indicate if formvalues should be sent.
 * @return null
 */
function AjaxRequestHTML(servletName, Action, Target) {
	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= 'Raw';
		var cmd;
		var method 			= 'POST';
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		var req = getRequestObj();
		if(req){
			try{
				try{
					req.onreadystatechange=function(){
						xmlHTMLResponse(req, Target, localTransitionForm, Action);
					};
		        	var bResult = setGlobalFormValuesFromMemory(sysCurrentForm);
					var toSend;
					try{
						toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
					}catch(err){
						toSend = "sysAccess=Raw&sysAction="+Action+"&sysCurrentForm="+sysCurrentForm;
					}
					try{
						req.open(method, url, true);
						req.setRequestHeader("Content-length", toSend.length);
						req.setRequestHeader("content-type","application/x-www-form-urlencoded");
						req.send(toSend);
					}catch(err){
						document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestHTML."+sysCurrentForm+": ERROR 0269:"+err.description+"";
						document.getElementById(Target).innerHTML="<p>ERROR: Failed to return proper HTML</p>";
						document.getElementById("imgPleaseWait").style['visibility']="hidden";
					}

		        }catch(err){
		        	document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestHTML."+sysCurrentForm+": ERROR 0270:"+err.description+"";
		        	document.getElementById("imgPleaseWait").style['visibility']="hidden";
		        }
			}catch(err){
				req = null;
				alert("[sbGeneral].AjaxRequestHTML: ERROR 0280:"+err.description);
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
			}
		}else{
			req = null;
			document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestHTML."+localTransitionForm+": ERROR 0281: Your browser does not seem to support XMLHttpRequest.";
		}
	}catch(err){
		req = null;
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestHTML."+localTransitionForm+": ERROR 0282:"+err.description+"";
		document.getElementById("imgPleaseWait").style['visibility']="hidden";

	}
	document.getElementById("imgPleaseWait").style['visibility']="hidden";
}
/**
 * Calls a PHP page, but takes no action. This call is assumed to be a server side only action, with no values returned
 * 
 * @param servletName
 * @param Action
 */
function AjaxExecutePHP(servletName, Action) {
	try{
		var method 			= 'GET';
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		//alert(modifiedurl);
		var req = getRequestObj();
		//alert("request object");
		if(req){
			var toSend = "sysFormName="+Action;
			try{
				//alert(url+"?"+toSend);
				req.open(method, url+"?"+toSend, true);
				req.send(null);//toSend);
			}catch(err){
				alert("[sbGeneral].AjaxRequestHTML."+url+"?"+toSend+": ERROR 10269:"+err.description);
			}
		}else{
			req = null;
		    alert("[sbGeneral].AjaxRequestHTML."+Action+": ERROR 10281: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		req = null;
		alert("[sbGeneral].AjaxRequestHTML."+Action+": ERROR 10282b:"+err.description);
	}
}
function AjaxGetStaticHTML(servletName,  Target) {
	try{
		var method 			= 'GET';
		//var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var modifiedurl 	= "http://"+window.location.hostname+":"+window.location.port+servletName;
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		var req = getRequestObj();
		if(req){

			try{
				//alert(url);
				req.open(method, url, false);
				req.send(null);//toSend);
				document.getElementById(Target).innerHTML=req.responseText;
			}catch(err){
				alert("[sbGeneral].AjaxRequestHTML."+url+"?"+toSend+": ERROR 10269:"+err.description);
			}
		}else{
			req = null;
			alert("[sbGeneral].AjaxRequestHTML."+Action+": ERROR 10281: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		req = null;
		alert("[sbGeneral].AjaxRequestHTML."+Action+": ERROR 10282:"+err.description);
	}
}
/**
 * Synchronised HTML request from the servlet. This call will wait until the response is returned before loading the
 * HTML into the target DIV tag. This function is seldom needed.
 *
 * @param servletName
 * @param Action
 * @param Target
 */
function AjaxRequestHTMLSync(servletName, Action, Target) {
	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= 'Raw';
		var cmd;
		var method 			= 'POST';
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		var req = getRequestObj();
		if(req){
			try{
				try{
		        	var bResult = setGlobalFormValuesFromMemory(sysCurrentForm);
					var toSend;
					try{
						toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
					}catch(err){
						toSend = "sysAccess=Raw&sysAction="+Action+"&sysCurrentForm="+sysCurrentForm;
					}
					try{
						try{
							document.getElementById("imgPleaseWait").style['visibility']="visible";
						}catch(err){
							alert("[sbGeneral].AjaxRequestHTML."+localTransitionForm+": ERROR 0268: Object 'imgPleaseWait' not found on page. \nRemove all references from your JavaScript, or added the image object to the Parent HTML file.");
						}
						req.open(method, url, false);
						req.setRequestHeader("Content-length", toSend.length);
						req.setRequestHeader("content-type","application/x-www-form-urlencoded");
						req.send(toSend);
						document.getElementById(Target).innerHTML=req.responseText;
						getGlobalValuesFromForm(sysCurrentForm);
						document.getElementById("imgPleaseWait").style['visibility']="hidden";
					}catch(err){
						alert("[sbGeneral].AjaxRequestHTML."+sysCurrentForm+": ERROR 0269:"+err.description);
						document.getElementById(Target).innerHTML="<p>ERROR: Failed to return proper HTML</p>";
					}

		        }catch(err){
		        	alert("[sbGeneral].AjaxRequestHTML."+sysCurrentForm+": ERROR 0270:"+err.description);
		        }
			}catch(err){
				req = null;
				alert("[sbGeneral].AjaxRequestHTML: ERROR 0280:"+err.description);
			}
		}else{
			req = null;
			alert("[sbGeneral].AjaxRequestHTML."+localTransitionForm+": ERROR 0281: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		req = null;
		alert("[sbGeneral].AjaxRequestHTML."+localTransitionForm+": ERROR 0282:"+err.description);
	}
	document.getElementById("imgPleaseWait").style['visibility']="hidden";
}
/**
 *General purpose AJAX handler for requesting XML Data.
 * This will be used for all normal "Request/Response" type activity.
 *<br>
 *This function assumes that you have a javascript file for each "form" or "page" in your application. So
 *<br>if you have a page called 'Logon', then you need a related Logon.js which implements the following;
 *<br><br>
 *<b>This function assumes the following functions implemented in your form.</b>
 *   <br><i>YOURFORMNAME</i>_preRequestAction(Action); - validate if the action should be allowed to occur.
 *   <br><i>YOURFORMNAME</i>_getDataToSend(Action); - This function should call getAllFormValues() or create the string of value pairs.
 *   <br><i>YOURFORMNAME</i>_postRquestAction(Action, request); - here you will implement handling of the return data
 *   <br>
 * @see getAllFormValues()
 * @param servletName 		String - Servlet Name to Call - System name is appended by default.
 * @param formname			String - Name of the form which contains all the methods required.
 * @return null;
 */
function AjaxRequestData(servletName, Action){
	//xmlOpen('POST', urlToPost, sysFormValues, "add");

	//Default Method is Post.
	//This function assumes the following functions;
	//  formname_preRequestAction(Action);
	//  formname_getDataToSend(Action);
	//  formname_postRequestAction(Action, request)

	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "Data";
		var cmd;
		var method 			= 'POST';
		var val 			= true;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake

		setGlobalFormValuesFromMemory(sysCurrentForm);
		var req = getRequestObj();
		if(req){
			req.onreadystatechange=function(){
				eval(sysCurrentForm+'_postRequestAction(Action, req)');
			};
			isValid = eval(sysCurrentForm+'_preRequestAction(Action)');
			if(isValid){
				document.getElementById("imgPleaseWait").style['visibility']="visible";
				toSend = eval(sysCurrentForm+'_getDataToSend(Action, localTransitionForm)');
				req.open(method, url, true);
				req.setRequestHeader("Content-length", toSend.length);
				req.setRequestHeader("content-type","application/x-www-form-urlencoded");
				req.send(toSend);
			}else{
				req = null;
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
				document.getElementById("specialMsg").innerHTML = "Fix fields in error<b>";
			}
		}else{
			req = null;
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
			alert("[sbGeneral].AjaxRequestData."+sysCurrentForm+": ERROR 0271: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		req = null;
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].AjaxRequestData."+sysCurrentForm+": ERROR 0272:"+err.description+"";
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}

}
function AjaxStartListener(servletName, Action){
	try{
		//document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "StartListener";
		var cmd;
		var method 			= 'POST';
		var val 			= true;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake

		setGlobalFormValuesFromMemory(sysCurrentForm);
		var lReq = getRequestObj();
		if(lReq){
			lReq.onreadystatechange=function(){
				eval(sysCurrentForm+'_ListenerReturn(Action, lReq)');
			};
			isValid = eval(sysCurrentForm+'_preRequestAction(Action)');
			if(isValid){
				document.getElementById("imgPleaseWait").style['visibility']="visible";
				toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
				lReq.open(method, url, true);
				lReq.setRequestHeader("Content-length", toSend.length);
				lReq.setRequestHeader("content-type","application/x-www-form-urlencoded");
				lReq.send(toSend);
			}else
				lReq=false;
		}else{
			lReq=null;
			alert("[sbGeneral].AjaxStartListener."+sysCurrentForm+": ERROR 0801: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		lReq=null;
		alert("[sbGeneral].AjaxStartListener."+sysCurrentForm+": ERROR 0802:"+err.description);
	}
	document.getElementById("imgPleaseWait").style['visibility']="hidden";
}
function AjaxNotifyListeners(servletName, Action){
	try{
		//document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "NotifyListeners";
		var cmd;
		var method 			= 'POST';
		var val 			= true;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake

		setGlobalFormValuesFromMemory(sysCurrentForm);
		var nReq = getRequestObj();
		if(nReq){
			nReq.onreadystatechange=function(){
				eval(sysCurrentForm+'_NotifyReturn(Action, nReq)');
			};
			isValid = eval(sysCurrentForm+'_preRequestAction(Action)');
			if(isValid){
				document.getElementById("imgPleaseWait").style['visibility']="visible";
				toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
				//alert(url+"?"+toSend);
				nReq.open(method, url, true);
				nReq.setRequestHeader("Content-length", toSend.length);
				nReq.setRequestHeader("content-type","application/x-www-form-urlencoded");
				nReq.send(toSend);
			}else{
				nReq=false;
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
			}
		}else{
			nReq=false;
			alert("[sbGeneral].AjaxNotifyListeners."+sysCurrentForm+": ERROR 0103: Your browser does not seem to support XMLHttpRequest.");
		}
	}catch(err){
		nReq=false;
		alert("[sbGeneral].AjaxNotifyListeners."+sysCurrentForm+": ERROR 0203:"+err.description);
	}
	document.getElementById("imgPleaseWait").style['visibility']="hidden";
}

/**
 * This will be used for all normal "Request/Response" type activity.
 *<br>
 *This function assumes that you have a javascript file for each "form" or "page" in your application. So
 *<br>if you have a page called 'Logon', then you need a related Logon.js which implements the following;
 *<br><br>
 *<b>This function assumes that you have implement the following function in your page script,</b>
 *   <br><i>YOURFORMNAME</i>_Submit_PreSubmit(req, Action);
 *   <br><i>YOURFORMNAME</i>_Submit_Return(req, Action);
 *   <br>
 * @param servletName
 * @param Action
 * @return
 */

function AjaxSubmitPage(servletName, Action, Target){
	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "Page";
		var cmd;
		var method 			= 'POST';
		var isValid         = false;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		try{
        	var bResult = setGlobalFormValuesFromMemory(sysCurrentForm);
        }catch(err){
        	alert("[sbGeneral].AjaxSubmitPage."+sysLastForm+": ERROR 0271:"+err.description);
        }
		var req = getRequestObj();
		if(req){
			try{
				cmd = sysCurrentForm+'_Submit_PreSubmit(sysAction)';
				isValid = eval(cmd);
			}catch(err){
				alert("[sbGeneral].AjaxSubmitPage."+sysCurrentForm+": ERROR 0280: Failed to Execute:"+cmd);
			}
			if(isValid){
				try{
					req.onreadystatechange=function(){
						xmlResponse(req, Target,"Submit_Return");
					};
					var toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
					req.open(method, url, true);
					req.setRequestHeader("Content-length", toSend.length);
					req.setRequestHeader("content-type","application/x-www-form-urlencoded");
					req.send(toSend);
				}catch(err){
					alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0290:"+err.description);
					document.getElementById("imgPleaseWait").style['visibility']="hidden";
				}
			}else{
				req = null;
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
				alert("Fix fields in error");
			}
		}else{
			alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0300: Your browser does not seem to support XMLHttpRequest.");
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
		}
	}catch(err){
		alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0402:"+err.description);
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}

}
function AjaxSubmitPageNoValidate(servletName, Action, Target){
	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "Page";
		var cmd;
		var method 			= 'POST';
		var isValid         = true;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 			= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
		try{
        	var bResult = setGlobalFormValuesFromMemory(sysCurrentForm);
        }catch(err){
        	alert("[sbGeneral].AjaxSubmitPage."+sysLastForm+": ERROR 0271:"+err.description);
        }
		var req = getRequestObj();
		if(req){
			try{
				req.onreadystatechange=function(){
					xmlResponse(req, Target,"Submit_Return");
				};
				var toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
				req.open(method, url, true);
				req.setRequestHeader("Content-length", toSend.length);
				req.setRequestHeader("content-type","application/x-www-form-urlencoded");
				req.send(toSend);
			}catch(err){
				alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 10290:"+err.description);
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
			}
		}else{
			alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 10300: Your browser does not seem to support XMLHttpRequest.");
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
		}
	}catch(err){
		alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 10402:"+err.description);
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}

}

/**
 * This will be used to submit data to a different servlet. The PreSubmit function will be called for
 * the current form, but the Submit_return function of the target form js will recieve the returning
 * values.
 *
 *<br>
 *This function assumes that you have a javascript file for each "form" or "page" in your application. So
 *<br>if you have a page called 'Logon', then you need a related Logon.js which implements the following;
 *<br><br>
 *<b>This function assumes that you have implement the following function in your page script,</b>
 *   <br><i>YOURFORMNAME</i>_Submit_PreSubmit(req, Action);
 *   <br><i>YOURFORMNAME</i>_Submit_Return(req, Action);
 *   <br>
 * @param servletName
 * @param Action
 * @return
 */

function AjaxSubmitToPage(servletName, Action, Target){
	//xmlOpen('POST', urlToPost, sysFormValues, "add");

	//Default Method is Post.
	//This function assumes the following functions;
	//  formname_preRequestAction(Action);
	//  formname_getDataToSend(Action);

	try{
		document.getElementById("imgPleaseWait").style['visibility']="visible";
		localTransitionForm = servletName;
		sysAction 			= Action;
		sysAccess 			= "Page";
		var cmd;
		var method 			= 'POST';
		var isValid         = false;
		servletName 		= "/"+sysProjectName+"/"+servletName;
		var modifiedurl 	= servletName.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
		var url 				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
        //alert(url);
		try{
        	var bResult = setGlobalFormValuesFromMemory(sysCurrentForm);

        }catch(err){
        	alert("[sbGeneral].AjaxSubmitPage."+sysCurrentForm+": ERROR 0272:"+err.description);
        }
		var req = getRequestObj();
		if(req){

			try{
				cmd = sysCurrentForm+'_Submit_PreSubmit(sysAction)';
				isValid = eval(cmd);
				//alert(isValid);
			}catch(err){
				alert("[sbGeneral].AjaxSubmitPage."+sysCurrentForm+": ERROR 0280: Failed to Execute:"+cmd);
			}
			if(isValid){
				try{

					req.onreadystatechange=function(){
						xmlResponse(req, Target,"Submit_Return");
					};
					var toSend = eval(sysCurrentForm+'_getDataToSend(Action)');
					req.open(method, url, true);
					req.setRequestHeader("Content-length", toSend.length);
					req.setRequestHeader("content-type","application/x-www-form-urlencoded");
					sysCurrentForm = servletName;
					req.send(toSend);
				}catch(err){
					req = null;
					alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0290:"+err.description);
					document.getElementById("imgPleaseWait").style['visibility']="hidden";
				}
			}else{
				req = null;
				document.getElementById("imgPleaseWait").style['visibility']="hidden";
				alert("Fix fields in error");
			}
		}else{
			req = null;
			alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0300: Your browser does not seem to support XMLHttpRequest.");
			document.getElementById("imgPleaseWait").style['visibility']="hidden";
		}
	}catch(err){
		alert("[sbGeneral].AjaxSubmitPage."+localTransitionForm+": ERROR 0401:"+err.description);
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}
}
/**
 * Not sure why this is here, but you never know - it is current not used.
 *
 * @param servlet
 * @return
 */
function AjaxRequestWSDL(servlet) {

	localTransitionForm 	= servlet;
	servlet 				= "/"+sysProjectName+"/"+servlet;
	var modifiedurl=servlet.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":"+window.location.port+"/");
	var url 				= modifiedurl; //replace URL's root domain with dynamic root domain, for ajax security sake
	var str1 				= "";
	sysAccess 				= "WSDL";
	sysAction 				= "WSDL";
	sysFormIsDirty 			= 0;
	var req 				= getRequestObj();

	setGlobalFormValuesFromMemory(localTransitionForm);
	str1 					= getGlobalValuesFromMemory(localTransitionForm)+"&WSDL=YES";

	req.onreadystatechange = function() {
			rawXmlResponse(req);
	};
	//alert(url+"?"+str1);
	req.open('POST', url, false);
	req.setRequestHeader("content-type", "application/x-www-form-urlencoded");
	req.send(str1);

}
/**
 * This function checks the sysCurrentForm value and if it has changed, the new form is loaded. This
 * allows the application to dictate workflow. If the sysCurrentForm variable starts with goto.xxxx then
 * the branching will occur.
 *<br></br>
 * You can custom "rules" handlers here as well. Just add an else to the "goto" check below. Extend the "dot" notation
 * pass parameters, for example;
 * <pre>
 * * }else if(branch[0] == "foo"){
 *      your custom rule handler
 *      branch[1]
 * }
 * </pre>
 * @return
 */
function EvaluateResponse(){
	var ret = false;
	try{
		if(sysCurrentForm.indexOf(".")>0){
			var branch = sysCurrentForm.split(".");
			if(branch[0] == "goto"){
				ret = true;
				sysCurrentForm = branch[1];
				AjaxRequestPage(sysCurrentForm, "Init", "Page",  FormContextArea);
			}//else if(branch[0] == "foo"){ your custom handler }
		}
		FWTableRule.Init('Rule_01_Editor');
	}catch(err){
		//Just dump this error - this allows the above table to be init'd if used. Crap solution
	}
    return ret;
}
/**
 * This function is called from AjaxSubmitPage(String, String)
 * after execution of the AJAX call. The resulting REQUEST.ResponseText
 * is loaded into the specified Target. and the *_Return() handler is called.
 *
 * @param req HTTPRequst object, usually obtained from a call to the browser safe getRequestObj()
 * @param target String name of the target HTML object which will be loaded with the returned .text value of the request object
 * @return null
 */
function xmlResponse(req, Target, handler){
	if (req.readyState == 4 && (req.status == 200)) {
		document.getElementById("specialMsg").innerHTML = "Response recieved";
		sysLastForm = sysCurrentForm;
		sysCurrentForm = localTransitionForm;
		eval(sysCurrentForm+'Dirty='+false);
        try{
		    document.getElementById(Target).innerHTML=req.responseText;
        }catch(err){
        	alert("ERROR xmlResponse: Possible invalid target tag ("+Target+"):"+err.description);
        }
        try{
        	getGlobalValuesFromForm(sysCurrentForm);
        }catch(err){
        	alert("ERROR xmlResponse: Problem with form ("+sysCurrentForm+"):"+err.description);
        }
		try{
			if(sysCurrentForm != ""){
			if(!EvaluateResponse()){
				ReturnHandler = sysCurrentForm+'_'+handler+'(sysCurrentForm, req, sysAction)';
				eval(ReturnHandler);
			}else{
				//goto branch found - see EvaluateRepsonse() function
			}}
		}catch(err){
			document.getElementById("specialMsg").innerHTML = "[sbGeneral].xmlResponse. Call to "+sysCurrentForm+"_"+handler+" failed. : ERROR 0500:"+err.description;
		}
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	} else if (req.readyState == 4 && (req.status != 200)) {
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].xmlResponse."+sysCurrentForm+": ERROR 0600: Your request may have timed out. Please try again."+req.status;
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	}
	
}
/**
 * This function is called from AjaxSubmitPopUp:
 * IMPORTANT: When you call a pop-up, you are basicly starting a new session in a new window. You will
 * need to supply all the import functions, etc.
 *
 * @param req HTTPRequst object, usually obtained from a call to the browser safe getRequestObj()
 * @param target String name of the target HTML object which will be loaded with the returned .text value of the request object
 * @return null
 */
function xmlPopUpResponse(req, Target, handler){
	if (req.readyState == 4 && (req.status == 200)) {
		document.getElementById("specialMsg").innerHTML = "Response recieved";
		var PopUpTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"+
		"<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>"+
		"<head>"+
		"<title>GalenaAdmin (Edit in /html/app/index.template)</title>"+
		"<link rel='stylesheet' type='text/css' href='html/css/application.css' />"+
		"<script type='text/javascript' src='html/scripts/fwadmin/AjaxLib.js'></script>"+
		"<script type='text/javascript' src='html/scripts/fwadmin/sbGeneral.js'></script>"+
		"<script type='text/javascript' src='html/scripts/fwadmin/utils/formValidation.js'></script>"+
		"<script type='text/javascript' src='html/scripts/fwadmin/utils/FWAsyncAjax.js'></script>"+
		"<script type='text/javascript' src='html/scripts//FWDirect.js'></script>"+
		"<script type='text/javascript' src='html/scripts/fwadmin/admin/assignments.js'></script>"+
		"</head>"+
		"<body>"+
		"<script type='text/javascript' src='html/bodyscripts/admin/wz_tooltip.js'></script>"+
		"<script type='text/javascript' src='html/bodyscripts/tip_centerwindow.js'></script>"+
		"<script type='text/javascript' src='html/bodyscripts/tip_followscroll.js'></script>"+
		"<script type='text/javascript'>"+
		"	var sysProjectName 	= 'GalenaAdmin';"+
		"</script>"+
		"<body class='mainbody'>"+
		"<center><div id='popup' name='popup'>";

		var PopUpBottom = "</div></center>"+
		"</body>"+
		"</html>";

		var vWinCal;
		vWinCal= window.open("", "QuickCheck","width=450,height=400,status=no,resizable=yes,top=200,left=200");
	    vWinCal.opener = self;
		var calc_doc = vWinCal.document;
		calc_doc.write (PopUpTop + req.responseText + PopUpBottom);
		calc_doc.close();
		vWinCal.focus();

	} else if (req.readyState == 4 && (req.status != 200)) {
		alert("[sbGeneral].xmlResponse."+sysCurrentForm+": ERROR 0600: Your request may have timed out. Please try again."+req.status);
	}
	document.getElementById("imgPleaseWait").style['visibility']="hidden";
}
/**
 * This is function is used to return RAW html (not transformed via XSL/T on the server). Use this get targeted HTML
 * for loading screen sections, portlets etc.
 *
 * @param req
 * @param Target
 * @param sName
 * @param inAction
 */
function xmlHTMLResponse(req, Target, sName, inAction){
	if (req.readyState == 4 && (req.status == 200)) {
		try{
			document.getElementById("specialMsg").innerHTML = "Response recieved";
			var htmlReps = req.responseText;
			document.getElementById(Target).innerHTML= htmlReps;
			getGlobalValuesFromForm(sysCurrentForm);
		}catch(e){
			document.getElementById("specialMsg").innerHTML = "ERROR"+e.message;
		}
		try{
			if(!EvaluateResponse()){
				ReturnHandler = sName+'_HTML_Return(sysCurrentForm, req, inAction)';
				eval(ReturnHandler);
			}
		}catch(e){
			document.getElementById("specialMsg").innerHTML = "ERROR"+e.message;
		}
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
	} else if (req.readyState == 4 && (req.status != 200)) {
		document.getElementById("imgPleaseWait").style['visibility']="hidden";
		document.getElementById("specialMsg").innerHTML = "[sbGeneral].xmlHTMLResponse."+sysCurrentForm+": ERROR 0880: Your request may have timed out. Please try again."+req.status;
	}
}
//function xmlSimpleResponse(req, Target){
//	if (req.readyState == 4 && (req.status == 200)) {
//		sysLastForm = sysCurrentForm;
//		sysCurrentForm = localTransitionForm;
//		eval(sysCurrentForm+'Dirty='+false);
//		document.getElementById(Target).innerHTML= req.responseText;
//		getGlobalValuesFromForm(sysCurrentForm);
//		try{
//			if(!EvaluateResponse()){
//				var ReturnHandler = "Not Found";
//				sValid = eval(sysCurrentForm+'_Request_Return(sysCurrentForm)');
//			}
//		}catch(Ignore){}
//		document.getElementById("imgPleaseWait").style['visibility']="hidden";
//	} else if (req.readyState == 4 && (req.status != 200)) {
//		document.getElementById("imgPleaseWait").style['visibility']="hidden";
//		alert("[sbGeneral].xmlSimpleResponse."+sysCurrentForm+": ERROR 0700: Your request may have timed out. Please try again."+
//				"\n NOTE: Make sure that the 'var sysProjectName = "+sysProjectName+"' is correct in your startup html file!\nStatus:"+req.status);
//	}
//
//
//}
/**
 * This function is used to load any global varables you may wish to send to the servlet(s) framework
 * it is good practice to add your global variables to sbGeneral.js file, and to include them in all your posts
 * <br><br>
 * As a rule, if you pass all your important global variables to the servlet, you can then
 * return, and reload them.
 *
 * @see
 * getGlobalValuesFromForm(fobj)<br>
 * setGlobalFormValuesFromMemory(fobj)
 *
 * @return
 */
function getGlobalValuesFromMemory(inFormID) {
	var str = getAllHiddenFields(inFormID);
	if(str.length < 1){
		//alert("Using Default Properties:"+sysLastForm);
    	str = "sysAccess=" 				+ sysAccess 				+
    	"&" + "DefaultSysValuesUsed=YES"  +
    	"&" + "sysLastForm=" 			+ sysLastForm 			    +
    	"&" + "sysCurrentForm=" 		+ inFormID					+
    	"&" + "sysSessionStartDateTime="+ sysSessionStartDateTime	+
    	"&" + "sysSessionEndDateTime=" 	+ sysSessionEndDateTime 	+
    	"&" + "sysAction=" 				+ sysAction 				+
    	"&" + "sysProjectName="			+ sysProjectName;
	}

	return str;
}
/**
 * Creates an HTTP Ajax compatable Submit string containing all the hidden fields
 * on the form. The format of the string is as follows;
 * 
 * name=value&name=value&...&name=value
 * 
 * Note: The string does not start or end with any special characters.
 *
 * @param formID String for form ID attribute. Each XSL
 * form needs to have a Name and an ID attribute set to
 * the same value.
 *
 * @return
 */
function getAllHiddenFields(formID){
	var str = '';
	try{
		var elem = document.getElementById(formID).elements;
		for(var i = 0; i < elem.length; i++) {
			try{
				if(elem[i].type == "hidden" && elem[i].className == "sys_value"){
					str += elem[i].name+"=" + elem[i].value +"&";
				}
			}catch(Ex){
				alert("DOH Missed it:");
			}
		}
	}catch(err){
		//alert("[sbGeneral].getAllHiddenFields."+formID+" FORM NOT FOUND:"+err.description);
	}
    
	return  str;
}
/**
 * Creates an HTTP Ajax compatable Submit string containing all the fields
 * with and ID starting with the underscore character. The format of the string is as follows;
 * 
 * name=value&name=value&...&name=value
 * 
 * Note: The string does not start or end with any special characters. 
 * This function 
 * @param formID
 * @returns {String}
 */
function getAllDBFields(formID){
	var str = '';
	try{
		var elem = document.getElementById(formID).elements;
		for(var i = 0; i < elem.length; i++) {
			try{
				if(startsWith(elem[i].id, "_")){
					str += elem[i].name+"=" + elem[i].value +"&";
				}
			}catch(Ex){
				alert("DOH Missed it:");
			}
		}
	}catch(err){
		//alert("[sbGeneral].getAllHiddenFields."+formID+" FORM NOT FOUND:"+err.description);
	}

	return  str;
}
/**
 * This function extracts the Global values off the supplied form object, and updates the
 * the respective javascript global variable.<br>
 * <br>
 * @param fobj Form Object
 * @return
 */
function getGlobalValuesFromForm(fobj){
	var formObjs = null;
	try{
		var elem = document.getElementById(fobj).elements;
		for(var i = 0; i < elem.length; i++) {
			try{
				if(elem[i].type == "hidden" && elem[i].className == "sys_value"){
					//if(elem[i].name == "sysRoleIndex"){
					//	alert("GetG Setting RoleIndex to "+elem[i].value);
					//}
					var elName = elem[i].name;
					window[elName] = elem[i].value;
				}
			}catch(err){
				alert("[sbGeneral].getGlobalValuesFromForm for Field "+elem[i].name+": ERROR 1000:"+err.description);
			}
		}
		//alert("getGlobal:"+sysRoleIndex);
	}catch(err){
		//alert("[sbGeneral].getGlobalValuesFromForm."+sysCurrentForm+":("+fobj+") ERROR 1001:"+err.description);
	}
	return true;
}
function hideFormValue(fieldId){
	document.getElementById(fieldId).style['visibility']="hidden";
}
function showFormValue(fieldId){
	document.getElementById(fieldId).style['visibility']="visible";
}
/**
 * This function loads the in memory global values to the respective form
 * level global values.<br>
 * <br>
 *
 * @param fobj Form Object
 * @return
 */

function DisplayFormValues(formID) {

	var str = '';
	try{
		var elem = document.getElementById(formID).elements;
		for(var i = 0; i < elem.length; i++) {

			if(elem[i].type == "hidden" && elem[i].className == "sys_value"){
				str += "<"+elem[i].name+">" + elem[i].value +"</"+elem[i].name+">\n";
			}
		}
	}catch(err){
		alert("[sbGeneral].DisplayFormValues."+formID+" FORM NOT FOUND:"+err.description);
	}
    alert("FORM ID:"+formID+"\n"+str);
}
/**
 * This function loads form hidden, sys_value form elements with the value of a global variable of the same name.
 * @param formID
 * @returns {Boolean}
 */
function setGlobalFormValuesFromMemory(formID){
	//alert("START:setGlobalFormValuesFromMemory");
	
	try{
		var elem = document.getElementById(formID).elements;
		for(var i = 0; i < elem.length; i++) {
			try{
				if(elem[i].type == "hidden" && elem[i].className == "sys_value"){
					var elName = elem[i].name;
					if (window[elName] != undefined) 
						elem[i].value = window[elName];
				}
			}catch(err2){
				//alert("[sbGeneral].setGlobalFormValuesFromMemory."+sysCurrentForm+": ERROR 1101: Problem with element"+elName+"\n"+err.description);
			}
		}
	}catch(err){
		//alert("[sbGeneral].setGlobalFormValuesFromMemory."+sysCurrentForm+": ERROR 1100:"+err.description);
		return false;
	}
	//alert("END:setGlobalFormValuesFromMemory");
	return true;
}

/**
 * Form Loading Function
 *
 * @param formID String for form ID attribute. Each XSL
 * form needs to have a Name and an ID attribute set to
 * the same value.
 *
 * @return
 */
function getAllFormValues(formID){
	var inFobj = document.getElementById(formID);

	var tmpFormValues="";
	try{
		var formName = inFobj.id;
	}catch(err){
		if(sysCurrentForm == "DENIED")
			return true;
		alert("[sbGeneral].getAllFormValues."+sysCurrentForm+": ERROR 1200: Verirfy that the FORM NAME and ID are set correctly to "+sysCurrentForm+" in the forms XSL file."+err.description);
		return false;
	}
	if(inFobj.elements){

		for(var i = 0;i < inFobj.elements.length;i++) {
			try{
			var elClass = inFobj.elements[i].className;
			var elName  = inFobj.elements[i].id;
			if(trimAll(elName).length<1)
				elName = inFobj.elements[i].name;
			if(trimAll(elName).length>0){
				var elType  = inFobj.elements[i].type;
				var elValue = '';
				switch(elType){
				case 'hidden':
					//alert("getting:"+elName);
					elValue = inFobj.elements[i].value;
					break;
				case 'undefined':
					return null;
				case 'radio':
					elValue = inFobj.elements[i].checked;
					if(elValue)
						elValue = "true";
					else
						elValue = "false";
					break;
				case 'checkbox':
					elValue = inFobj.elements[i].checked;
					if(elValue){
						if(elClass.match("numeric"))
						   elValue = '1';
						else
						   elValue = "true";
					}else{
						if(elClass.match("numeric"))
						   elValue = '0';
						else
						   elValue = "false";
					}
					break;

				//case 'select': elValue = inFobj.elements[i].value; break;
				default: elValue = inFobj.elements[i].value; break;
				}
				if(trimAll(elValue).length > 0){
					//elClass contains the css class name. Match is simply a check to see
					//if the css class name for a field contains a specific constant, then
					//remove any formatting - feel free to add new types.
					if(elClass.match("currency")){
						elValue = removeCurrency(elValue);
					}else if(elClass.match("percent")){
						elValue = removePercent(elValue);
					}else if(elClass.match("interest")){
						elValue = removePercent(elValue);
					}else if(elClass.match("numeric")){
						elValue = removeCommas(elValue);
					}
				}
				if(elValue=="NaN" || elValue=="NaN%")
					elValue = "";
				//If the css prefix is 'local_', it is not meant for the server,
				//and should not be sent
				if(!elClass.match("local_")){
					tmpFormValues += elName + "=" + encodeURIComponent(elValue) + "&";
				}
			}
		}catch(e){
			alert("WooHoo"+e.description);
		}
		}

	}
	return  tmpFormValues;
}

/**
 * This function is called anytime an input field is changed on any screen. This allows
 * the developer/scripts to know if anything has changed. Why update, if nothing changes!
 * <br><br>
 * This functionaliy relies on the fact that each FORMNAME.js file contains certain required
 * variables and functions.
 * <br><br>
 * @param bool Flag passed to indicate a change.
 * @param formObject Object which has changed.
 * @param fieldType Fieldtype can be used to trigger formatting code. Use 'NONE' if you want to
 * avoid triggering the field validation routine.
 *
 * @return
 */
function dirtyForm(bool,formObject){
 	eval(sysCurrentForm+'Dirty='+bool);
	var elType  = formObject.type;
	var elValue="";
	var elName="";
	if(elType != "hidden"){
		var isValid = validateField(formObject);
	}
	if(elType=="checkbox"){

	}else{
		elValue = formObject.value;
		elName = formObject.name;
		cmd = sysCurrentForm + "_Validate("+ 'elName' +"," + 'elValue' + ")";
		eval(cmd);
	}
}
function validateForm(){
   validateForm(true);
}
function validateForm(removeErrors){
	var inFobj = null;
	var elLength = 0;
	var bResult = true;
	var bReturn = true;
	try{
		inFobj = document.getElementById(sysCurrentForm);
		elLength = inFobj.length;
	}catch(err){
		alert("[sbGeneral].validateForm."+sysCurrentForm+": ERROR 1400:"+err.description);
	}
	for(var i=0;i< elLength;i++){
		var elName  = inFobj.elements[i].name;
		var elClass = inFobj.elements[i].className;
		bResult = true;
		try{
			if(inFobj.elements[i].type == "hidden" && inFobj.elements[i].className == "sys_value"){
				window[inFobj.elements[i].name] = inFobj.elements[i].value;
			}
			if(startsWith(elClass,"req_") || startsWith(elClass,"opt_")|| startsWith(elClass,"local_")){
				bResult = validateField(inFobj.elements[i],removeErrors);
				if(!bResult)
					bReturn = false;
			}
		}catch(err){
			alert("[sbGeneral].validateForm."+sysCurrentForm+": ERROR 1500:"+err.description);
		}
	}

	return bReturn;
}
/**
 * This function is used to format the data based on the field type specified in the
 * XSL onchange event associate with each field.
 *
 * For Example: onchange="dirtyForm('1',this,'CURRENCY')"
 *
 * @param formObject
 * @param fieldType
 * @return
 */
function validateField(formObject){
	validateField(formObject, true);
}
function validateField(formObject, removeErrors){
	var isValid = true;
	var elClass = formObject.className;
	var fldInError = false;

	try{
		var elTitle = formObject.title;
		if(elTitle == "Error"){
			isValid = false;
		}else if(elTitle == "Disabled"){
			formObject.style.backgroundColor = "#dddddd";
		}
		if(elClass.match("_error")){
			fldInError = true;
		}
	}catch(err){
		alert("[sbGeneral].validateField: "+err.description);
	}
	var elValue = null;
	switch(formObject.type){
	case 'undefined': return null;
	case 'radio':break;
	case 'checkbox':
		elValue = formObject.value;
		if(elValue=="1" || elValue.toUpperCase()=="TRUE" || formObject.checked){
			formObject.checked = true;
		}else{
			formObject.checked = false;
		}
		break;
	case 'selected':
		//Added IF to make sure that optional select boxes are not flaged as in error
		if(startsWith(elClass,"req_") || startsWith(elClass,"opt_")|| startsWith(elClass,"local_")){
			elValue = formObject.selectedIndex;
			if(elValue < 1 && startsWith(elClass,"req_"))
				isValid = false;
				elClass = elClass.replace("_error","");
				if(!isValid){
					elClass = elClass+"_error";
				}
				formObject.className = elClass;
			
		}
		break;
	default:
		if(startsWith(elClass,"opt_") || startsWith(elClass,"req_")|| startsWith(elClass,"local_")){
			try{
				elValue = trimAll(formObject.value);
			}catch(err){
				elValue = formObject.value;
			}
			if(elValue.length>0){
				if(elClass.match("integerNonNeg")){
					elValue = removeCommas(elValue);
					isValid = isValidInteger(elValue);
					if(isValid) {
						try {
							//Extra parseFloat() for parseInt() bug for leading zeros
							elValue = "" + parseInt(parseFloat(elValue));
						} catch(err) {
							alert("[sbGeneral].validateField."+sysCurrentForm+": ERROR 1600:"+err.description);
						}
					}
					if(isValid && (elValue < '0' || elValue < 0 || startsWith(elValue,"-")))
						isValid = false;
				}else if(elClass.match("integerPreserveZero")){
					elValue = removeCommas(elValue);
					isValid = isValidInteger(elValue);
					if(isValid && elValue < '0')
						isValid = false;
				}else if(elClass.match("integer")){
					elValue = removeCommas(elValue);
					isValid = isValidInteger(elValue);
					if(isValid) {
						try {
							//Extra parseFloat() for parseInt() bug for leading zeros
							elValue = "" + parseInt(parseFloat(elValue));
						} catch(err) {
							alert("[sbGeneral].validateField."+sysCurrentForm+": ERROR 1500:"+err.description);
						}
					}
				}else if(elClass.match("currency")){
					strValue = elValue;
					strValue = removeCurrency(strValue);
					isValid = isValidNumeric(strValue);
					if(isValid){
						strValue = addCurrency(strValue);
						if(!strValue)
							isValid = false;
						else elValue = strValue;
					}
				}else if(elClass.match("percent")){
					strValue = elValue;
					strValue = removePercent(strValue);
					isValid = isValidNumeric(strValue);
					if(isValid){
						strValue = addPercent(strValue);
						if(!strValue)
							isValid = false;
						else elValue = strValue;
					}
				}else if(elClass.match("percent100")){
					strValue = elValue;
					strValue = removePercent(strValue);
					isValid = isValidNumeric(strValue);
					if(isValid){
						strValue = add100Percent(strValue);
						if(!strValue)
							isValid = false;
						else elValue = strValue;
					}else{
						isValid = true;
						elValue = add100Percent("0");
					}
				}else if(elClass.match("interest")){
					strValue = elValue;
					strValue = removeInterest(strValue);
					isValid = isValidNumeric(strValue);
					if(isValid){
						strValue = addInterest(strValue);
						if(!strValue)
							isValid = false;
						else elValue = strValue;
					}
				}else if(elClass.match("numeric")){
					elValue = removeCommas(elValue);
					if(isValidNumeric(elValue)){
						elValue = addCommas(elValue);
					}else
						isValid = false;
				}else if(elClass.match("numericNotZero")){
					isValid = isValidNumeric(elValue);
					if(isValid && elValue < '1')
						isValid = false;
					//alert(isValid);
				}else if(elClass.match("date")){
					elValue = changeDateFrmt(elValue);
					isValid =  inYrRangeUSDate(elValue, 1980, 2059);
				}else if(elClass.match("zipcode")){
					isValid = isValidUSZip(elValue);
				}else if(elClass.match("phone")){
					isValid = isValidUSPhone(elValue);
				}else if(elClass.match("email")){
					isValid = isValidEmail(elValue);
				}else if(elClass.match("ssn")){
					isValid = isValidSSN(elValue);
				}else {
					//isValid = true;
				}
			}else{
				if(startsWith(elClass,"req_") || startsWith(elClass,"req2_")){
					isValid = false;
				}else{
					isValid = true;
				}
			}

			if(isValid){
				var cmd = sysCurrentForm+"_Validate" + "("+ 'formObject.name' +"," + 'elValue' + ")";
				isValid = eval(cmd);
			}
			if(fldInError == true && removeErrors == false){
				//elClass = elClass+"_error";
				
			}else{
				elClass = elClass.replace("_error","");
				if(!isValid){
					elClass = elClass+"_error";
				}
			}

			formObject.value = elValue;
			formObject.className = elClass;
		}
	break;
	}
	//alert("Val:"+formObject.value+" Class:"+formObject.className);
	if(isValid)
		return true;
	else
		return false;

}
/**

 **/


/**
 * Gets the first child node of <code>parent</code> with the
 * specified tag name.
 *
 * @param parent the parent XML DOM node to search
 * @param tagName the tag name of the child node to search for
 */
function getNode(parent, tagName)
{
	var i;
	var max = parent.childNodes.length;

	// Check each child node
	for(i = 0; i < max; i++)
	{
		if(parent.childNodes[i].tagName)
		{
			if(parent.childNodes[i].tagName.toUpperCase() == tagName.toUpperCase())
			{
				// We found a matching child node; return it.
				return parent.childNodes[i];
			}
		}
	}
	// One was not found; return null
	return null;
}

/**
 * Gets the first child node of <code>parent</code> with the
 * specified tag name and whose value of the 'key' attribute
 * is <code>key</code>.
 *
 * @param parent the parent XML DOM node to search
 * @param tagName the tag name of the child nodes to search in
 * @param key the value of the 'key' attribute to search on
 */
function getNodesWithKey(parent, tagName, key)
{
	var i;
	var cellNodes = parent.getElementsByTagName(tagName);
	var max = cellNodes.length;

	// Check each cell node for the specified value for
	// the 'key' attribute
	for(i = 0; i < max; i++)
	{
		if(cellNodes[i].getAttribute('key') == key)
		{
			// We found a matching cell node; return it.
			return cellNodes[i];
		}
	}
	// One was not found; return null
	return null;
}
/**
Loads an XML response from the host and triggers node events.
Parm1 = responseXML
Parm2 = Parent Tag you want to start process from.
Parm3 = Everytime a Parent node with children is detected, this event is fired
Parm4 = Everytime a childnode w/a value is incountered this event is fired.

 Sample: ProcessXMLResp(inXML, "replyRoot", "xmlGlobalParent", "xmlGlobalChild" );

 **/
function ProcessXMLResp(inXML, ParentTag, parentHandler, childHandler){
	var str="";
	for (var i=0;i<inXML.childNodes.length;i++){
		//alert("[ProcessXMLResp]\n"+inXML.childNodes[i].nodeName +"="+ ParentTag);
		if(inXML.childNodes[i].nodeName == ParentTag){
			getChildrenFor(inXML.childNodes[i], parentHandler, childHandler);
		}
	}
}
/**
 *
 * @param dom
 * @param parentHandler
 * @param childHandler
 * @return
 */
function getChildrenFor(dom, parentHandler, childHandler){
	if(dom.childNodes.length){
		var cDom;
		var elValue="";
		var elID="";
		var pID="";
		var elName = dom.nodeName;
		var cmd = parentHandler +"("+ 'elName' + ")";
		try{pID = dom.getAttribute('id');}catch(err){pID = "";}
		cmd = parentHandler + "('"+ elName +"','" + pID + "')";
		//var NameString="";
		eval(cmd);
		for (var i=0;i<dom.childNodes.length;i++){
			cDom = dom.childNodes[i];
			if(cDom.childNodes.length>1)
				getChildrenFor(cDom, parentHandler, childHandler);
			else{
				if(cDom.childNodes[0]){
					//try{
					elName = cDom.nodeName;
					try{elValue = cDom.childNodes[0].nodeValue;
					}catch(err){
						//alert("Setting to null:"+escape(cDom.childNodes[0].nodeValue));
						elValue="&nbsp;";
					}
					try{elID = cDom.getAttribute('id');}catch(err){elID = "";}
					//NameString += elName+",";

					cmd = childHandler + "('"+ escape(elName) +"','" + escape(elValue) +"','" + elID+ "')";
					try{
						eval(cmd);
					}catch(err){
						try{
							elValue = elValue.replace("(","[");
							elValue = elValue.replace(")","]");
							cmd = childHandler + "('"+ escape(elName) +"','" + escape(elValue) +"','" + elID+ "')";
						}catch(err){
							//alert("Error:"+unescape(cmd));
						}
					}
				}
			}
		}
	}
}

/**
 * This is a sample Parent Node Handler.
 *
 * @see ProcessXMLResp
 * @param ParentNodeName
 * @param pID
 * @return
 */
function xmlGlobalParent(ParentNodeName, pID){
	//alert(ParentNodeName);
}

/**
 *
 * This is a sample of a Child Node Handler.
 *
 **/
function xmlGlobalChild(ChildNodeName, ChildNodeValue, ChildID){
	msgOut = "";
	if(ChildNodeName == "msg"){
		if(null != ChildNodeValue){
			ChildNodeValue = unescape(ChildNodeValue);
		}else{
			msgOut += ChildNodeValue+"\n";
		}
	}else if(ChildNodeName == "Error"){

	}
}
function scrollTextArea(fieldName){
	try{
		inFobj = document.getElementById(sysCurrentForm);
		if(inFobj.elements){
			inFobj.elements[fieldName].scrollTop = inFobj.elements[fieldName].scrollHeight;
		}
	}catch(err){
		alert("Unable to scroll "+fieldName+" on form "+sysCurrentForm);
	}
}
/**
 *
 * @param fieldName
 * @param fieldValue
 * @return
 */
function setFormValue(fieldName, fieldValue){
	setFormValueOnForm(sysCurrentForm, fieldName, fieldValue);
}
/**
 *
 * @param formID
 * @param fieldName
 * @param fieldValue
 * @return
 */
function setFormValueOnForm(formID, fieldName, fieldValue){
	var returnvalue	="";
	var elClass		="";
	var elName 		= "";
	var elType		="";
	var elValue		="";
	var bckValue 	= "";
	inFobj			= "";
	try{
		inFobj = document.getElementById(formID);
		if(inFobj.elements){
			elType   = inFobj.elements[fieldName].type;
			elClass  = inFobj.elements[fieldName].className;
			//alert("Setting Value for:"+inFobj.elements[fieldName].name);
			try{
				if(trimAll(fieldValue).length > 0){
					validateField(inFobj.elements[fieldName]);
			    }
			}catch(err){
				//alert("[sbGeneral].setFormValueOnForm."+sysCurrentForm+": ERROR 1600:"+err.description);
			}
			switch(elType.toLowerCase()){
			case 'undefined':
				//alert("UNDEFINED:"+fieldName);
				return;
			case 'radio':
				if(isEmpty(fieldValue) || fieldValue=='0')
					fieldValue=false;
				else
					fieldValue=true;
				//alert(fieldName+" :"+fieldValue);
				inFobj.elements[fieldName].checked = fieldValue;
				break;
			case 'checkbox':
				//alert(fieldValue);
				if(elClass.match("numeric")){
					if(isEmpty(fieldValue)){// || fieldValue=='0' || fieldValue=='false' || fieldValue=='unchecked')
						fieldValue='0';
					}else{
						fieldValue='1';
					}
				}else{
					if(isEmpty(fieldValue)){// || fieldValue=='0' || fieldValue=='false' || fieldValue=='unchecked')
						fieldValue=false;
					}else{
						fieldValue=true;
					}
				}
				inFobj.elements[fieldName].checked = fieldValue;
				break;
			case 'select':
				if(fieldValue.length<1){
					inFobj.elements[fieldName].options[0].selected=true;
				}else{
					if(inFobj.elements[fieldName].options.length>0){
						for(var o=0;o<inFobj.elements[fieldName].options.length;o++){
							if(inFobj.elements[fieldName].options[o].value==fieldValue){
								inFobj.elements[fieldName].options[o].selected=true;
								break;
							}
						}
					}
				}
				break;
			case 'select-multiple':
				for(var x=0; x < inFobj.elements[fieldName].length; x++)
					inFobj.elements[fieldName].selected = fieldValue[x];
				break;

			default: inFobj.elements[fieldName].value = fieldValue; break;
			}
		}
	}catch(err){
		alert("[sbGeneral].setFormValueOnForm."+sysCurrentForm+" for Field "+fieldName+" and Value:"+fieldValue+" - ERROR 1700:"+err.description);
	}
}
function setFieldClass(fieldName, clsName){
	try{
		//alert(clsName);
		var inFobj = document.getElementById(sysCurrentForm);
		inFobj.elements[fieldName].className = clsName;
	}catch(err){
		alert("ERROR: Field Class for field "+fieldName+" not set to "+clsName+":"+err.description);
	}
}
/**
 * Appends _error to the current objects class. Assumes that you have
 * this error style defined in the CSS file.
 *
 * @param fieldName
 * @return
 */
function setFieldInError(fieldName){
    setFieldInErrorOnForm(sysCurrentForm,fieldName)
}
function setFieldInErrorOnForm(formID, fieldName){
	//alert("entered setFieldInErrorOnForm FieldInError:"+formID);
    var returnvalue="";
	var inFobj = document.getElementById(formID);
	if(inFobj.elements){
		//alert(formID+" inERROR elements checking("+fieldName+")");
		var elName  = inFobj.elements[fieldName].name;
		//alert("NAME:"+elName);
		var elType  = inFobj.elements[fieldName].type;
		//alert("TYPE:"+elType);
		var elClass = inFobj.elements[fieldName].className;
		//alert("CLASS:"+elClass);
		var elValue = '';
		if(fieldName == elName){
	        elClass = elClass.replace("_error","");
			if(elClass.match("req_") || elClass.match("opt_") || elClass.match("local_") ){
	     		if(!elClass.match("_error"))
		        	elClass = elClass + "_error";
			}
			if(elClass){
		  		inFobj.elements[fieldName].className = elClass;
			}
		}
	 } else{
		 alert("No Elements found on form "+formID);
	 }
}
/**
 * Removes '_error' from the current objects class. Assumes that you have
 * this non-error style defined in the CSS file.
 *
 * @param fieldName
 * @return
 */
function setFieldOk(fieldName){
	setFieldOkOnForm(sysCurrentForm,fieldName);
}
function setFieldOkOnForm(formID, fieldName){
	//alert("Entered setFieldOkOnForm Set Field Ok:"+formID);
    var returnvalue="";
	var inFobj = document.getElementById(formID);
	if(inFobj.elements){
		//alert(formID+" isOK elements checking("+fieldName+")");
		var elName  = inFobj.elements[fieldName].name;
		//alert("NAME:"+elName);
		var elType  = inFobj.elements[fieldName].type;
		//alert("TYPE:"+elType);
		var elClass = inFobj.elements[fieldName].className;
		//alert("CLASS:"+elClass);
		var elValue = '';
		if(fieldName == elName){
	        elClass = elClass.replace("_error","");
			if(elClass){
		  		inFobj.elements[fieldName].className = elClass;
			}
		}
	 }else{
		 alert("No Elements found on form "+formID);
	 }
}
/**
 *
 * @param fieldName
 * @return
 */
function getFormValue(fieldName){
	return returnvalue=getFormValueOnForm(sysCurrentForm, fieldName);
}
/**
 *
 * @param formID
 * @param fieldName
 * @return
 */
function getFormValueOnForm(formID, fieldName){
	var returnvalue="";
	var inFobj = document.getElementById(formID);
	if(inFobj.elements){
		try{
			//try{
			var elClass = inFobj.elements[fieldName].className;
			//}catch(e){
			//	elClass = "local_unknown";
			//}
			var elName  = inFobj.elements[fieldName].name;
			//try{
			var elType  = inFobj.elements[fieldName].type;
			//}catch(e){
			//	var elType  = "unknown";
			//}
			var elValue = '';
			if(fieldName == elName){
				switch(elType){
				case 'undefined': return null;
				case 'radio': returnvalue = inFobj.elements[fieldName].checked; break;
				case 'checkbox':
					if(elClass.match("numeric") && inFobj.elements[fieldName].checked){
						returnvalue = '1';
					}else if (inFobj.elements[fieldName].checked){
						returnvalue = inFobj.elements[fieldName].checked;
					}
					break;
				case 'select': returnvalue = inFobj.elements[fieldName].value; break;
				case 'select-multiple':
					for(var x=0; x < inFobj.elements[fieldName].length; x++)
						returnvalue = inFobj.elements[fieldName].selected;
					break;

				default: returnvalue = inFobj.elements[fieldName].value; break;
				}
				if(trimAll(returnvalue).length > 0){
					if(elClass.match("currency")){
						returnvalue = removeCurrency(returnvalue);
					}else if(elClass.match("percent")){
						returnvalue = removePercent(returnvalue);
					}else if(elClass.match("interest")){
						returnvalue = removeInterest(returnvalue);
					}else if(elClass.match("numeric")){
						returnvalue = removeCommas(returnvalue);
					}else if(elClass.match("date")){

					}
				}
			}
		}catch(err){
			alert("[sbGeneral].getFormValueOnForm."+sysCurrentForm+": fieldName:"+fieldName+" ERROR 1800:"+err.description);;
		}
	}
	return returnvalue;
}
/**
 *
 * @param fieldName
 * @return
 */
function getFormTitle(fieldName){
	return returnvalue=getFormTitleOnForm(sysCurrentForm, fieldName);
}
/**
 *
 * @param formID
 * @param fieldName
 * @return
 */
function getFormTitleOnForm(formID, fieldName){
	var returnvalue="";
	var inFobj = document.getElementById(formID);
	if(inFobj.elements){
		try{
			var elTitle = inFobj.elements[fieldName].title;
			var elName  = inFobj.elements[fieldName].name;
			if(fieldName == elName){
			   return elTitle;
			}
		}catch(err){
			alert("[sbGeneral].getFormTitleOnForm."+sysCurrentForm+": fieldName:"+fieldName+" ERROR 1805:"+err.description);;
		}
	}
	return returnvalue;
}

function getSimpleListValue(fieldName){
	var it = document.getElementById(fieldName);
	var si = it.selectedIndex;
	return it.options[si].text;
}
function getSimpleTitle(fieldname){
	return document.getElementById(fieldname).title;
}
function getSimpleValue(fieldname){
	return document.getElementById(fieldname).value;
}
function getListValue(fieldName){
	var retListText="";
	var inFobj = document.getElementById(sysCurrentForm);
	if(inFobj.elements){
		try{
			var elClass = inFobj.elements[fieldName].className;
			var elName  = inFobj.elements[fieldName].name;
			var elType  = inFobj.elements[fieldName].type;
			var elValue = '';
			if(fieldName == elName){
				if(elType.toLowerCase()=='select'){
				   var indx = inFobj.elements[elName].selectedIndex;
                   retListText = inFobj.elements[elName].options[indx].text;
                   //alert(retListText); ;
				}

			}
		}catch(err){
			alert("[sbGeneral].getFormValueOnForm."+sysCurrentForm+": ERROR 1810:"+err.description);;
		}
	}
	//alert(retListText);
	return retListText;
}

function validateFormFromServer(formID){
	var inFobj = null;
	var elLength = 0;
	try{
		inFobj = document.getElementById(formID);
		elLength = inFobj.length;
	}catch(err){
		alert("[sbGeneral].validateFormFromServer."+formID+": ERROR 1401:"+err.description+" Make sure the form exists in the forms database.");
	}
	for(var i=0;i< elLength;i++){
		var elName  = inFobj.elements[i].name;
		var elClass = inFobj.elements[i].className;
		var elType = inFobj.elements[i].type;
		var elValue = inFobj.elements[i].value;
		if(startsWith(elClass,"req_") || startsWith(elClass,"opt_") || startsWith(elClass,"local_")){
			try{
				var elTitle = inFobj.elements[i].title;
				if(elTitle == "Error"){
					elClass = elClass.replace("_error","");
					inFobj.elements[i].className = elClass+"_error";
				}else if(elTitle == "Disabled"){
					inFobj.elements[i].style.backgroundColor = "#dddddd";
				}if(elType == "checkbox"){
					//alert(elName);
					if(elValue == "true" || elValue == "1"){
						inFobj.elements[i].checked = true;
					}else{
						inFobj.elements[i].checked = false;
					}
				}
			}catch(err){
				alert("[sbGeneral].validateFormFromServer: "+formID+":"+err.description);
			}
		}
	}
}
function clearForm(){
    var answer=true;
    if(eval(sysCurrentForm+"Dirty")){
      answer = confirm(sysCurrentForm+": All changes will be lost. Are you sure you want to Clear?")
    }
	if(answer){
	    eval(sysCurrentForm+'Dirty=false;');
		var returnvalue="";
		var inFobj = document.getElementById(sysCurrentForm);
		if(inFobj.elements.length){
			for(var i = 0;i < inFobj.elements.length;i++) {
				var elClass = inFobj.elements[i].className;
				inFobj.elements[i].className = elClass.replace("_error","");
				var elName  = inFobj.elements[i].id;
				var elType  = inFobj.elements[i].type;
				if(elClass.match("req_") ||  elClass.match("opt_") || elClass.match("local_")){
			       setFormValueOnForm(sysCurrentForm, elName, "");
			    }
			}
			eval(sysCurrentForm+'Dirty=false');
		}
	}
}
function DomToForm(reqDoc){
    var answer=true;
	if(answer){
	    eval(sysCurrentForm+'Dirty=false;');
		var returnvalue="";
		var inFobj = document.getElementById(sysCurrentForm);
		if(inFobj.elements.length){
			for(var i = 0;i < inFobj.elements.length;i++) {
				var elName  = inFobj.elements[i].id;
				var elType  = inFobj.elements[i].type;
				var elValue = "";
				try{
					if(reqDoc.getElementsByTagName(elName).length>0){
						elValue = reqDoc.getElementsByTagName(elName)[0].getAttribute("value");
						setFormValueOnForm(sysCurrentForm, elName, elValue);
					}
				}catch(e){

				}

			}
			eval(sysCurrentForm+'Dirty=false');
		}
	}
}
/**
 *
 * @param fieldName
 * @param fieldValue
 * @return
 */
function setHTML(fieldName, fieldValue){
	setHTMLOnForm(sysCurrentForm, fieldName, fieldValue);
}
/**
 *
 * @param formID
 * @param fieldName
 * @param fieldValue
 * @return
 */
function setHTMLOnForm(formID, fieldName, fieldValue){
	try{
		document.getElementById(fieldName).innerHTML = fieldValue;
	}catch(err){
		alert("[sbGeneral].setHTMLOnForm."+sysCurrentForm+": ERROR 9710:"+err.description);
	}
}
function getFormObject(){
	return document.getElementById(sysCurrentForm);
}


/**
 * Bi-Driection Table Scroll functions
 */
var FWTable = {
		table: null,
		YtableEmulator: null,
		XtableEmulator: null,
		headerContainer: null,
		YfakeScrollablePanel: null,
		XfakeScrollablePanel: null,
		scrollablePanel: null,
		footerContainer: null,

		Init:function(TableName){
			//alert("init called:"+TableName);
            try{
			this.table = document.getElementById(TableName+'_Body');
			this.YtableEmulator = document.getElementById(TableName+'_VertEmulator');
			this.XtableEmulator = document.getElementById(TableName+'_HorzEmulator');
			this.headerContainer = document.getElementById(TableName+'_HeaderContainer');
			this.footerContainer = document.getElementById(TableName+'_FooterContainer');
			this.scrollablePanel = document.getElementById(TableName+'_FWScroll');
			this.YtableEmulator.style.height = this.table.clientHeight == 0 ? "0px" : this.table.clientHeight + "px";
			this.XtableEmulator.style.width = this.table.clientWidth + "px";

			this.YfakeScrollablePanel = document.getElementById(TableName+'_VertScroll');
			this.XfakeScrollablePanel = document.getElementById(TableName+'_HorzScroll');
			this.YfakeScrollablePanel.style.top = this.headerContainer.clientHeight == 0 ? "0px" : this.headerContainer.clientHeight + "px";
            }catch(e){
            	document.getElementById("specialMsg").innerHTML = "Table empty or not initialized";
            }
		},
		ScrollablePanel_OnScroll:function(){
			this.XfakeScrollablePanel.scrollTop = this.scrollablePanel.scrollTop;
		},
		VertFakeScrollablePanel_OnScroll:function(){
			this.scrollablePanel.scrollTop = this.YfakeScrollablePanel.scrollTop;
		},
		HorzFakeScrollablePanel_OnScroll:function (){
		  	this.scrollablePanel.scrollLeft = this.XfakeScrollablePanel.scrollLeft;
		  	this.headerContainer.scrollLeft = this.XfakeScrollablePanel.scrollLeft;
		  	this.footerContainer.scrollLeft = this.XfakeScrollablePanel.scrollLeft;
		}
};

/**
 * End of table scroll functions

   Start of  -
     Chrome Drop Down Menu:
     Author: Dynamic Drive (http://www.dynamicdrive.com)
 **/

var FWMenu={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
dropdownindicator: '<img src="./html/images/down.gif" border="0" />', //specify full HTML to add to end of each menu item with a drop down menu
enablereveal: [true, 5], //enable swipe effect? [true/false, steps (Number of animation steps. Integer between 1-20. Smaller=faster)]
enableiframeshim: 1, //enable "iframe shim" in IE5.5 to IE7? (1=yes, 0=no)

//No need to edit beyond here////////////////////////

dropmenuobj: null, asscmenuitem: null, domsupport: document.all || document.getElementById, standardbody: null, iframeshimadded: false, revealtimers: {},

getposOffset:function(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

showmenu:function(dropmenu, e){
	if (this.enablereveal[0]){
		if (!dropmenu._trueheight || dropmenu._trueheight<10)
			dropmenu._trueheight=dropmenu.offsetHeight
		clearTimeout(this.revealtimers[dropmenu.id])
		dropmenu.style.height=dropmenu._curheight=0
		dropmenu.style.overflow="hidden"
		dropmenu.style.visibility="visible"
		this.revealtimers[dropmenu.id]=setInterval(function(){FWMenu.revealmenu(dropmenu)}, 10)
	}
	else{
		dropmenu.style.visibility="visible"
	}
	this.css(this.asscmenuitem, "selected", "add")
},

revealmenu:function(dropmenu, dir){
	var curH=dropmenu._curheight, maxH=dropmenu._trueheight, steps=this.enablereveal[1]
	if (curH<maxH){
		var newH=Math.min(curH, maxH)
		dropmenu.style.height=newH+"px"
		dropmenu._curheight= newH + Math.round((maxH-newH)/steps) + 1
	}
	else{ //if done revealing menu
		dropmenu.style.height="auto"
		dropmenu.style.overflow="hidden"
		clearInterval(this.revealtimers[dropmenu.id])
	}
},

clearbrowseredge:function(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=document.all && !window.opera? this.standardbody.scrollLeft+this.standardbody.clientWidth-15 : window.pageXOffset+window.innerWidth-15
		var dropmenuW=this.dropmenuobj.offsetWidth
		if (windowedge-this.dropmenuobj.x < dropmenuW)  //move menu to the left?
			edgeoffset=dropmenuW-obj.offsetWidth
	}
	else{
		var topedge=document.all && !window.opera? this.standardbody.scrollTop : window.pageYOffset
		var windowedge=document.all && !window.opera? this.standardbody.scrollTop+this.standardbody.clientHeight-15 : window.pageYOffset+window.innerHeight-18
		var dropmenuH=this.dropmenuobj._trueheight
		if (windowedge-this.dropmenuobj.y < dropmenuH){ //move up?
			edgeoffset=dropmenuH+obj.offsetHeight
			if ((this.dropmenuobj.y-topedge)<dropmenuH) //up no good either?
				edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
},

dropit:function(obj, e, dropmenuID){
	if (this.dropmenuobj!=null) //hide previous menu
		this.hidemenu() //hide menu
	this.clearhidemenu()
	this.dropmenuobj=document.getElementById(dropmenuID) //reference drop down menu
	this.asscmenuitem=obj //reference associated menu item
	this.showmenu(this.dropmenuobj, e)
	this.dropmenuobj.x=this.getposOffset(obj, "left")
	this.dropmenuobj.y=this.getposOffset(obj, "top")
	this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
	this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
	this.positionshim() //call iframe shim function
},

positionshim:function(){ //display iframe shim function
	if (this.iframeshimadded){
		if (this.dropmenuobj.style.visibility=="visible"){
			this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
			this.shimobject.style.height=this.dropmenuobj._trueheight+"px"
			this.shimobject.style.left=parseInt(this.dropmenuobj.style.left)+"px"
			this.shimobject.style.top=parseInt(this.dropmenuobj.style.top)+"px"
			this.shimobject.style.display="block"
		}
	}
},

hideshim:function(){
	if (this.iframeshimadded)
		this.shimobject.style.display='none'
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

dynamichide:function(m, e){
	if (!this.isContained(m, e)){
		this.delayhidemenu()
	}
},

delayhidemenu:function(){
	this.delayhide=setTimeout("FWMenu.hidemenu()", this.disappeardelay) //hide menu
},

hidemenu:function(){
	this.css(this.asscmenuitem, "selected", "remove")
	this.dropmenuobj.style.visibility='hidden'
	this.dropmenuobj.style.left=this.dropmenuobj.style.top="-1000px"
	this.hideshim()
},

clearhidemenu:function(){
	if (this.delayhide!="undefined")
		clearTimeout(this.delayhide)
},

addEvent:function(target, functionref, tasktype){
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},
Init:function(){
	if (!this.domsupport)
		return
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	for (var ids=0; ids<arguments.length; ids++){
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
		for (var i=0; i<menuitems.length; i++){
			if (menuitems[i].getAttribute("rel")){
				var relvalue=menuitems[i].getAttribute("rel")
				var asscdropdownmenu=document.getElementById(relvalue)
				this.addEvent(asscdropdownmenu, function(){FWMenu.clearhidemenu()}, "mouseover")
				this.addEvent(asscdropdownmenu, function(e){FWMenu.dynamichide(this, e)}, "mouseout")
				this.addEvent(asscdropdownmenu, function(){FWMenu.delayhidemenu()}, "click")
				try{
					menuitems[i].innerHTML=menuitems[i].innerHTML+" "+this.dropdownindicator
				}catch(e){}
				this.addEvent(menuitems[i], function(e){ //show drop down menu when main menu items are mouse over-ed
					if (!FWMenu.isContained(this, e)){
						var evtobj=window.event || e
						FWMenu.dropit(this, evtobj, this.getAttribute("rel"))
					}
				}, "mouseover")
				this.addEvent(menuitems[i], function(e){FWMenu.dynamichide(this, e)}, "mouseout") //hide drop down menu when main menu items are mouse out
				this.addEvent(menuitems[i], function(){FWMenu.delayhidemenu()}, "click") //hide drop down menu when main menu items are clicked on
			}
		} //end inner for
	} //end outer for
	if (this.enableiframeshim && document.all && !window.XDomainRequest && !this.iframeshimadded){ //enable iframe shim in IE5.5 thru IE7?
		document.write('<IFRAME id="iframeshim" src="about:blank" frameBorder="0" scrolling="no" style="left:0; top:0; position:absolute; display:none;z-index:90; background: transparent;"></IFRAME>')
		this.shimobject=document.getElementById("iframeshim") //reference iframe object
		this.shimobject.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
		this.iframeshimadded=true
	}
} //end startchrome

}

/**
 * This is a helper function for the HOWTo guide. Feel free to delete
 * @returns {String}
 */
function getLeftSide(){
	var x = 
	'<br><a href="http://www.stevechappell.com/blog" target="_blank">Galena Blog</a>'+
	'<br><br><input name="toblogOne" id="toblogOne" type="button" class="leftNavButton" value="Expert" onclick="alert(\'Welcome to Galena! This section is just for those needing a refresher, not newbies!\')"/><br>'+
	'<a  class="indexLink" href="../../../html/howto/createformsdb/Galena_createformsDBOne.html">Quick FormsDB</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/createformsdb/Galena_createprojectOne.html">Quick Project</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/createformsdb/Galena_createlogonOne.html">Quick LogonForm</a><br>'+
	'<br><br><input name="toblogOne" id="toblogOne" type="button" class="leftNavButton" value="Setup" onclick="alert(\'Click the following links in order to setup your environment.\')"/><br>'+
    '<a  class="indexLink" href="../../../html/howto/basic/Galena_Basic.html" >Get Started</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreHowTo.html" >Introduction</a><br>'+
    '<a  class="indexLink" href="../../../html/app/GalenaAdmin.war" ><font color="blue"><b>GalenaAdmin.war</b></font></a><br>'+

	'<br><input name="toblogFour" id="toblogFour" type="button" class="leftNavButton" value="Basics" onclick="alert(\"This information is great background.\")"/><br>'+
	'<a  class="indexLink" href="../../../html/howto/gdo/Galena_GSession_1.html">General Session</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/gdo/Galena_gdo_1.html">General GDO</a><br>'+
    
    
    '<br><input name="torules" id="torules" type="button" class="leftNavButton"  value="Tutorial" onclick="alert(\'An introduction to the Galena Admin tool.\')"/><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageOne.html"><font color="red"><b>GAdmin Install</b></font></a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageTwo.html">Classic Forms DB</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageThree.html">Classic Model DB</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageThreeB.html">Classic Model Project</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageFour.html">First Form</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageSix.html">Field Edit Intro</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_PageSeven.html">Logon Screen</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_formTwo.html">Second Form</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_modifications.html">Modifications</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/focusareas/Galena_xmlhttp.html">Zip Validator</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_buildall.html">Add other forms</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdmin/classicModel_buildmgr.html">Setup Manager</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_cleanup.html">Adv. Menus</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_finishemployee.html">Finish Employee</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_addorderdetail.html">Order Form I</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_customerwrapup.html">Order Form II</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_state.html">Order State</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/GAdminII/GAdminII_orderrules.html">Order Rules</a><br>'+
   

	'<br><input name="toblogFour" id="toblogFour" type="button" class="leftNavButton" value="Rules Engine" onclick="alert(\"An introduction to the Galena Rules Engine.\")"/><br>'+
	'<a  class="indexLink" href="../../../html/howto/rules/Galena_rulesIntro.html">Rule Intro</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/rules/Galena_rulesEditors.html">Rules Editor</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/rules/Galena_rulesScope.html">Rules Scope</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/rules/Galena_rulesAdvanced.html">Advanced Rules</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/assignments/Galena_assignmentOne.html">WorkQ Display</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/assignments/Galena_assignmentTwo.html">WorkQ Intro</a><br>'+
    
	'<br><input name="toblogThree" id="toblogThree" type="button" class="leftNavButton" value="Navigation" onclick="alert(\"Using menus and button bars.\")"/><br>'+
	'<a  class="indexLink" href="../../../html/howto/nav/Galena_Avatars.html">Avatars</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/nav/Galena_Buttons.html">Button Bar</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/nav/Galena_Menus.html">Menus</a><br>'+
    
    
    '<br><input name="torules" id="torules" type="button" class="leftNavButton"  value="Fields and Forms" onclick="alert(\'An introduction to Fields and Forms.\')"/><br>'+
    '<a  class="indexLink" href="../../../html/howto/monitoring/Galena_monitoringOne.html">Monitoring/Debugging</a><br>'+
    'Fields (pending)<br>'+
    'Forms (pending)<br>'+
    
	'<br><input name="toblogFour" id="toblogFour" type="button" class="leftNavButton" value="Other Features" onclick="alert(\"An introduction to some of the other core features of Galena Framework\")"/><br>'+
	'<a  class="indexLink" href="../../../html/howto/core/Galena_UserRole.html">Users\Roles</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/core/Galena_AjaxOne.html">G-Ajax</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/focusareas/Galena_xmlhttp.html">Simple SOA</a><br>'+
	'<a  class="indexLink" href="../../../html/howto/core/Galena_CoreThree.html">Index.html</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreFour.html">XSL</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreFive.html">Form JS</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreSix.html">System JS</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreSeven.html">DO Files</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreEight.html">Properties</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreNine.html">Property_Classes</a><br>'+
    '<a  class="indexLink" href="../../../html/howto/core/Galena_CoreTwelve.html">G-DWR</a><br>'+
    
   
  
	'<br><input name="toblogThree" id="toblogThree" type="button" class="leftNavButton" value="Field Types" onclick="alert(\"Advanced Fields.\")"/><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_overview.html">General</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_input.html">Input</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_label.html">Label</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_hidden.html">Hidden</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_textarea.html">Text Area</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_list.html">List/DD boxes</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_radio.html">Radio Button</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_check.html">CheckBox</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_button.html">Button</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_timestamp.html">TimeStamp/Date</a><br>'+
	'<a class="indexLink" href="../../../html/howto/fields/fields_password.html">Password</a><br>'+
	'<a class="indexLink" href="../../../html/howto/GAdminII/GAdminII_addorderdetail.html">Using Grids</a><br>'+
    
  
	'<br><input name="toblogThree1" id="toblogThree1" type="button" class="leftNavButton" value="Help Sys" onclick="alert(\"Creating and implementing online help.\")"/><br>'+
	'<a class="indexLink" href="../../../html/howto/helpsystem/Galena_helpOne.html">Online Help System</a><br>'+
    
	'<br><input name="toblogThree2" id="toblogThree2" type="button" class="leftNavButton" value="Logging" onclick="alert(\"Using the Logging subsystem.\")"/><br>'+
	'<a class="indexLink" href="../../../html/howto/logging/Galena_loggingOne.html">Galena Logging</a><br>'+

	
	'<br><input name="toblogThree5" id="toblogThree5" type="button" class="leftNavButton" value="JMS" onclick="alert(\"Implementing Messaging.\")"/><br>'+
	'<a class="indexLink" href="../../../html/howto/services/Galena_jmsOne.html">Using JMS/ActiveMQ</a><br>'+
	
	'<br><input name="toblogThree3" id="toblogThree3" type="button" class="leftNavButton" value="Services" onclick="alert(\"Running Headless.\")"/><br>'+
    'Introduction (pending)<br>'+	
	
	'<br><input name="toblogThree4" id="toblogThree4" type="button" class="leftNavButton" value="Comet" onclick="alert(\"Setting up a reverse Ajax connection.\")"/><br>'+
    'Introduction (pending)<br>'+

	
	'<br><input name="toblogThree6" id="toblogThree6" type="button" class="leftNavButton" value="MISC" onclick="alert(\"Implementing Messaging.\")"/><br>'+
	'<a class="indexLink" href="../../../html/howto/basic/Galena_Basic_warfile.html">WAR File info</a><br>'

	;
	//'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro.html">Tutorial Intro</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageTwo.html">Tutorial Page 2</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageThree.html">Tutorial Page 3</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageFour.html">Tutorial Page 4</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageFive.html">Tutorial Page 5</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageSix.html">Tutorial Page 6</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageSeven.html">Tutorial Page 7</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageEight.html">Tutorial Page 8</a><br>'+
    //'<a  class="indexLink" href="../../../html/howto/tut/GalenaIntro_PageNine.html">Tutorial Page 9</a><br>';


	return x;
}
/**
 * This is a helper function for the howto guide. Feel free to delete.
 *
 * @returns {String}
 */
function getRightSide(){
	//return "<br><img src='../../../html/howto/images/rightside.gif' alt='Image of installed files' />";
	return "<TABLE BORDER='1' WIDTH='100%' CELLPADDING='3' CELLSPACING='0' SUMMARY=''>"+
	"<TR BGCOLOR='#6F8AB5' CLASS='howto_header_package' ><TD  ALIGN='left' ><B>Packages</B></TD></TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/eval/package-summary.html'>com.eval</A></B></TD>"+
	
	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/package-summary.html'>com.galena</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/assignments/package-summary.html'>com.galena.assignments</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Client/package-summary.html'>com.galena.Client</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Data/package-summary.html'>com.galena.Data</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Data/dataobjects/package-summary.html'>com.galena.Data.dataobjects</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Data/dataobjects/Interfaces/package-summary.html'>com.galena.Data.dataobjects.Interfaces</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Data/util/package-summary.html'>com.galena.Data.util</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Data/util/Generators/package-summary.html'>com.galena.Data.util.Generators</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/direct/package-summary.html'>com.galena.direct</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/Exceptions/package-summary.html'>com.galena.Exceptions</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/JMS/package-summary.html'>com.galena.JMS</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/logger/package-summary.html'>com.galena.logger</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/properties/package-summary.html'>com.galena.properties</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/rules/package-summary.html'>com.galena.rules</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/servlet/package-summary.html'>com.galena.servlet</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/servlet/utils/package-summary.html'>com.galena.servlet.utils</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/servlet/utils/sax/package-summary.html'>com.galena.servlet.utils.sax</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/servlet/utils/subclasses/package-summary.html'>com.galena.servlet.utils.subclasses</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/servlet/utils/Validation/package-summary.html'>com.galena.servlet.utils.Validation</A></B></TD>"+

	"</TR>"+
	"<TR BGCOLOR='white' CLASS='howto_package'>"+
	"<TD WIDTH='20%'><B><A target='_blank' class='howto_package_link'  HREF='../../../html/howto/doc/com/galena/xml/package-summary.html'>com.galena.xml</A></B></TD>"+

	"</TR>"+
	"</TABLE>";
}
function SearchHelp(){
	var MyClass = new GDWRHelp();
	var searchText = document.getElementById("z-search").value;
	MyClass.getSearchHelp("SearchHelpReturn","session",searchText);
}
function SearchHelpReturn(returnValue){
	var PopUpTop = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>"+
	"<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>"+
	"<head>"+
	"<title>G-Help</title>"+
	"<link rel='stylesheet' type='text/css' href='html/css/application.css' />"+

	"<body  class='main'>"+
	"<center><div id='popup' name='popup'>";

	var PopUpBottom = "</div></center>"+
	"</body>"+
	"</html>";

	var vWinCal;
	vWinCal= window.open("", "QuickCheck","width=450,height=400,status=no,resizable=yes,top=200,left=200");
    vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (PopUpTop + returnValue + PopUpBottom);
	calc_doc.close();
	vWinCal.focus();
}
/**
 * This function is called when the user clicks either an assignment status icon, or the assignment text. When the 
 * status icon is clicked, the obj.title property is set to "Status". When the assignment text is clicked, the 
 * obj.title value is set to "Assignemnt".
 * 
 *  	alert("TODO: You must edit 'function  sysAssignmentClicked(obj)' to handle the click of the assignment.\n"+
 *			"\nTask Title: " + title + 
 *			"\nTask Servlet: " + servlet + 
 *			"\nTask Action: " + action +
 *			"\nTask Assignment: " + assignmentIndex +
 *			"\nTask FKey: " + foreignkey + 
 *			"\nTask SysVar: " + sysvariable);
 *			
 * @param obj
 */
function  sysAssignmentClicked(obj){
	var title      		= obj.title;
	var servlet 		= document.getElementById(title).getAttribute("servlet");
	var action  		= document.getElementById(title).getAttribute("action");
	var foreignkey 		= document.getElementById(title).getAttribute("foreignkey");
	var assignmentIndex	= document.getElementById(title).getAttribute("AssignmentIndex");
	var sysvariable		= document.getElementById(title).getAttribute("sysvariable");
	var inFobj = document.getElementById(sysCurrentForm);
	var parts = sysvariable.split(".");
	//alert(parts[1]);
	var Target = document.getElementById(parts[1]);
	
	if(parts[0] == "Form"){
		if(null == Target){
			var dummyField=document.createElement("input");
			dummyField.type = "hidden";
			dummyField.id = parts[1];
			dummyField.name = parts[1];
			dummyField.className = "sys_value";
		    inFobj.appendChild(dummyField);
			setFormValue(parts[1],foreignkey);
		}else{
			document.getElementById(parts[1]).value = foreignkey;
			setFormValue(parts[1],foreignkey);
		}
	}
	AjaxRequestPage(servlet, action, "Page",  FormContextArea);
}
function openNewWindow(inUrl, wName){
	inUrl 				= "http://"+window.location.hostname+":"+window.location.port+"/"+sysProjectName+"/"+inUrl;
	alert(inUrl);
	var load = window.open(inUrl,wName,'scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}
function redirectTo(inUrl){
	window.location = inUrl;
}
