
$.fn.setFocus=function(e)
{if(document.getElementById(e))
document.getElementById(e).focus();return this;};$.fn.ajaxSubmit=function(e)
{this.submit(function()
{var params={};var IncCounter=0;var OldArrayName="";var thisParam="";params['call']='ajax';var formName=$(this).attr('name');$("div.formErrors").html("").filter(":block").fadeOut("normal");$(this).find("input[checked], input[type='text'], input[type='hidden'], input[type='password'], input[type='submit'], option[selected], textarea").each(function()
{ArrayName=this.name||this.id||this.parentNode.name||this.parentNode.id||this.parentNode.parentNode.name||this.parentNode.parentNode.id;thisParam=params[ArrayName];$(this).removeClass("fielderror");$("div.error_"+this.name).html("");if(thisParam==null)
{thisParam=new Array(1);thisParam[0]=this.value;OldArrayName=ArrayName;}
else
{thisParam.length=thisParam.length+1;thisParam[thisParam.length-1]=this.value;}
if($(this).attr('type')=='submit')
{if($(this).attr('checked')==true)
{params[ArrayName]=thisParam;}}
else
params[ArrayName]=thisParam;});eval("setBlockUI_"+formName)();$.ajax({url:this.getAttribute("action"),type:'POST',data:params,dataType:'xml',cache:false,error:function(XMLHttpRequest,textStatus,errorThrown)
{var errMessage="It appears that an unexpected error was encountered when posting the form.<br>The post returned an Exception "+XMLHttpRequest.Status+": "+XMLHttpRequest.StatusText;if(XMLHttpRequest.Status=="200")errMessage="Your session has timed out. Click <a href='/' title='refresh'>here</a> to return to homepage.";$("div#formErrors_"+formName).html(errMessage).filter(":hidden").fadeIn("normal");eval("setUnBlockUIError_"+formName)();},success:function(xmldata,textStatus)
{strError="Unable to submit form. Please try again later.";oFocus=null;oRedirect="true";oSuccessText="";var hasError=false;$("AjaxResponse",xmldata).each(function()
{var AjaxResp=this;$(document).find("input[type='image'], input[type='radio'], input[type='text'], input[type='password'], select, textarea").each(function()
{if(this.name==null)
{if(this.parentNode.name>0&&AjaxResp.getAttribute(this.parentNode.name)!=null)
{$(this).addClass("fielderror");$("div.error_"+this.name).html(AjaxResp.getAttribute(this.name));hasError=true;}}
else if(this.name.length>0&&AjaxResp.getAttribute(this.name)!=null)
{$(this).addClass("fielderror");$("div.error_"+this.name).html(AjaxResp.getAttribute(this.name));hasError=true;}
else
{$(this).removeClass("fielderror");$("div.error_"+this.name).html("");}});$(document).find("input[type='checkbox']").each(function()
{if(this.name.length>0&&AjaxResp.getAttribute(this.name)!=null)
{$(this).parent().addClass("fielderror");$("div.error_"+this.name).html(AjaxResp.getAttribute(this.name));hasError=true;}
else
{$(this).parent().removeClass("fielderror");$("div.error_"+this.name).html("");}});strRedirect=this.getAttribute("redirecturl");strError=this.getAttribute("error");oFocus=this.getAttribute("focus");oRedirect=this.getAttribute("Redirect");oSuccessText=this.getAttribute("SuccessText");onewWindowOnSuccess=this.getAttribute("newWindowOnSuccess");});if(strError.length==0)
{try
{post_form_submit(true,oSuccessText);}
catch(e1)
{}
if(oRedirect=="true")
{if(onewWindowOnSuccess=="true")
{window.open(strRedirect);eval("setUnBlockUI_"+formName)();}
else
window.location=strRedirect;}}
else
{hasError=true;$("div#formErrors_"+formName).html("<ul>"+strError.replace(/(\t)(.+)/g,"<li>$2<\/li>")+"<\/ul>").filter(":hidden").fadeIn("normal");try
{if(oFocus)$("#"+oFocus).get(0).focus();}
catch(e)
{};try
{$(document).find("input[type='submit']").each(function(){$(this).attr('checked',false);});post_form_submit(false,oSuccessText);}
catch(e1)
{}}
if(hasError)
eval("setUnBlockUIError_"+formName)();else
eval("setUnBlockUI_"+formName)();}});return false;});return this;};$.fn.ajaxSubmitAll=function(e)
{this.submit(function()
{var params={};var IncCounter=0;var OldArrayName="";var thisParam="";params['call']='ajax';$(document).find("input[checked], input[type='text'], input[type='hidden'], input[type='password'], option[selected], textarea").each(function()
{ArrayName=this.name||this.id||this.parentNode.name||this.parentNode.id||this.parentNode.parentNode.name||this.parentNode.parentNode.id;if(ArrayName==OldArrayName)
{thisParam.length=thisParam.length+1;thisParam[thisParam.length-1]=this.value;}
else
{thisParam=new Array(1);thisParam[0]=this.value;OldArrayName=ArrayName;}
params[ArrayName]=thisParam;});eval(" setBlockUI_"+formName)();$.post(this.getAttribute("action"),params,function(xml,textStatus)
{eval(" setUnBlockUI_"+formName)();strError="Unable to submit form. Please try again later.";oFocus=null;oRedirect="true";oSuccessText="";$("AjaxResponse",xml).each(function()
{var AjaxResp=this;$(document).find("input[type='checkbox'], input[type='image'], input[type='radio'], input[type='text'], input[type='password'], select, textarea").filter(":enabled").each(function()
{if(this.name==null)
{if(this.parentNode.name>0&&AjaxResp.getAttribute(this.parentNode.name)!=null)
{$(this).addClass("fielderror");$("div.error_"+this.name).html(AjaxResp.getAttribute(this.name));}}
else if(this.name.length>0&&AjaxResp.getAttribute(this.name)!=null)
{$(this).addClass("fielderror");$("div.error_"+this.name).html(AjaxResp.getAttribute(this.name));}
else
{$(this).removeClass("fielderror");$("div.error_"+this.name).html("");}});strRedirect=this.getAttribute("redirecturl");strError=this.getAttribute("error");oFocus=this.getAttribute("focus");oRedirect=this.getAttribute("Redirect");oSuccessText=this.getAttribute("SuccessText");onewWindowOnSuccess=this.getAttribute("newWindowOnSuccess");});if(oRedirect=="true")
{if(onewWindowOnSuccess=="true")
{window.open(strRedirect);eval("setUnBlockUI_"+formName)();}
else
window.location=strRedirect;}
else
{$("div#formErrors_"+formName).html("<ul>"+strError.replace(/(\t)(.+)/g,"<li>$2<\/li>")+"<\/ul>").filter(":hidden").fadeIn("normal");}},"xml");return false;});return this;};function charStrip(StripChars)
{var code;if(!e)
var e=window.event;if(e.keyCode)
code=e.keyCode;else if(e.which)
code=e.which;key=code;if(StripChars=="STRING_LITE")
ignore=(key<16||(key>16&&key<32)||key==60||key==62);else if(StripChars=="STRING_TIGHT")
ignore=(key<16||(key>16&&key<32)||key==60||key==62||key==124||key==34||key==44||key==92||key==39||key==38||key==35);else if(StripChars=="STRING_AGGRESSIVE")
ignore=(key<16||(key>16&&key<32)||key==60||key==62||key==124||key==34||key==44||key==92||key==39||key==38||key==35||key==59||key==36||key==37||key==64||key==40||key==41||key==43);else if(StripChars=="STRING_INTEGER")
ignore=(key<48||key>57);else if(StripChars=="STRING_NUMBER")
ignore=(key<46||(key>46&&key<48)||key>57);else
ignore=false;return(!ignore);}
