
if(dwr==null)var dwr={};if(dwr.engine==null)dwr.engine={};if(DWREngine==null)var DWREngine=dwr.engine;dwr.engine.setErrorHandler=function(handler){dwr.engine._errorHandler=handler;};dwr.engine.setWarningHandler=function(handler){dwr.engine._warningHandler=handler;};dwr.engine.setTextHtmlHandler=function(handler){dwr.engine._textHtmlHandler=handler;};dwr.engine.setTimeout=function(timeout){dwr.engine._timeout=timeout;};dwr.engine.setPreHook=function(handler){dwr.engine._preHook=handler;};dwr.engine.setPostHook=function(handler){dwr.engine._postHook=handler;};dwr.engine.setHeaders=function(headers){dwr.engine._headers=headers;};dwr.engine.setParameters=function(parameters){dwr.engine._parameters=parameters;};dwr.engine.XMLHttpRequest=1;dwr.engine.IFrame=2;dwr.engine.ScriptTag=3;dwr.engine.setRpcType=function(newType){if(newType!=dwr.engine.XMLHttpRequest&&newType!=dwr.engine.IFrame&&newType!=dwr.engine.ScriptTag){dwr.engine._handleError(null,{name:"dwr.engine.invalidRpcType",message:"RpcType must be one of dwr.engine.XMLHttpRequest or dwr.engine.IFrame or dwr.engine.ScriptTag"});return;}
dwr.engine._rpcType=newType;};dwr.engine.setHttpMethod=function(httpMethod){if(httpMethod!="GET"&&httpMethod!="POST"){dwr.engine._handleError(null,{name:"dwr.engine.invalidHttpMethod",message:"Remoting method must be one of GET or POST"});return;}
dwr.engine._httpMethod=httpMethod;};dwr.engine.setOrdered=function(ordered){dwr.engine._ordered=ordered;};dwr.engine.setAsync=function(async){dwr.engine._async=async;};dwr.engine.setActiveReverseAjax=function(activeReverseAjax){if(activeReverseAjax){if(dwr.engine._activeReverseAjax)return;dwr.engine._activeReverseAjax=true;dwr.engine._poll();}
else{if(dwr.engine._activeReverseAjax&&dwr.engine._pollReq)dwr.engine._pollReq.abort();dwr.engine._activeReverseAjax=false;}};dwr.engine.defaultErrorHandler=function(message,ex){dwr.engine._debug("Error: "+ex.name+", "+ex.message,true);if(message==null||message=="")alert("A server error has occured.");else if(message.indexOf("0x80040111")!=-1)dwr.engine._debug(message);else alert(message);};dwr.engine.defaultWarningHandler=function(message,ex){dwr.engine._debug(message);};dwr.engine.beginBatch=function(){if(dwr.engine._batch){dwr.engine._handleError(null,{name:"dwr.engine.batchBegun",message:"Batch already begun"});return;}
dwr.engine._batch=dwr.engine._createBatch();};dwr.engine.endBatch=function(options){var batch=dwr.engine._batch;if(batch==null){dwr.engine._handleError(null,{name:"dwr.engine.batchNotBegun",message:"No batch in progress"});return;}
dwr.engine._batch=null;if(batch.map.callCount==0)return;if(options)dwr.engine._mergeBatch(batch,options);if(dwr.engine._ordered&&dwr.engine._batchesLength!=0){dwr.engine._batchQueue[dwr.engine._batchQueue.length]=batch;}
else{dwr.engine._sendData(batch);}};dwr.engine.setPollMethod=function(type){dwr.engine.setPollType(type);};dwr.engine.setMethod=function(type){dwr.engine.setRpcType(type);};dwr.engine.setVerb=function(verb){dwr.engine.setHttpMethod(verb);};dwr.engine.setPollType=function(){dwr.engine._debug("Manually setting the Poll Type is not supported");};dwr.engine._origScriptSessionId=""+JAWR.dwr_scriptSessionId+"";dwr.engine._sessionCookieName="JSESSIONID";dwr.engine._allowGetForSafariButMakeForgeryEasier="";dwr.engine._scriptTagProtection="throw 'allowScriptTagRemoting is false.';";dwr.engine._defaultPath=""+JAWR.jawr_dwr_path+"";dwr.engine._pollWithXhr="false";dwr.engine._scriptSessionId=null;dwr.engine._getScriptSessionId=function(){if(dwr.engine._scriptSessionId==null){dwr.engine._scriptSessionId=dwr.engine._origScriptSessionId+Math.floor(Math.random()*1000);}
return dwr.engine._scriptSessionId;};dwr.engine._errorHandler=dwr.engine.defaultErrorHandler;dwr.engine._warningHandler=dwr.engine.defaultWarningHandler;dwr.engine._preHook=null;dwr.engine._postHook=null;dwr.engine._batches={};dwr.engine._batchesLength=0;dwr.engine._batchQueue=[];dwr.engine._rpcType=dwr.engine.XMLHttpRequest;dwr.engine._httpMethod="POST";dwr.engine._ordered=false;dwr.engine._async=true;dwr.engine._batch=null;dwr.engine._timeout=0;dwr.engine._DOMDocument=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];dwr.engine._XMLHTTP=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];dwr.engine._activeReverseAjax=false;dwr.engine._outstandingIFrames=[];dwr.engine._pollReq=null;dwr.engine._pollCometInterval=200;dwr.engine._pollRetries=0;dwr.engine._maxPollRetries=0;dwr.engine._textHtmlHandler=null;dwr.engine._headers=null;dwr.engine._parameters=null;dwr.engine._postSeperator="\n";dwr.engine._defaultInterceptor=function(data){return data;};dwr.engine._urlRewriteHandler=dwr.engine._defaultInterceptor;dwr.engine._contentRewriteHandler=dwr.engine._defaultInterceptor;dwr.engine._replyRewriteHandler=dwr.engine._defaultInterceptor;dwr.engine._nextBatchId=0;dwr.engine._propnames=["rpcType","httpMethod","async","timeout","errorHandler","warningHandler","textHtmlHandler"];dwr.engine._partialResponseNo=0;dwr.engine._partialResponseYes=1;dwr.engine._partialResponseFlush=2;dwr.engine._execute=function(path,scriptName,methodName,vararg_params){var singleShot=false;if(dwr.engine._batch==null){dwr.engine.beginBatch();singleShot=true;}
var batch=dwr.engine._batch;var args=[];for(var i=0;i<arguments.length-3;i++){args[i]=arguments[i+3];}
if(batch.path==null){batch.path=path;}
else{if(batch.path!=path){dwr.engine._handleError(batch,{name:"dwr.engine.multipleServlets",message:"Can't batch requests to multiple DWR Servlets."});return;}}
var callData;var lastArg=args[args.length-1];if(typeof lastArg=="function"||lastArg==null)callData={callback:args.pop()};else callData=args.pop();dwr.engine._mergeBatch(batch,callData);batch.handlers[batch.map.callCount]={exceptionHandler:callData.exceptionHandler,callback:callData.callback};var prefix="c"+batch.map.callCount+"-";batch.map[prefix+"scriptName"]=scriptName;batch.map[prefix+"methodName"]=methodName;batch.map[prefix+"id"]=batch.map.callCount;for(i=0;i<args.length;i++){dwr.engine._serializeAll(batch,[],args[i],prefix+"param"+i);}
batch.map.callCount++;if(singleShot)dwr.engine.endBatch();};dwr.engine._poll=function(){if(!dwr.engine._activeReverseAjax)return;var batch=dwr.engine._createBatch();batch.map.id=0;batch.map.callCount=1;batch.isPoll=true;if(dwr.engine._pollWithXhr=="true"){batch.rpcType=dwr.engine.XMLHttpRequest;batch.map.partialResponse=dwr.engine._partialResponseNo;}
else{if(navigator.userAgent.indexOf("Gecko/")!=-1){batch.rpcType=dwr.engine.XMLHttpRequest;batch.map.partialResponse=dwr.engine._partialResponseYes;}
else{batch.rpcType=dwr.engine.XMLHttpRequest;batch.map.partialResponse=dwr.engine._partialResponseNo;}}
batch.httpMethod="POST";batch.async=true;batch.timeout=0;batch.path=dwr.engine._defaultPath;batch.preHooks=[];batch.postHooks=[];batch.errorHandler=dwr.engine._pollErrorHandler;batch.warningHandler=dwr.engine._pollErrorHandler;batch.handlers[0]={callback:function(pause){dwr.engine._pollRetries=0;setTimeout("dwr.engine._poll()",pause);}};dwr.engine._sendData(batch);if(batch.rpcType==dwr.engine.XMLHttpRequest&&batch.map.partialResponse==dwr.engine._partialResponseYes){dwr.engine._checkCometPoll();}};dwr.engine._pollErrorHandler=function(msg,ex){dwr.engine._pollRetries++;dwr.engine._debug("Reverse Ajax poll failed (pollRetries="+dwr.engine._pollRetries+"): "+ex.name+" : "+ex.message);if(dwr.engine._pollRetries<dwr.engine._maxPollRetries){setTimeout("dwr.engine._poll()",10000);}
else{dwr.engine._activeReverseAjax=false;dwr.engine._debug("Giving up.");}};dwr.engine._createBatch=function(){var batch={map:{callCount:0,page:window.location.pathname+window.location.search,httpSessionId:dwr.engine._getJSessionId(),scriptSessionId:dwr.engine._getScriptSessionId()},charsProcessed:0,paramCount:0,parameters:{},headers:{},isPoll:false,handlers:{},preHooks:[],postHooks:[],rpcType:dwr.engine._rpcType,httpMethod:dwr.engine._httpMethod,async:dwr.engine._async,timeout:dwr.engine._timeout,errorHandler:dwr.engine._errorHandler,warningHandler:dwr.engine._warningHandler,textHtmlHandler:dwr.engine._textHtmlHandler};if(dwr.engine._preHook)batch.preHooks.push(dwr.engine._preHook);if(dwr.engine._postHook)batch.postHooks.push(dwr.engine._postHook);var propname,data;if(dwr.engine._headers){for(propname in dwr.engine._headers){data=dwr.engine._headers[propname];if(typeof data!="function")batch.headers[propname]=data;}}
if(dwr.engine._parameters){for(propname in dwr.engine._parameters){data=dwr.engine._parameters[propname];if(typeof data!="function")batch.parameters[propname]=data;}}
return batch;};dwr.engine._mergeBatch=function(batch,overrides){var propname,data;for(var i=0;i<dwr.engine._propnames.length;i++){propname=dwr.engine._propnames[i];if(overrides[propname]!=null)batch[propname]=overrides[propname];}
if(overrides.preHook!=null)batch.preHooks.unshift(overrides.preHook);if(overrides.postHook!=null)batch.postHooks.push(overrides.postHook);if(overrides.headers){for(propname in overrides.headers){data=overrides.headers[propname];if(typeof data!="function")batch.headers[propname]=data;}}
if(overrides.parameters){for(propname in overrides.parameters){data=overrides.parameters[propname];if(typeof data!="function")batch.map["p-"+propname]=""+data;}}};dwr.engine._getJSessionId=function(){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=cookies[i];while(cookie.charAt(0)==' ')cookie=cookie.substring(1,cookie.length);if(cookie.indexOf(dwr.engine._sessionCookieName+"=")==0){return cookie.substring(dwr.engine._sessionCookieName.length+1,cookie.length);}}
return"";};dwr.engine._checkCometPoll=function(){for(var i=0;i<dwr.engine._outstandingIFrames.length;i++){var text="";var iframe=dwr.engine._outstandingIFrames[i];try{text=dwr.engine._getTextFromCometIFrame(iframe);}
catch(ex){dwr.engine._handleWarning(iframe.batch,ex);}
if(text!="")dwr.engine._processCometResponse(text,iframe.batch);}
if(dwr.engine._pollReq){var req=dwr.engine._pollReq;var text=req.responseText;if(text!=null)dwr.engine._processCometResponse(text,req.batch);}
if(dwr.engine._outstandingIFrames.length>0||dwr.engine._pollReq){setTimeout("dwr.engine._checkCometPoll()",dwr.engine._pollCometInterval);}};dwr.engine._getTextFromCometIFrame=function(frameEle){var body=frameEle.contentWindow.document.body;if(body==null)return"";var text=body.innerHTML;if(text.indexOf("<PRE>")==0||text.indexOf("<pre>")==0){text=text.substring(5,text.length-7);}
return text;};dwr.engine._processCometResponse=function(response,batch){if(batch.charsProcessed==response.length)return;if(response.length==0){batch.charsProcessed=0;return;}
var firstStartTag=response.indexOf("//#DWR-START#",batch.charsProcessed);if(firstStartTag==-1){batch.charsProcessed=response.length;return;}
var lastEndTag=response.lastIndexOf("//#DWR-END#");if(lastEndTag==-1){return;}
if(response.charCodeAt(lastEndTag+11)==13&&response.charCodeAt(lastEndTag+12)==10){batch.charsProcessed=lastEndTag+13;}
else{batch.charsProcessed=lastEndTag+11;}
var exec=response.substring(firstStartTag+13,lastEndTag);dwr.engine._receivedBatch=batch;dwr.engine._eval(exec);dwr.engine._receivedBatch=null;};dwr.engine._sendData=function(batch){batch.map.batchId=dwr.engine._nextBatchId;dwr.engine._nextBatchId++;dwr.engine._batches[batch.map.batchId]=batch;dwr.engine._batchesLength++;batch.completed=false;for(var i=0;i<batch.preHooks.length;i++){batch.preHooks[i]();}
batch.preHooks=null;if(batch.timeout&&batch.timeout!=0){batch.interval=setInterval(function(){dwr.engine._abortRequest(batch);},batch.timeout);}
if(batch.rpcType==dwr.engine.XMLHttpRequest){if(window.XMLHttpRequest){batch.req=new XMLHttpRequest();}
else if(window.ActiveXObject&&!(navigator.userAgent.indexOf("Mac")>=0&&navigator.userAgent.indexOf("MSIE")>=0)){batch.req=dwr.engine._newActiveXObject(dwr.engine._XMLHTTP);}}
var prop,request;if(batch.req){if(batch.async){batch.req.onreadystatechange=function(){if(typeof dwr!='undefined')dwr.engine._stateChange(batch);};}
if(batch.isPoll){dwr.engine._pollReq=batch.req;if(!document.all)batch.req.batch=batch;}
var indexSafari=navigator.userAgent.indexOf("Safari/");if(indexSafari>=0){var version=navigator.userAgent.substring(indexSafari+7);if(parseInt(version,10)<400){if(dwr.engine._allowGetForSafariButMakeForgeryEasier=="true")batch.httpMethod="GET";else dwr.engine._handleWarning(batch,{name:"dwr.engine.oldSafari",message:"Safari GET support disabled. See getahead.org/dwr/server/servlet and allowGetForSafariButMakeForgeryEasier."});}}
batch.mode=batch.isPoll?dwr.engine._ModePlainPoll:dwr.engine._ModePlainCall;request=dwr.engine._constructRequest(batch);try{batch.req.open(batch.httpMethod,request.url,batch.async);try{for(prop in batch.headers){var value=batch.headers[prop];if(typeof value=="string")batch.req.setRequestHeader(prop,value);}
if(!batch.headers["Content-Type"])batch.req.setRequestHeader("Content-Type","text/plain");}
catch(ex){dwr.engine._handleWarning(batch,ex);}
batch.req.send(request.body);if(!batch.async)dwr.engine._stateChange(batch);}
catch(ex){dwr.engine._handleError(batch,ex);}}
else if(batch.rpcType!=dwr.engine.ScriptTag){var idname=batch.isPoll?"dwr-if-poll-"+batch.map.batchId:"dwr-if-"+batch.map["c0-id"];if(batch.isPoll&&window.ActiveXObject){batch.htmlfile=new window.ActiveXObject("htmlfile");batch.htmlfile.open();batch.htmlfile.write("<html>");batch.htmlfile.write("<div><iframe className='wibble' src='javascript:void(0)' id='"+idname+"' name='"+idname+"' onload='dwr.engine._iframeLoadingComplete("+batch.map.batchId+");'></iframe></div>");batch.htmlfile.write("</html>");batch.htmlfile.close();batch.htmlfile.parentWindow.dwr=dwr;batch.document=batch.htmlfile;}
else{batch.div=document.createElement("div");document.body.appendChild(batch.div);batch.div.innerHTML="<iframe src='javascript:void(0)' frameborder='0' style='width:0px;height:0px;border:0;' id='"+idname+"' name='"+idname+"' onload='dwr.engine._iframeLoadingComplete ("+batch.map.batchId+");'></iframe>";batch.document=document;}
batch.iframe=batch.document.getElementById(idname);batch.iframe.batch=batch;batch.mode=batch.isPoll?dwr.engine._ModeHtmlPoll:dwr.engine._ModeHtmlCall;if(batch.isPoll)dwr.engine._outstandingIFrames.push(batch.iframe);request=dwr.engine._constructRequest(batch);if(batch.httpMethod=="GET"){batch.iframe.setAttribute("src",request.url);}
else{batch.form=batch.document.createElement("form");batch.form.setAttribute("id","dwr-form");batch.form.setAttribute("action",request.url);batch.form.setAttribute("target",idname);batch.form.target=idname;batch.form.setAttribute("method",batch.httpMethod);for(prop in batch.map){var value=batch.map[prop];if(typeof value!="function"){var formInput=batch.document.createElement("input");formInput.setAttribute("type","hidden");formInput.setAttribute("name",prop);formInput.setAttribute("value",value);batch.form.appendChild(formInput);}}
batch.document.body.appendChild(batch.form);batch.form.submit();}}
else{batch.httpMethod="GET";batch.mode=batch.isPoll?dwr.engine._ModePlainPoll:dwr.engine._ModePlainCall;request=dwr.engine._constructRequest(batch);batch.script=document.createElement("script");batch.script.id="dwr-st-"+batch.map["c0-id"];batch.script.src=request.url;document.body.appendChild(batch.script);}};dwr.engine._ModePlainCall="/call/plaincall/";dwr.engine._ModeHtmlCall="/call/htmlcall/";dwr.engine._ModePlainPoll="/call/plainpoll/";dwr.engine._ModeHtmlPoll="/call/htmlpoll/";dwr.engine._constructRequest=function(batch){var request={url:batch.path+batch.mode,body:null};if(batch.isPoll==true){request.url+="ReverseAjax.dwr";}
else if(batch.map.callCount==1){request.url+=batch.map["c0-scriptName"]+"."+batch.map["c0-methodName"]+".dwr";}
else{request.url+="Multiple."+batch.map.callCount+".dwr";}
var sessionMatch=location.href.match(/jsessionid=([^?]+)/);if(sessionMatch!=null){request.url+=";jsessionid="+sessionMatch[1];}
var prop;if(batch.httpMethod=="GET"){batch.map.callCount=""+batch.map.callCount;request.url+="?";for(prop in batch.map){if(typeof batch.map[prop]!="function"){request.url+=encodeURIComponent(prop)+"="+encodeURIComponent(batch.map[prop])+"&";}}
request.url=request.url.substring(0,request.url.length-1);}
else{request.body="";for(prop in batch.map){if(typeof batch.map[prop]!="function"){request.body+=prop+"="+batch.map[prop]+dwr.engine._postSeperator;}}
request.body=dwr.engine._contentRewriteHandler(request.body);}
request.url=dwr.engine._urlRewriteHandler(request.url);return request;};dwr.engine._stateChange=function(batch){var toEval;if(batch.completed){dwr.engine._debug("Error: _stateChange() with batch.completed");return;}
var req=batch.req;try{if(req.readyState!=4)return;}
catch(ex){dwr.engine._handleWarning(batch,ex);dwr.engine._clearUp(batch);return;}
try{var reply=req.responseText;reply=dwr.engine._replyRewriteHandler(reply);var status=req.status;if(reply==null||reply==""){dwr.engine._handleWarning(batch,{name:"dwr.engine.missingData",message:"No data received from server"});}
else if(status!=200){dwr.engine._handleError(batch,{name:"dwr.engine.http."+status,message:req.statusText});}
else{var contentType=req.getResponseHeader("Content-Type");if(!contentType.match(/^text\/plain/)&&!contentType.match(/^text\/javascript/)){if(contentType.match(/^text\/html/)&&typeof batch.textHtmlHandler=="function"){batch.textHtmlHandler({status:status,responseText:reply,contentType:contentType});}
else{dwr.engine._handleWarning(batch,{name:"dwr.engine.invalidMimeType",message:"Invalid content type: '"+contentType+"'"});}}
else{if(batch.isPoll&&batch.map.partialResponse==dwr.engine._partialResponseYes){dwr.engine._processCometResponse(reply,batch);}
else{if(reply.search("//#DWR")==-1){dwr.engine._handleWarning(batch,{name:"dwr.engine.invalidReply",message:"Invalid reply from server"});}
else{toEval=reply;}}}}}
catch(ex){dwr.engine._handleWarning(batch,ex);}
dwr.engine._callPostHooks(batch);dwr.engine._receivedBatch=batch;if(toEval!=null)toEval=toEval.replace(dwr.engine._scriptTagProtection,"");dwr.engine._eval(toEval);dwr.engine._receivedBatch=null;dwr.engine._validateBatch(batch);dwr.engine._clearUp(batch);};dwr.engine._validateBatch=function(batch){if(!batch.completed){for(var i=0;i<batch.map.callCount;i++){if(batch.handlers[i]!=null){dwr.engine._handleWarning(batch,{name:"dwr.engine.incompleteReply",message:"Incomplete reply from server"});break;}}}}
dwr.engine._iframeLoadingComplete=function(batchId){var batch=dwr.engine._batches[batchId];if(batch)dwr.engine._validateBatch(batch);}
dwr.engine._remoteHandleCallback=function(batchId,callId,reply){var batch=dwr.engine._batches[batchId];if(batch==null){dwr.engine._debug("Warning: batch == null in remoteHandleCallback for batchId="+batchId,true);return;}
try{var handlers=batch.handlers[callId];batch.handlers[callId]=null;if(!handlers){dwr.engine._debug("Warning: Missing handlers. callId="+callId,true);}
else if(typeof handlers.callback=="function")handlers.callback(reply);}
catch(ex){dwr.engine._handleError(batch,ex);}};dwr.engine._remoteHandleException=function(batchId,callId,ex){var batch=dwr.engine._batches[batchId];if(batch==null){dwr.engine._debug("Warning: null batch in remoteHandleException",true);return;}
var handlers=batch.handlers[callId];batch.handlers[callId]=null;if(handlers==null){dwr.engine._debug("Warning: null handlers in remoteHandleException",true);return;}
if(ex.message==undefined)ex.message="";if(typeof handlers.exceptionHandler=="function")handlers.exceptionHandler(ex.message,ex);else if(typeof batch.errorHandler=="function")batch.errorHandler(ex.message,ex);};dwr.engine._remoteHandleBatchException=function(ex,batchId){var searchBatch=(dwr.engine._receivedBatch==null&&batchId!=null);if(searchBatch){dwr.engine._receivedBatch=dwr.engine._batches[batchId];}
if(ex.message==undefined)ex.message="";dwr.engine._handleError(dwr.engine._receivedBatch,ex);if(searchBatch){dwr.engine._receivedBatch=null;dwr.engine._clearUp(dwr.engine._batches[batchId]);}};dwr.engine._remotePollCometDisabled=function(ex,batchId){dwr.engine.setActiveReverseAjax(false);var searchBatch=(dwr.engine._receivedBatch==null&&batchId!=null);if(searchBatch){dwr.engine._receivedBatch=dwr.engine._batches[batchId];}
if(ex.message==undefined)ex.message="";dwr.engine._handleError(dwr.engine._receivedBatch,ex);if(searchBatch){dwr.engine._receivedBatch=null;dwr.engine._clearUp(dwr.engine._batches[batchId]);}};dwr.engine._remoteBeginIFrameResponse=function(iframe,batchId){if(iframe!=null)dwr.engine._receivedBatch=iframe.batch;dwr.engine._callPostHooks(dwr.engine._receivedBatch);};dwr.engine._remoteEndIFrameResponse=function(batchId){dwr.engine._clearUp(dwr.engine._receivedBatch);dwr.engine._receivedBatch=null;};dwr.engine._eval=function(script){if(script==null)return null;if(script==""){dwr.engine._debug("Warning: blank script",true);return null;}
return eval(script);};dwr.engine._abortRequest=function(batch){if(batch&&!batch.completed){clearInterval(batch.interval);dwr.engine._clearUp(batch);if(batch.req)batch.req.abort();dwr.engine._handleError(batch,{name:"dwr.engine.timeout",message:"Timeout"});}};dwr.engine._callPostHooks=function(batch){if(batch.postHooks){for(var i=0;i<batch.postHooks.length;i++){batch.postHooks[i]();}
batch.postHooks=null;}};dwr.engine._clearUp=function(batch){if(!batch){dwr.engine._debug("Warning: null batch in dwr.engine._clearUp()",true);return;}
if(batch.completed=="true"){dwr.engine._debug("Warning: Double complete",true);return;}
if(batch.div)batch.div.parentNode.removeChild(batch.div);if(batch.iframe){for(var i=0;i<dwr.engine._outstandingIFrames.length;i++){if(dwr.engine._outstandingIFrames[i]==batch.iframe){dwr.engine._outstandingIFrames.splice(i,1);}}
batch.iframe.parentNode.removeChild(batch.iframe);}
if(batch.form)batch.form.parentNode.removeChild(batch.form);if(batch.req){if(batch.req==dwr.engine._pollReq)dwr.engine._pollReq=null;delete batch.req;}
if(batch.map&&(batch.map.batchId||batch.map.batchId==0)){delete dwr.engine._batches[batch.map.batchId];dwr.engine._batchesLength--;}
batch.completed=true;if(dwr.engine._batchQueue.length!=0){var sendbatch=dwr.engine._batchQueue.shift();dwr.engine._sendData(sendbatch);}};dwr.engine._handleError=function(batch,ex){if(typeof ex=="string")ex={name:"unknown",message:ex};if(ex.message==null)ex.message="";if(ex.name==null)ex.name="unknown";if(batch&&typeof batch.errorHandler=="function")batch.errorHandler(ex.message,ex);else if(dwr.engine._errorHandler)dwr.engine._errorHandler(ex.message,ex);if(batch)dwr.engine._clearUp(batch);};dwr.engine._handleWarning=function(batch,ex){if(typeof ex=="string")ex={name:"unknown",message:ex};if(ex.message==null)ex.message="";if(ex.name==null)ex.name="unknown";if(batch&&typeof batch.warningHandler=="function")batch.warningHandler(ex.message,ex);else if(dwr.engine._warningHandler)dwr.engine._warningHandler(ex.message,ex);if(batch)dwr.engine._clearUp(batch);};dwr.engine._serializeAll=function(batch,referto,data,name){if(data==null){batch.map[name]="null:null";return;}
switch(typeof data){case"boolean":batch.map[name]="boolean:"+data;break;case"number":batch.map[name]="number:"+data;break;case"string":batch.map[name]="string:"+encodeURIComponent(data);break;case"object":if(data instanceof String)batch.map[name]="String:"+encodeURIComponent(data);else if(data instanceof Boolean)batch.map[name]="Boolean:"+data;else if(data instanceof Number)batch.map[name]="Number:"+data;else if(data instanceof Date)batch.map[name]="Date:"+data.getTime();else if(data&&data.join)batch.map[name]=dwr.engine._serializeArray(batch,referto,data,name);else batch.map[name]=dwr.engine._serializeObject(batch,referto,data,name);break;case"function":break;default:dwr.engine._handleWarning(null,{name:"dwr.engine.unexpectedType",message:"Unexpected type: "+typeof data+", attempting default converter."});batch.map[name]="default:"+data;break;}};dwr.engine._lookup=function(referto,data,name){var lookup;for(var i=0;i<referto.length;i++){if(referto[i].data==data){lookup=referto[i];break;}}
if(lookup)return"reference:"+lookup.name;referto.push({data:data,name:name});return null;};dwr.engine._serializeObject=function(batch,referto,data,name){var ref=dwr.engine._lookup(referto,data,name);if(ref)return ref;if(data.nodeName&&data.nodeType){return dwr.engine._serializeXml(batch,referto,data,name);}
var reply="Object_"+dwr.engine._getObjectClassName(data)+":{";var element;for(element in data){if(typeof data[element]!="function"){batch.paramCount++;var childName="c"+dwr.engine._batch.map.callCount+"-e"+batch.paramCount;dwr.engine._serializeAll(batch,referto,data[element],childName);reply+=encodeURIComponent(element)+":reference:"+childName+", ";}}
if(reply.substring(reply.length-2)==", "){reply=reply.substring(0,reply.length-2);}
reply+="}";return reply;};dwr.engine._errorClasses={"Error":Error,"EvalError":EvalError,"RangeError":RangeError,"ReferenceError":ReferenceError,"SyntaxError":SyntaxError,"TypeError":TypeError,"URIError":URIError};dwr.engine._getObjectClassName=function(obj){if(obj&&obj.constructor&&obj.constructor.toString)
{var str=obj.constructor.toString();var regexpmatch=str.match(/function\s+(\w+)/);if(regexpmatch&&regexpmatch.length==2){return regexpmatch[1];}}
if(obj&&obj.constructor){for(var errorname in dwr.engine._errorClasses){if(obj.constructor==dwr.engine._errorClasses[errorname])return errorname;}}
if(obj){var str=Object.prototype.toString.call(obj);var regexpmatch=str.match(/\[object\s+(\w+)/);if(regexpmatch&&regexpmatch.length==2){return regexpmatch[1];}}
return"Object";};dwr.engine._serializeXml=function(batch,referto,data,name){var ref=dwr.engine._lookup(referto,data,name);if(ref)return ref;var output;if(window.XMLSerializer)output=new XMLSerializer().serializeToString(data);else if(data.toXml)output=data.toXml;else output=data.innerHTML;return"XML:"+encodeURIComponent(output);};dwr.engine._serializeArray=function(batch,referto,data,name){var ref=dwr.engine._lookup(referto,data,name);if(ref)return ref;var reply="Array:[";for(var i=0;i<data.length;i++){if(i!=0)reply+=",";batch.paramCount++;var childName="c"+dwr.engine._batch.map.callCount+"-e"+batch.paramCount;dwr.engine._serializeAll(batch,referto,data[i],childName);reply+="reference:";reply+=childName;}
reply+="]";return reply;};dwr.engine._unserializeDocument=function(xml){var dom;if(window.DOMParser){var parser=new DOMParser();dom=parser.parseFromString(xml,"text/xml");if(!dom.documentElement||dom.documentElement.tagName=="parsererror"){var message=dom.documentElement.firstChild.data;message+="\n"+dom.documentElement.firstChild.nextSibling.firstChild.data;throw message;}
return dom;}
else if(window.ActiveXObject){dom=dwr.engine._newActiveXObject(dwr.engine._DOMDocument);dom.loadXML(xml);return dom;}
else{var div=document.createElement("div");div.innerHTML=xml;return div;}};dwr.engine._newActiveXObject=function(axarray){var returnValue;for(var i=0;i<axarray.length;i++){try{returnValue=new ActiveXObject(axarray[i]);break;}
catch(ex){}}
return returnValue;};dwr.engine._debug=function(message,stacktrace){var written=false;try{if(window.console){if(stacktrace&&window.console.trace)window.console.trace();window.console.log(message);written=true;}
else if(window.opera&&window.opera.postError){window.opera.postError(message);written=true;}}
catch(ex){}
if(!written){var debug=document.getElementById("dwr-debug");if(debug){var contents=message+"<br/>"+debug.innerHTML;if(contents.length>2048)contents=contents.substring(0,2048);debug.innerHTML=contents;}}};if(dwr==null)var dwr={};if(dwr.engine==null)dwr.engine={};if(DWREngine==null)var DWREngine=dwr.engine;if(ReviewVoteService==null)var ReviewVoteService={};ReviewVoteService._path=''+JAWR.jawr_dwr_path+'';ReviewVoteService.voteYesForReview=function(p0,callback){dwr.engine._execute(ReviewVoteService._path,'ReviewVoteService','voteYesForReview',p0,callback);}
ReviewVoteService.voteNoForReview=function(p0,callback){dwr.engine._execute(ReviewVoteService._path,'ReviewVoteService','voteNoForReview',p0,callback);}
if(PicturesService==null)var PicturesService={};PicturesService._path=''+JAWR.jawr_dwr_path+'';PicturesService.getPictures=function(p0,callback){dwr.engine._execute(PicturesService._path,'PicturesService','getPictures',p0,false,callback);}
if(MapModulePersistenceService==null)var MapModulePersistenceService={};MapModulePersistenceService._path=''+JAWR.jawr_dwr_path+'';MapModulePersistenceService.get=function(callback){dwr.engine._execute(MapModulePersistenceService._path,'MapModulePersistenceService','get',callback);}
MapModulePersistenceService.store=function(p0,p1,callback){dwr.engine._execute(MapModulePersistenceService._path,'MapModulePersistenceService','store',p0,p1,callback);}
if(ActivityCalendarService==null)var ActivityCalendarService={};ActivityCalendarService._path=''+JAWR.jawr_dwr_path+'';ActivityCalendarService.getActivityDates=function(p0,callback){dwr.engine._execute(ActivityCalendarService._path,'ActivityCalendarService','getActivityDates',p0,false,callback);}
if(FeedsDiscoveryService==null)var FeedsDiscoveryService={};FeedsDiscoveryService._path=''+JAWR.jawr_dwr_path+'';FeedsDiscoveryService.autodiscovery=function(p0,callback){dwr.engine._execute(FeedsDiscoveryService._path,'FeedsDiscoveryService','autodiscovery',p0,callback);}
if(TopListSettingsService==null)var TopListSettingsService={};TopListSettingsService._path=''+JAWR.jawr_dwr_path+'';TopListSettingsService.saveCategoryState=function(p0,p1,p2,callback){dwr.engine._execute(TopListSettingsService._path,'TopListSettingsService','saveCategoryState',p0,p1,p2,callback);}
if(PortalPersistenceService==null)var PortalPersistenceService={};PortalPersistenceService._path=''+JAWR.jawr_dwr_path+'';PortalPersistenceService.removePortlet=function(p0,callback){dwr.engine._execute(PortalPersistenceService._path,'PortalPersistenceService','removePortlet',p0,callback);}
PortalPersistenceService.moveBlock=function(p0,p1,callback){dwr.engine._execute(PortalPersistenceService._path,'PortalPersistenceService','moveBlock',p0,p1,callback);}
jQuery.viewPortSize=function(){var viewportWidth;var viewportHeight;if(typeof window.innerWidth!='undefined'){viewportWidth=window.innerWidth;viewportHeight=window.innerHeight;}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){viewportWidth=document.documentElement.clientWidth;viewportHeight=document.documentElement.clientHeight;}else{viewportWidth=document.getElementsByTagName('body')[0].clientWidth;viewportHeight=document.getElementsByTagName('body')[0].clientHeight;}
return{width:viewportWidth,height:viewportHeight};};(function($){var _evalCallback=function(){var callback=$('#evalCallback').remove().html();if(callback!=null){eval(callback);}};var _getJsonData=function(){var data=$j("#jsonData").remove().html();if(data!=null){eval("data = {"+data+"};");return data;}else{return null;}};var _performRequest=function(opts,url,data){var $loading_img;$.ajax({url:url,type:opts.method,data:data,cache:opts.cache,contentType:opts.contentType,beforeSend:function(){opts.onStart(opts);if(opts.loading_img){var spinnerHome=opts.loading_target?typeof opts.loading_target==='string'?$(opts.loading_target):opts.loading_target:opts.target;$loading_img=$('<div />').attr('id','AjaxifyLoading').append($('<img />').attr({'src':opts.loading_img,'alt':'Loading...'})).appendTo(spinnerHome);}},success:function(HTML){$loading_img&&$loading_img.remove();var content;if(opts.tagToLoad){content=$(HTML).find(opts.tagToLoad).clone();}else{content=$(HTML);}
$(opts.target).empty().append(content);_evalCallback();opts.onSuccess(opts,_getJsonData());},complete:function(){opts.onComplete(opts);},error:function(){$loading_img&&$loading_img.remove();opts.onError(opts);}});};$.fn.ajaxify=function(options){if(!jQuery(this).size()){return false;}
return this.each(function(){var defaults=$.extend({},$.fn.ajaxify.defaults,options),$this=$(this),collectParams=function(){var paramString=defaults.params;if(defaults.forms){paramString+='&'+$(defaults.forms).serialize();}
return paramString;};var eventHandler=function(){_performRequest(defaults,defaults.link||($this.attr('action')||$this.attr('href')),collectParams());return false;};$this.bind(defaults.event,eventHandler);});};$.fn.ajaxify.defaults={event:'click',link:false,target:'#container',tagToLoad:false,method:'GET',loading_img:false,loading_target:false,forms:false,params:'ajax=true',cache:false,onStart:function(op){},onError:function(op){},onSuccess:function(op){},onComplete:function(op){}};})(jQuery);(function($){$.widget("ui.modalDialog",{_init:function(){this._overlayLayer=null;this._lockerLayer=null;this._closed=false;},update:function(){var wnd=$(window);var wndSize=jQuery.viewPortSize();var ww=wndSize.width,wh=wndSize.height,wl=wnd.scrollLeft(),ws=wnd.scrollTop();var dw=this.element.width(),dh=this.element.height();var top=(wh-dh)/2;if(top<0)top=0;top+=ws;var left=(ww-dw)/2;if(left<0)left=0;left+=wl;this.element.css({position:"absolute",zIndex:9999,top:top,left:left});},loadingOverlay:function(loading){if(this.options.overlay){this._showOverlay();if(loading){var overlayLoading=$("<img/>").attr("src",DDI.contextPath+"/img/overlay-loading.gif");$(this._overlayLayer).append(overlayLoading);}else{$("img",this._overlayLayer).remove();}}},_showOverlay:function(){if(this._overlayLayer){return;}
var _this=this;var overlayHeight=function(){var windowHeight=0;if(window.innerHeight&&window.scrollMaxY){windowHeight=window.innerHeight+window.scrollMaxY;}
else{if(document.documentElement&&document.documentElement.scrollHeight){windowHeight=document.documentElement.scrollHeight;}
else{if(document.body&&document.body.scrollHeight){windowHeight=document.body.scrollHeight;}}}
return windowHeight;};this._overlayLayer=$('<div/>').appendTo(document.body).addClass('overlay').css({borderWidth:0,margin:0,padding:0,position:'fixed',top:0,left:0,height:'100%',width:'100%',zIndex:7000});if(this.options.removable===true){this._overlayLayer.css({opacity:0.5,background:"black"}).click(function(){_this.close();});}else{this._overlayLayer.css({opacity:0,background:"black"});}
if($.browser.msie&&/6.0/.test(navigator.userAgent)){$('select').hide();}
var resizeCB=function(){_this.update();if($(document.body).height()>$(window).height()){return;}
var height=overlayHeight();_this._overlayLayer.height(height);_this._overlayLayer.height();};$(window).bind('resize.modaldialog',null,resizeCB);},_destroyOverlay:function(){this._overlayLayer!==null&&this._overlayLayer.remove();this._overlayLayer=null;$(window).unbind('resize.modaldialog');$.browser.msie&&/6.0/.test(navigator.userAgent)&&$('select').show();},open:function(){this._closed=false;this.update();if(this.options.overlay){this.loadingOverlay(false);this._showOverlay();}
this.element.show();this._overlayLayer.height();},closed:function(){return this._closed;},close:function(){this._destroyOverlay();this.element.hide();this.releaseResources();this._closed=true;},lock:function(){this._closed=false;this._lockerLayer=$("<div/>").appendTo(this.element).addClass('locker').css({width:this.element.width(),height:this.element.height()});},unlock:function(){this._lockerLayer!==null&&this._lockerLayer.remove();this._lockerLayer=null;},opened:function(){return this.element.css("display")!=="none";},locked:function(){return this._lockerLayer!==null;},closeHandler:function(fn){this.options.onDialogClose=fn;},removable:function(value){this.options.removable=value;},releaseResources:function(){this.options.onDialogClose();}});$.extend($.ui.modalDialog,{getter:"opened locked closed releaseResources",setter:"closeHandler",defaults:{overlay:true,removable:true,onDialogClose:function(){return false;}}});$(document).ready(function(){$("#modalDialog").modalDialog();});$.fn.extend({dialogAjaxify:function(params){var dialogSelector='#modalDialog';var dialogLayer=$(dialogSelector);var p=$.extend({update_position:true,target:dialogSelector,loading_target:dialogSelector+' .locker',loading_img:DDI.contextPath+'/img/loading.gif'},params);$.extend(p,{onStart:function(){if(params!==undefined&&params['onStart']!==undefined){params.onStart();}
dialogLayer.modalDialog("loadingOverlay",true);dialogLayer.modalDialog("releaseResources");dialogLayer.modalDialog("lock");},onSuccess:function(opts,jsonData){if(!dialogLayer.modalDialog("closed")){dialogLayer.modalDialog("unlock");dialogLayer.modalDialog("loadingOverlay",false);if(!dialogLayer.modalDialog("opened")){dialogLayer.modalDialog("open");}
if(p.update_position){dialogLayer.modalDialog("update");}}
if(params!==undefined&&params['onSuccess']!==undefined){params.onSuccess(jsonData);}
$('.dialogCancel',dialogLayer).click(function(){dialogLayer.modalDialog("close");return false;});}});this.ajaxify(p);},showOverlay:function(){var dialogSelector='#modalDialog';var dialogLayer=$(dialogSelector);dialogLayer.modalDialog("removable",false);dialogLayer.modalDialog("loadingOverlay",false);}});})(jQuery);
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))
return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)
$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)
this.elements.unbind(this.type,this.fn);else if(this.fn2)
this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
$.event.remove(el,query.type,query.fn);});}
else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)
$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);}
else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)
$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)
r.context=a.context,r.selector=a.selector;if(typeof a=='string')
r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);;(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}
break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}
break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}
break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}
break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}
break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}
if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}
$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])
cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)
return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){v=words.slice(0,words.length-1).join(options.multipleSeparator)+options.multipleSeparator+v;}
v+=options.multipleSeparator;}
$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}
function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return;}
var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)
return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)
currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value){return[""];}
var words=value.split(options.multipleSeparator);var result=[];$.each(words,function(i,value){if($.trim(value))
result[i]=$.trim(value);});return result;}
function lastWord(value){if(!options.multiple)
return value;var words=trimWords(value);return words[words.length-1];}
function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$.Autocompleter.Selection(input,previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}
else
$input.val("");}});}
if(wasVisible)
$.Autocompleter.Selection(input,input.value.length,input.value.length);};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)
term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}
return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)
s=s.toLowerCase();var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase());}
if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}
if(!data[q]){length++;}
data[q]=value;}
function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)
continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])
stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}
setTimeout(populate,25);function flush(){data={};length=0;}
return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)
return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}
return csub;}else
if(data[q]){return data[q];}else
if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}
return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)
return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)
element.css("width",options.width);needsInit=false;}
function target(event){var element=event.target;while(element&&element.tagName!="LI")
element=element.parentNode;if(!element)
return[];return element;}
function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}
function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}
function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])
continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)
continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}
listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}
if($.fn.bgiframe)
list.bgiframe();}
return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.Autocompleter.Selection=function(field,start,end){if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};})(jQuery);(function($){var autocompleteCounter=1;var id;$.fn.extend({ddiAutocomplete:function(options){id=autocompleteCounter++;var defaults={width:320,max:150,autoFill:false,highlight:false,url:DDI.contextPath+"/geochoice/suggest/",formatItem:function(row,i,total,value,term){var matched=row[0];if(row[1]!=undefined){var resulted=row[1];}
matched=matched.replace(new RegExp("(^"+term+")","gi"),"<strong>$1</strong>");return'<div><div style="float:left">'+matched+'</div>'
+(resulted!=undefined?'<div style="float:right">'+resulted+'</div></div>':'</div>');},formatResult:function(row){var result=row[1];if(row[1]==undefined){result=row[0];}
return result;},resultsClass:'ac_results '+id};var opts=$.extend(defaults,options);$(this).autocomplete(opts.url,opts);if($.browser.msie){var this_=this;$("div.ac_results."+id+" ul").livequery('scroll',function(){this_.focus();$(this).trigger('mouseup');});}},ddiAutocompleteDetach:function(){$(this).unautocomplete();$("div.ac_results."+id).remove().hide();}});})(jQuery);;(function($){if(/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery)||/^1.1/.test($.fn.jquery)){alert('blockUI requires jQuery v1.2.3 or later!  You are using v'+$.fn.jquery);return;}
$.fn._fadeIn=$.fn.fadeIn;$.blockUI=function(opts){install(window,opts);};$.unblockUI=function(opts){remove(window,opts);};$.growlUI=function(title,message,timeout){var $m=$('<div class="growlUI"></div>');if(title)$m.append('<h1>'+title+'</h1>');if(message)$m.append('<h2>'+message+'</h2>');if(timeout==undefined)timeout=3000;$.blockUI({message:$m,fadeIn:700,fadeOut:1000,centerY:false,timeout:timeout,showOverlay:false,css:$.blockUI.defaults.growlCSS});};$.fn.block=function(opts){return this.unblock({fadeOut:0}).each(function(){if($.css(this,'position')=='static')
this.style.position='relative';if($.browser.msie)
this.style.zoom=1;install(this,opts);});};$.fn.unblock=function(opts){return this.each(function(){remove(this,opts);});};$.blockUI.version=2.18;$.blockUI.defaults={message:'<h1>Please wait...</h1>',css:{padding:0,margin:0,width:'30%',top:'40%',left:'35%',textAlign:'center',color:'#000',border:'3px solid #aaa',backgroundColor:'#fff',cursor:'wait'},overlayCSS:{backgroundColor:'#000',opacity:'0.6'},growlCSS:{width:'350px',top:'10px',left:'',right:'10px',border:'none',padding:'5px',opacity:'0.6',cursor:null,color:'#fff',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px'},iframeSrc:'javascript:false',forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var ie6=$.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);var pageBlock=null;var pageBlockEls=[];function install(el,opts){var full=(el==window);var msg=opts&&opts.message!==undefined?opts.message:undefined;opts=$.extend({},$.blockUI.defaults,opts||{});opts.overlayCSS=$.extend({},$.blockUI.defaults.overlayCSS,opts.overlayCSS||{});var css=$.extend({},$.blockUI.defaults.css,opts.css||{});msg=msg===undefined?opts.message:msg;if(full&&pageBlock)
remove(window,{fadeOut:0});if(msg&&typeof msg!='string'&&(msg.parentNode||msg.jquery)){var node=msg.jquery?msg[0]:msg;var data={};$(el).data('blockUI.history',data);data.el=node;data.parent=node.parentNode;data.display=node.style.display;data.position=node.style.position;if(data.parent)
data.parent.removeChild(node);}
var z=opts.baseZ;var lyr1=($.browser.msie)?$('<iframe class="blockUI" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'):$('<div class="blockUI" style="display:none"></div>');var lyr2=$('<div class="blockUI blockOverlay" style="z-index:'+(z++)+';display:none;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var lyr3=full?$('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>'):$('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');if(msg)
lyr3.css(css);if(!opts.applyPlatformOpacityRules||!($.browser.mozilla&&/Linux/.test(navigator.platform)))
lyr2.css(opts.overlayCSS);lyr2.css('position',full?'fixed':'absolute');if($.browser.msie)
lyr1.css('opacity','0.0');$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full?'body':el);var expr=$.browser.msie&&($.browser.version<8||!$.boxModel)&&(!$.boxModel||$('object,embed',full?null:el).length>0);if(ie6||(expr&&lyr3[0].style.setExpression)){if(full&&opts.allowBodyStretch&&$.boxModel)
$('html,body').css('height','100%');if((ie6||!$.boxModel)&&!full){var t=sz(el,'borderTopWidth'),l=sz(el,'borderLeftWidth');var fixT=t?'(0 - '+t+')':0;var fixL=l?'(0 - '+l+')':0;}
$.each([lyr1,lyr2,lyr3],function(i,o){var s=o[0].style;s.position='absolute';if(i<2){full?s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'):s.setExpression('height','this.parentNode.offsetHeight + "px"');full?s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):s.setExpression('width','this.parentNode.offsetWidth + "px"');if(fixL)s.setExpression('left',fixL);if(fixT)s.setExpression('top',fixT);}
else if(opts.centerY){if(full)s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');s.marginTop=0;}
else if(!opts.centerY&&full){var top=(opts.css&&opts.css.top)?parseInt(opts.css.top):0;var expression='((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';s.setExpression('top',expression);}});}
if(msg){lyr3.append(msg);if(msg.jquery||msg.nodeType)
$(msg).show();}
if($.browser.msie&&opts.showOverlay)
lyr1.show();if(opts.fadeIn){if(opts.showOverlay)
lyr2._fadeIn(opts.fadeIn);if(msg)
lyr3.fadeIn(opts.fadeIn);}
else{if(opts.showOverlay)
lyr2.show();if(msg)
lyr3.show();}
bind(1,el,opts);if(full){pageBlock=lyr3[0];pageBlockEls=$(':input:enabled:visible',pageBlock);if(opts.focusInput)
setTimeout(focus,20);}
else
center(lyr3[0],opts.centerX,opts.centerY);if(opts.timeout){var to=setTimeout(function(){full?$.unblockUI(opts):$(el).unblock(opts);},opts.timeout);$(el).data('blockUI.timeout',to);}};function remove(el,opts){var full=el==window;var $el=$(el);var data=$el.data('blockUI.history');var to=$el.data('blockUI.timeout');if(to){clearTimeout(to);$el.removeData('blockUI.timeout');}
opts=$.extend({},$.blockUI.defaults,opts||{});bind(0,el,opts);var els=full?$('body').children().filter('.blockUI'):$('.blockUI',el);if(full)
pageBlock=pageBlockEls=null;if(opts.fadeOut){els.fadeOut(opts.fadeOut);setTimeout(function(){reset(els,data,opts,el);},opts.fadeOut);}
else
reset(els,data,opts,el);};function reset(els,data,opts,el){els.each(function(i,o){if(this.parentNode)
this.parentNode.removeChild(this);});if(data&&data.el){data.el.style.display=data.display;data.el.style.position=data.position;if(data.parent)
data.parent.appendChild(data.el);$(data.el).removeData('blockUI.history');}
if(typeof opts.onUnblock=='function')
opts.onUnblock(el,opts);};function bind(b,el,opts){var full=el==window,$el=$(el);if(!b&&(full&&!pageBlock||!full&&!$el.data('blockUI.isBlocked')))
return;if(!full)
$el.data('blockUI.isBlocked',b);if(b&&!opts.showOverlay)
return;var events='mousedown mouseup keydown keypress';b?$(document).bind(events,opts,handler):$(document).unbind(events,handler);};function handler(e){if(e.keyCode&&e.keyCode==9){if(pageBlock&&e.data.constrainTabKey){var els=pageBlockEls;var fwd=!e.shiftKey&&e.target==els[els.length-1];var back=e.shiftKey&&e.target==els[0];if(fwd||back){setTimeout(function(){focus(back)},10);return false;}}}
if($(e.target).parents('div.blockMsg').length>0)
return true;return $(e.target).parents().children().filter('div.blockUI').length==0;};function focus(back){if(!pageBlockEls)
return;var e=pageBlockEls[back===true?pageBlockEls.length-1:0];if(e)
e.focus();};function center(el,x,y){var p=el.parentNode,s=el.style;var l=((p.offsetWidth-el.offsetWidth)/2)-sz(p,'borderLeftWidth');var t=((p.offsetHeight-el.offsetHeight)/2)-sz(p,'borderTopWidth');if(x)s.left=l>0?(l+'px'):'0';if(y)s.top=t>0?(t+'px'):'0';};function sz(el,p){return parseInt($.css(el,p))||0;};})(jQuery);
(function($){$.widget("ui.dropdown",{_init:function(){this.dropDownVisible=false;var _this=this;this.dropDownObserver=function(event){var isChildOf=$(event.target)[0]==$(_this.element)[0];if(!isChildOf){$(event.target).parents().each(function(){isChildOf=isChildOf||$(this)[0]==$(_this.element)[0];});}
if(!isChildOf){_this.hideDropDown();}};$(this.options.opener).click(function(){if(!_this.visible()){_this.showDropDown();}else{_this.hideDropDown();}
return false;});},showDropDown:function(){this.dropDownVisible=true;$(document).bind("click.dropdown_"+this.options.id,null,this.dropDownObserver);this.options.onShow&&this.options.onShow.call($(this.element),$(this.options.opener));this.options.showFn.call($(this.element),this.options.toggleSpeed);},hideDropDown:function(){this.dropDownVisible=false;$(document).unbind("click.dropdown_"+this.options.id,null,this.dropDownObserver);this.options.hideFn.call($(this.element),this.options.toggleSpeed);this.options.afterHide&&this.options.afterHide.call($(this.element),$(this.options.opener));},visible:function(){return this.dropDownVisible;}});$.extend($.ui.dropdown,{getter:"visible",defaults:{id:"",opener:undefined,toggleSpeed:undefined,onShow:undefined,afterHide:undefined,showFn:$().show,hideFn:$().hide}});})(jQuery);(function($){$.widget("ui.dropdownWizard",{_init:function(){this._currentlyOpen=-1;this._stepElements=this._prepareStepElements(this.options.stepElements);var _this=this;this.hideWizardObserver=function(event){if(!event.isPropagationStopped()&&_this.visible()){var currentElement=$(_this._stepElements[_this._currentlyOpen].element)[0];var isChildOf=$(event.target)[0]==currentElement;if(!isChildOf){$(event.target).parents().each(function(){isChildOf=isChildOf||$(this)[0]==currentElement;});}
if(!isChildOf){_this.hideWizard();}}};$(this.options.opener).click(function(){if(!_this.visible()){_this.showWizard();}else{_this.hideWizard();}
return false;});if(this.options.fwdSwitcher){$(this.options.fwdSwitcher).live('click',function(event){event.stopPropagation();_this.stepForward();return false;});}
if(this.options.backSwitcher){$(this.options.backSwitcher).live('click',function(event){event.stopPropagation();_this.stepBack();return false;});}},_prepareStepElements:function(optionsElements){if(optionsElements.length>1&&this.options.content){throw new Error("'content' may be specified if there is only one element.");}
var resultElements=new Array();for(var i=0;i<optionsElements.length;i++){var optionsElement=optionsElements[i];if(optionsElement.element){resultElements[i]=optionsElement;}else{resultElements[i]={element:optionsElement};}
if(this.options.content){resultElements[i].content=this.options.content;}}
return resultElements;},showWizard:function(){var firstStep=this._stepElements[0];if(firstStep){this._currentlyOpen=0;$(document).bind("click.dropdownWizard_"+this.options.id,null,this.hideWizardObserver);this._loadStep(firstStep);}},_loadStep:function(stepInfo){var $stepElement=$(stepInfo.element);var callback=this._createStepShowCallback(this.options,stepInfo);if(stepInfo.content&&!$stepElement.children().length){$stepElement.load(stepInfo.content.url,this._createStepInitCallback(stepInfo,callback));}else{callback();}},_createStepShowCallback:function(options,stepInfo){return function(){var $stepElement=$(stepInfo.element);options.onShow&&options.onShow.call($stepElement);options.showFn.call($stepElement,options.toggleSpeed,stepInfo.afterShow);};},_createStepInitCallback:function(stepInfo,callback){if(!stepInfo.content.init){return callback;}else{return function(){stepInfo.content.init();callback();};}},hideWizard:function(){var wasOpen=this._currentlyOpen;this._currentlyOpen=-1;var wasOpenStep=this._stepElements[wasOpen];if(wasOpenStep){$(document).unbind("click.dropdownWizard_"+this.options.id,null,this.hideWizardObserver);this._hideStep(this.options,wasOpenStep);}},_hideStep:function(options,stepInfo){var $stepElement=$(stepInfo.element);options.hideFn.call($stepElement,options.toggleSpeed,stepInfo.afterHide);options.afterHide&&options.afterHide.call($stepElement);},stepForward:function(){this.switchToStep(this._currentlyOpen+1);},stepBack:function(){this.switchToStep(this._currentlyOpen-1);},switchToStep:function(stepNum){if(this.visible()){var previous=this._currentlyOpen;var previousStep=this._stepElements[previous];var futureStep=this._stepElements[stepNum];if(futureStep){this._currentlyOpen=stepNum;this._hideStep(this.options,previousStep);this._loadStep(futureStep);}}},visible:function(){return this._currentlyOpen>-1&&this._stepElements[this._currentlyOpen];}});$.extend($.ui.dropdownWizard,{defaults:{id:"",opener:undefined,fwdSwitcher:undefined,backSwitcher:undefined,stepElements:[],toggleSpeed:undefined,onShow:undefined,afterHide:undefined,content:null,showFn:$().show,hideFn:$().hide}});})(jQuery);
DDI.Dialog={openDialog:function(url,postParams,callback){$j("#modalDialog").load(url,postParams,function(data,textStatus){if(!$j(this).modalDialog("opened")){$j(this).modalDialog("open");}
if(callback!==undefined){callback(data,textStatus);}});},closeDialog:function(){$j("#modalDialog").modalDialog("close");},isDialogClosed:function(){return $j("#modalDialog").modalDialog("closed");}};(function($){DDI.GeoChoice={mapContainerSelector:null,countyIdMapping:null,initGeoChoice:function(opts){if(opts==null||opts.mapContainerSelector==null||opts.countyIdMapping==null){throw new Error("Illegal argument exception! Required arguments are not specified!");}
this.mapContainerSelector=opts.mapContainerSelector;this.countyIdMapping=opts.countyIdMapping;},detachAutocompleter:function(){$('#munNameAutocomplete').ddiAutocompleteDetach();},createAutocompleter:function(){$('#munNameAutocomplete').ddiAutocomplete({width:250});}};})(jQuery);(function($){$.extend(DDI.GeoChoice,{initMap:function(){var that=this;$("area",this.mapContainerSelector).each(function(){var countyId=that.countyIdMapping[this.id];var thisAreaElement=this;$(this).click(function(){that._loadMunicipalities(countyId);return false;});$("#countyLink"+countyId).click(function(){$(thisAreaElement).click();return false;});$("#countyLink"+countyId).mouseover(function(){$(thisAreaElement).mouseover();});$("#countyLink"+countyId).mouseout(function(){$(thisAreaElement).mouseout();});});},_loadMunicipalities:function(countyId){if(this.currentRequest){this.currentRequest.abort();}
var loader='<img src="'+DDI.contextPath+'/img/ajax-loader.gif" style="top: 50px; left: 45%; position: relative;">';$("#mapCounties").hide();$("#mapRes").empty().append(loader);this.currentRequest=$.ajax({type:"GET",url:DDI.contextPath+"/geochoice/county/",data:{id:countyId},success:function(response){$("#mapRes").html(response);DDI.GeoChoice.initMunicipalityLinks();}});},initChooseForm:function(){var that=this;$('#municipalityForm').submit(function(){var municipalityName=$("#municipalityForm input[name='name']").val();if($.trim(municipalityName).length==0){that._showEmptyMunicipalityError();return false;}
var isMunicipalityNameValid=that._validateMunicipalityName(municipalityName);if(isMunicipalityNameValid||false){$(".geoSelectorWrapper").dropdownWizard("hideWizard");return true;}else{that._showWrongMunicipalityNameError(municipalityName);return false;}});},_validateMunicipalityName:function(municipalityName){var result;$.ajax({type:"GET",url:DDI.contextPath+"/geochoice/validate/",data:{name:municipalityName},dataType:'json',async:false,success:function(response){result=response.valid;}});return result;},_showEmptyMunicipalityError:function(){var formErrors=$("#municipalityForm .msg");$("#municipalityErrorCause",formErrors).html(i18n.validation.errors.blank_query()).show();$("#municipalityErrorHint",formErrors).html(i18n.geochoice.error.suggestion()).show();formErrors.show();},_showWrongMunicipalityNameError:function(municipalityName){var formErrors=$("#municipalityForm .msg");$("#municipalityErrorCause",formErrors).html(i18n.geochoice.error.didnt_match(this._getShortName(municipalityName))).show();$("#municipalityErrorHint",formErrors).html(i18n.geochoice.error.suggestion()).show();formErrors.show();},_getShortName:function(municipalityName){var shortMunicipalityName;if(municipalityName&&municipalityName.length>20){shortMunicipalityName=municipalityName.substring(0,20)+"...";}else{shortMunicipalityName=municipalityName;}
return shortMunicipalityName;},initMunicipalityLinks:function(){$(".municipalityLink").click(function(){$(".geoSelectorWrapper").dropdownWizard("hideWizard");return true;});}});})(jQuery);<!--
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
(function($){DDI.Favorites={loader:'<img class="loader" src="'+DDI.contextPath+'/img/ajax-loader.gif">',init:function(){var _this=this;var showLoader=function(){if($("#favorite-panel").is(":visible")){$("#favorite-panel .list").append(_this.loader);}else{$(".favorite").append(_this.loader);}};var hideLoader=function(){$(".favoritesWrapper .loader").remove();};var updateFavoritesList=function(htmlResponse){$("#favorite-panel .list").empty().html(htmlResponse);};var performFavoritesChange=function(id,action,callback){unBindAll();showLoader();$.ajax({type:"GET",url:DDI.contextPath+"/favorite",data:{id:id,action:action},success:function(response){updateFavoritesList(response);if(callback){callback.call(this);}},complete:function(){hideLoader();bindAll();}});};var addCurrentToFavorites=function(){performFavoritesChange(DDI.municipalityId,"add",function(){$("#saved-msg").slideToggle("slow");window.setTimeout(function(){$("#saved-msg").fadeOut(1000);},5000);$(".addToFavoritesBtn").addClass("added");});return false;};var removeFromFavorites=function(){var id=this.id.replace("delete_","");performFavoritesChange(id,"remove",function(){if(id==DDI.municipalityId){$(".addToFavoritesBtn").removeClass("added");$("#saved-msg").hide();}});return false;};var removeCurrentFromFavorites=function(){$("#saved-msg").hide();performFavoritesChange(DDI.municipalityId,"remove",function(){$(".addToFavoritesBtn").removeClass("added");});return false;};var bindAll=function(){$(".addToFavoritesBtn").live("click",function(){var $this=$(this);if($this.not('.added')){addCurrentToFavorites();}
return false;});$("#undoAddFavorite").live('click',removeCurrentFromFavorites);$("#favorite-panel .delete").click(removeFromFavorites);};var unBindAll=function(){$(".addToFavoritesBtn").unbind("click",addCurrentToFavorites);$("#undoAddFavorite").unbind("click",removeCurrentFromFavorites);$("#favorite-panel .delete").unbind("click",removeFromFavorites);};bindAll();}};})(jQuery);DDI.FBLoginButton={init:function(){var handle_facebook_login=function(){window.location.href=DDI.contextPath+'/auth/facebook';};$j("#fbLogin").click(function(){handle_facebook_login();return false;});}};(function($){$(function(){$.ajaxSetup({cache:false});});})(jQuery);(function($){$(function(){$.blockUI.defaults.message='<img src="'+DDI.contextPath+'/img/loading.gif"/>';$.blockUI.defaults.css.border='none';$.blockUI.defaults.css.backgroundColor='';$.blockUI.defaults.overlayCSS.opacity='0.1';});})(jQuery);(function($){$(function(){$("#favorites-message-container").load(DDI.contextPath+'/fragment/favotire-message.html');$(".save-area").dropdownWizard({id:"favorite",opener:".save-area.favorite-btn",stepElements:["#favorite-panel"],toggleSpeed:"slow",showFn:$().slideDown,hideFn:$().slideUp,content:{url:DDI.contextPath+'/fragment/favorites.html'},onShow:function(){$(".save-area.favorite-btn").addClass("active");$(".geoSelectorWrapper").dropdownWizard("hideWizard");},afterHide:function(){$(".save-area.favorite-btn").removeClass("active");}});DDI.Favorites.init();});})(jQuery);(function($){$(function(){$(".geoSelectorWrapper").dropdownWizard({id:"geoSelect",opener:"#geoSelect, .change-area.area-btn",fwdSwitcher:"#openGeochoice",backSwitcher:"#backToGeoSelect",stepElements:[{element:"#area-panel",content:{url:DDI.contextPath+'/fragment/select-area.html',init:function(){DDI.GeoChoice.createAutocompleter();$("#municipalityForm input[name='name']").ezpz_hint({hintClass:'qHint'});}}},{element:"#map-panel",content:{url:DDI.contextPath+'/fragment/map.html',init:function(){DDI.GeoChoice.initMap();DDI.GeoChoice.initChooseForm();}}}],toggleSpeed:"slow",showFn:$().slideDown,hideFn:$().slideUp,onShow:function(){$(".change-area.area-btn").addClass("active");$("#municipalityForm .msg").hide();var input=$("#municipalityForm input[name='name']");input.val("");input[0].tryShowHint();$("#mapRes").empty();$("#mapCounties").show();$(".save-area").dropdownWizard("hideWizard");},afterHide:function(){$(".change-area.area-btn").removeClass("active");}});});})(jQuery);(function($){$(function(){$("#openLogin").dialogAjaxify({onSuccess:DDI.FBLoginButton.init});$("#openFBLogin").dialogAjaxify({onSuccess:DDI.FBLoginButton.init});$("#createLogin").dialogAjaxify({onSuccess:DDI.FBLoginButton.init});});})(jQuery);(function($){$(function(){$("#mainSearchForm").submit(function(){var q=$j("#mainSearchForm input[name=q]").val();if($.trim(q).length==0){return false;}});$("#mainSearchForm .searchBtn").click(function(){var link=$(this).attr("href")||$(this).parents('form').attr('action');$('#mainSearchForm').attr("action",link).submit();return false;});});})(jQuery);DDI.SignIn={ajaxifyLinks:function(){$j("#forgotPwdLink").dialogAjaxify();$j("#signinSignupLink").dialogAjaxify();}};DDI.ForgotPwd={initDialog:function(){$j("#forgotPwdCancel").click(function(){DDI.Dialog.closeDialog();return false;});}};(function($){$.fn.ezpz_hint=function(options){var defaults={hintClass:'ezpz-hint',hintName:'ezpz_hint_dummy_input'};var settings=$.extend(defaults,options);return this.each(function(i){var hint=new EzpzHint($(this),i,settings);$.extend(this,{tryShowHint:function(){hint.tryShowHint();},hideHint:function(){hint.hideHint();}});});};var EzpzHint=function(input,i,settings){this._init(input,i,settings);};EzpzHint.prototype={_init:function(input,i,settings){var _this=this;_this.inputField=input;_this.hintField=_this._createHintField(i,settings);_this.inputField.attr('autocomplete','off');_this.hintField.focus(function(){_this.hideHint();});_this.inputField.blur(function(){_this.tryShowHint();});_this.hideHint();_this.tryShowHint();},_createHintField:function(i,settings){var input=this.inputField;var id=settings.hintName+'_'+i;var text=input.attr('title');var hint=$('<input type="text" id="'+id+'" value="" />').insertBefore(input);hint.attr('class',input.attr('class'));hint.attr('size',input.attr('size'));hint.attr('autocomplete','off');hint.attr('tabIndex',input.attr('tabIndex'));hint.addClass(settings.hintClass);hint.val(text);return hint;},tryShowHint:function(){if($.trim(this.inputField.val()).length==0){this.inputField.hide();this.hintField.show();}},hideHint:function(){this.inputField.show().focus();this.hintField.hide();}};})(jQuery);(function($){$(function(){$(".searchField").ezpz_hint({hintClass:'qHint'});setTimeout(function(){$(".searchField:first").focus();},1);});})(jQuery);(function($){$.fn.catchEnterAndSendTo=function(target,passEvent){this.bind('keypress.catchEnter',null,function(event){if(event.keyCode==13){target.trigger('click',event.data);return passEvent||false;}});return this;}})(jQuery);(function($){var initSubmitLinks=function(){$(".formSubmitter").live("click",function(){$(this).parents("form:first").submit();return false;});};initSubmitLinks();})(jQuery);(function($){var isFormChanged=false;var listenFormChanges=function(){$('form.prevent-leaving input[type!="submit"][type!="button"], form.prevent-leaving textarea').live('change',processFormDataChanged).bind('change',processFormDataChanged);$('form.prevent-leaving').live('submit',function(){isFormChanged=false;});};var processFormDataChanged=function(){isFormChanged=true;};var displayPopup=function(){if(isFormChanged){return i18n.common.forms.leaving_confirmation();}};if(!window.onbeforeunload){$(listenFormChanges);window.onbeforeunload=displayPopup;}})(jQuery);
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return"";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
