(function($){$.COM=(function(){var events_map={};var props="altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),props_key="char charCode key keyCode".split(" "),props_mouse="button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|contextmenu)|click/;function key_filter(event,e){if(event.which==null){event.which=e.charCode!=null?e.charCode:e.keyCode}}function mouse_filter(event,e){var eventDoc,doc,body,button=e.button,fromElement=e.fromElement;if(event.pageX==null&&e.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=e.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=e.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}if(!event.relatedTarget&&fromElement){event.relatedTarget=fromElement===event.target?e.toElement:fromElement}if(!event.which&&button!==undefined){event.which=(button&1?1:(button&2?3:(button&4?2:0)))}}function Event(e){if(!(this instanceof $.COM.Event)){return new Event(e)}e=e||window.event;this.original=e;this.type=e.type;var isKey=false,isMouse=false,maps=null,filter=null;if(rkeyEvent.test(e.type)){maps=props.concat(props_key);filter=key_filter}if(rmouseEvent.test(e.type)){maps=props.concat(props_mouse);filter=mouse_filter}var i=maps.length,prop;while(i--){prop=maps[i];this[prop]=e[prop]}if(!this.target){this.target=e.srcElement||document}if(this.target.nodeType===3){this.target=this.target.parentNode}this.metaKey=!!this.metaKey;if(filter){filter(this,e)}}Event.prototype.stopPropagation=function(){cancel_bubble(this.original)};Event.prototype.preventDefault=function(){prevent_default(this.original)};function extend(a){if(arguments.length<2){return null}var arg=null;for(var i=1;i0){off_one(ele,ev,maps.pop(),cap)}events_map[id][ev]=null;return}else{var _index=-1;for(var i=0;i';document.body.appendChild(uploader);var frm=document.getElementById(ID+"_form");frm.appendChild(file);if(options.fields){for(var name in options.fields){if(!options.fields.hasOwnProperty(name)){continue}var input=document.createElement("input");input.type="hidden";input.name=name;input.value=options.fields[name];frm.appendChild(input)}}var ifm=document.getElementById(ID),onload=function(){complete.call(options.context||file);var ifrm=document.getElementById(ID);var body=(ifrm.contentWindow?ifrm.contentWindow:ifrm.contentDocument).document.body;var json=(body.innerText)?body.innerText:((body.textContent)?body.textContent:null);document.body.removeChild(document.getElementById(ID+"_container"));try{success.call(options.context||file,(typeof JSON.parse!=="undefined")?JSON.parse(json):eval("("+json+")"))}catch(ex){error.call(options.context||file,ex.message)}return false};if(ifm.attachEvent){ifm.attachEvent("onload",onload)}else{ifm.onload=onload}beforupload.call(options.context||file,file,options);frm.submit();return new_file}var locat=window.location,protocol=locat.protocol,port=locat.port||(protocol.indexOf("https")>=0?"443":"80"),host=locat.host,origin=locat.origin||parse_url(window.location.href).origin;function parse_url(url){var rmatch=/^((?:.+?)\:)\/\/([\s\S]+?)(?:\:(\d+))?(\/(?:[\s\S]*?))?(\?(?:[\s\S]*?))?(\#(?:[\s\S]*?))?$/.exec(url);if(rmatch){return{hash:rmatch[6],host:rmatch[2],hostname:rmatch[2],href:rmatch[0],origin:rmatch[1]+"//"+rmatch[2]+(rmatch[3]?":"+rmatch[3]:""),pathname:rmatch[4]||"/",port:rmatch[3]||(rmatch[1].indexOf("https")>=0?"443":"80"),protocol:rmatch[1],search:rmatch[5]}}rmatch=/^([\s\S]+?)(\?(?:[\s\S]*?))?(\#(?:[\s\S]*?))?$/.exec(url);if(rmatch){var pathname=rmatch[1];if(!pathname){pathname=locat.pathname}else{if(pathname.substr(0,1)!="/"){var lpath=locat.pathname,rreg=/\/([^\/]+?)\/\.\./;lpath=lpath.substr(0,lpath.lastIndexOf("/")+1);pathname=lpath+pathname;while(rreg.test(pathname)){pathname=pathname.replace(rreg,"")}pathname=pathname.replace(/\.\.\//g,"");pathname=pathname.replace(/\.\//g,"")}}return{hash:rmatch[3],host:host,hostname:host,href:protocol+"//"+host+((port!="80"&&port!="443")?":"+port:"")+pathname+rmatch[2]+rmatch[3],origin:protocol+"//"+host+((port!="80"&&port!="443")?":"+port:""),pathname:pathname,port:port,protocol:protocol,search:rmatch[2]}}return null}function load_script(url,callback,charset){var script=document.createElement("script"),head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;function dispose(){script.onload=script.onreadystatechange=null;if(script.parentNode){script.parentNode.removeChild(script)}script=null}script.async=true;if(charset){script.charset=charset}script.src=url;script.onload=script.onreadystatechange=function(){if(!script.readyState||/loaded|complete/.test(script.readyState)){dispose();if(callback){callback(200)}}};head.insertBefore(script,head.firstChild)}function _right2(src){return("0"+src).slice(-2)}function FormatDate(dt,fs){if(typeof dt=="number"){dt=new Date(dt)}else{if(typeof dt=="string"&&/^\/Date\((\d+)\)\/$/.test(dt)){dt=new Date(parseInt(dt.replace(/^\/Date\((\d+)\)\/$/,"$1")))}else{dt=dt||(new Date())}}fs=fs.replace(/(yyyy|mmmm|mmm|mm|dd|hh|ss|tttt|m|d|h|s)/ig,function(diff){switch(diff){case"yyyy":return dt.getFullYear();case"M":return dt.getMonth()+1;case"MM":return _right2(dt.getMonth()+1);case"d":return dt.getDate();case"dd":return _right2(dt.getDate());case"H":return dt.getHours()%12;case"HH":return _right2(dt.getHours());case"h":return dt.getHours();case"hh":return _right2(dt.getHours()%12);case"m":return dt.getMinutes();case"mm":return _right2(dt.getMinutes());case"s":return dt.getSeconds();case"ss":return _right2(dt.getSeconds());case"tttt":return dt.getMilliseconds();default:return diff}});return fs}return{extend:extend,fix_event:fix_event,on:on,off:off,add_class:add_class,remove_class:remove_class,has_class:has_class,toggle_class:toggle_class,is_function:is_function,encode:encode,decode:decode,location:_location,bind:bind,get_center:get_center,show:show,hide:hide,visiable:visiable,next:next,prev:prev,find_height:find_height,find_top:find_top,cancel_bubble:cancel_bubble,child_of:child_of,format:format,first:first,last:last,Event:Event,childs:childs,upload:UploadFile,parse_url:parse_url,load_script:load_script,format_date:FormatDate,offset:_offset}}())}(window));; (function(a){var c={},d={buttons:null,title:null,titleAlign:"center",buttonAlign:"center",bodyAlign:"center",buttonNoBorder:true,buttonBorderRadius:true,autoClose:0,onOpen:null,onClose:null,replaceAlert:false,bgWhite:false},b=0;a.MWIN=(function(){var m={};function n(K,M){if(arguments.length<2){return null}var L=null;for(var O=1;O0){A(M,N,R.pop(),L)}m[Q][N]=null;return}else{var K=-1;for(var P=0;P

';f(Q,"blocker"+(U.bgWhite===true?" white":""));K=q(Q);V=q(K);N=y(V);O=x(K);N.innerHTML=J((U.icon?'':"")+(P||U.content||""));K.style.alpha="0";K.style.opacity="0";K.style.filter="alpha(opacity=0)";Q.style.display="block";var L=new l(T,Q,V,N,O,U);L.args=arguments;c[T]=L;r(O,L);if(U.title===null){V.style.display="none";f(N,"dlg-body-notitle")}else{V.style.display="block";V.innerHTML=J(U.title)}if(U.width){if(typeof U.width=="number"){U.width=U.width+"px"}K.style.width=U.width}if(U.height){if(typeof U.height=="number"){U.height=(U.height-V.offsetHeight-O.offsetHeight)+"px"}N.style.height=U.height}if(U.autoClose&&typeof U.autoClose=="number"){window.setTimeout(function(){h(T,null)},U.autoClose)}F(V,U.titleAlign);F(N,U.bodyAlign);F(O,U.buttonAlign);if(w(U.onOpen)){U.onOpen.call(L)}if(typeof U.autoFix=="number"){L.fix(U.autoFix)}K.style.alpha="100%";K.style.opacity="1";K.style.filter="alpha(opacity=100%)";return L}function J(K){return'
'+K+"
"}function F(L,K){E(L,"align-left align-center align-right");f(L,"align-"+K)}function h(M,O){var N=o(M);if(!N){return}var K=c[M];if(K){if(O){if(w(O.callback)){if(O.callback.call(M,O.data)===false){return}}}if(w(K.options.onClose)){if(K.options.onClose.call(K,O)===false){return}}var L=K.buttonset;if(L){z(L,"click")}}N.parentNode.removeChild(N);c[M]=null}function s(L,K,M){B(document,L,function(O){O=O||event;if(!O){return}var Q=O.keyCode||O.witch;if(!Q){return}if(Q!=K){return}var R=x(document.body);if(!u(R,"blocker")){return}var N=c[R.id];if(!N){return}var S=N.callbacks;if(!S){return}for(var P=0;P0&&M.substr(U-1,1)!="\\"){P=M.substr(U+1);M=M.substr(0,U)}M=M.replace(/\\\./g,".");V.push({title:M,callback:typeof R=="string"?null:R,className:P,data:null,isDefault:false,isCancel:false,index:V.length})}}if(V.length==0){N.style.display="none"}else{N.style.display="block";var S="",M,Q=-1,O=[];for(var T=0;T'+M.title+""}N.innerHTML=J(S);if(Q>=0){N.getElementsByTagName("button")[Q].focus()}B(N,"click",function(X){var Y=p(X,W);if(!Y){return}h(W,Y)});L.callbacks=V}}}}function p(K,M){K=t(K||event);if(K&&K.nodeName&&K.nodeName.toLowerCase()!="button"){return null}var N=K.getAttribute("data-value");if(N===undefined){return null}var L;if(!c[M]||!(L=c[M]["callbacks"])){return null}N=parseInt(N);if(!L[N]){return null}return L[N]}function o(K){var L=document.getElementById(K);if(!L){if(c[K]){c[K]=null}return null}return L}function G(){var Q=null,M="",O=arguments.length,K,P={},L=0;if(O==0){return}for(var N=0;N',n(P,{title:Q||P.title,buttons:[{title:P.buttonText||"确定",callback:function(){if(w(M)){return M.call(this,document.getElementById(K).value)}}},{isCancel:true,title:P.buttonTextCancel||"取消",callback:P.onCancel,className:"btn-grey"}]}))}D.title=function(K){H("prompt",K)};function v(L,M){var K=c[L];if(!K){return}K.body.innerHTML=J(M)}function H(L,M){var K=c[L];if(!K){return}K.title.innerHTML=J(M)}s("keydown",13,"isDefault");s("keyup",27,"isCancel");return{any:k,open:k,close:h,tips:G,alert:g,confirm:i,html:v,prompt:D,title:H,options:function(K,L){if(L===undefined){return d[K]}d[K]=L;if(K=="replaceAlert"){if(L===true){window.alert=g}else{window.alert=e}}return this}}}());if(typeof jQuery!="undefined"){jQuery.dialog=a.MWIN}if(typeof Ajax!="undefined"){Ajax.postJson=function(h,f,e,g){g=g||{};if(g.tips){MWIN.tips(g.tips)}Ajax({url:h,data:f,method:"POST",dataType:"json",opts:g,complete:g.complete||function(){if(g.tips){MWIN.close("tips")}},error:g.error||function(){if(this.opts.errorAutoClose){MWIN.tips(this.opts.errorMessage||"请求失败,系统异常。",this.opts.errorAutoClose)}else{MWIN.alert(this.opts.errorMessage||"请求失败,系统异常。")}},succeed:function(i){if(!i.error){if(typeof e=="function"){e(i.data)}}else{if(this.opts.errorAutoClose){MWIN.tips(i.message,this.opts.errorAutoClose)}else{MWIN.alert(i.message)}}}})}}}(window));; (function(){var Ajax=window.Ajax=function(opt){for(var key in opt){if(!opt.hasOwnProperty(key)){continue}if(cnames[key]){opt[cnames[key]]=opt[key]}}opt=extend(copy(Ajax.Setting),opt?opt:{});if(opt.form&&(opt.form.nodeName.toLowerCase()=="form")){opt=extend(opt,parse_form(opt.form,opt.charset))}send(opt)};function empty_fn(){}var cnames={beforeSend:"beforesend",success:"succeed",type:"method"};Ajax.Setting={async:true,url:"",dataType:"text",contentType:"",method:"GET",data:"",form:null,timeout:0,charset:"utf-8",username:"",userpwd:"",headers:{},cache:false,succeed:empty_fn,error:empty_fn,beforesend:empty_fn,complete:empty_fn,context:null,jsonp:"callback",statusCode:{},scriptCharset:""};var CONTENTTYPES={text:"text/plain",xml:"text/xml",json:"application/json"};function parse_form(frm,charset){var data=Ajax.Serialize(frm,charset);var opt={method:(frm.method||"GET").toUpperCase(),url:frm.action,data:data};if(opt.method=="GET"&&data){var index=opt.url.indexOf("?");if(index>=0){opt.url=opt.url.substr(0,index)}opt.url+="?"+data;opt.data=null}return opt}var encode={gb:function(str){return escape(str||"").replace(/\+/igm,"%2B")},utf8:function(str){return encodeURIComponent(str||"").replace(/\+/igm,"%2B")}};function is_function(a){if(!a){return false}return typeof a=="function"}function get_obj(){var b=null;if(window.XMLHttpRequest){b=new XMLHttpRequest();get_obj=function(){return new XMLHttpRequest()}}else{if(window.ActiveXObject){var httplist=["MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp","MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0"];for(var i=httplist.length-1;i>=0;i--){try{get_obj=(function(obj){return function(){return new ActiveXObject(obj)}})(httplist[i]);b=get_obj()}catch(ex){}}}}return b}function response(a,s){var context=s.context||s;s.complete.call(context,this);if(a.status!=200){if(s.statusCode[a.status]){s.statusCode[a.status].call(context,a.status,a)}else{s.error.call(context,a.status,a)}return}var t=s.dataType,args=a.responseText,contentType=(a.getResponseHeader("Content-Type")||"").toLowerCase();if(t=="script"||contentType.indexOf("text/javascript")>=0){try{eval(args)}catch(ex){s.error.call(context,-4,a)}if(s.id&&window[s.id]){window[s.id]=null}return}else{if(t=="xml"||contentType.indexOf("text/xml")>=0){try{var Dom;try{Dom=new ActiveXObject("MSXML2.DomDocument")}catch(ex){Dom=document.implementation.createDocument("","",null)}Dom.loadXML(args);args=Dom}catch(ex){s.error.call(context,-3,a);return}}else{if(t=="json"||contentType.indexOf("application/json")>=0||contentType.indexOf("text/json")>=0){try{if(typeof JSON!="undefined"&&JSON.parse){args=JSON.parse(args)}else{args=(new Function("return "+args+";"))()}}catch(ex){s.error.call(context,-2,a,ex);return}}}}s.succeed.call(context,args,a)}var locat=window.location,protocol=locat.protocol,port=locat.port||(protocol.indexOf("https")>=0?"443":"80"),host=locat.host,origin=locat.origin||parse_url(window.location.href).origin;function parse_url(url){var rmatch=/^((?:.+?)\:)\/\/([\s\S]+?)(?:\:(\d+))?(\/(?:[\s\S]*?))?(\?(?:[\s\S]*?))?(\#(?:[\s\S]*?))?$/.exec(url);if(rmatch){return{hash:rmatch[6],host:rmatch[2],hostname:rmatch[2],href:rmatch[0],origin:rmatch[1]+"//"+rmatch[2]+(rmatch[3]?":"+rmatch[3]:""),pathname:rmatch[4]||"/",port:rmatch[3]||(rmatch[1].indexOf("https")>=0?"443":"80"),protocol:rmatch[1],search:rmatch[5]}}rmatch=/^([\s\S]+?)(\?(?:[\s\S]*?))?(\#(?:[\s\S]*?))?$/.exec(url);if(rmatch){var pathname=rmatch[1];if(!pathname){pathname=locat.pathname}else{if(pathname.substr(0,1)!="/"){var lpath=locat.pathname,rreg=/\/([^\/]+?)\/\.\./;lpath=lpath.substr(0,lpath.lastIndexOf("/")+1);pathname=lpath+pathname;while(rreg.test(pathname)){pathname=pathname.replace(rreg,"")}pathname=pathname.replace(/\.\.\//g,"");pathname=pathname.replace(/\.\//g,"")}}return{hash:rmatch[3],host:host,hostname:host,href:protocol+"//"+host+((port!="80"&&port!="443")?":"+port:"")+pathname+rmatch[2]+rmatch[3],origin:protocol+"//"+host+((port!="80"&&port!="443")?":"+port:""),pathname:pathname,port:port,protocol:protocol,search:rmatch[2]}}return null}function send_crossdomain(s,callback){var script=document.createElement("script"),head=document.head||document.getElementsByTagName("head")[0]||document.documentElement;function dispose(){script.onload=script.onreadystatechange=null;if(script.parentNode){script.parentNode.removeChild(script)}script=null}script.async=true;if(s.scriptCharset){script.charset=s.scriptCharset}script.src=s.url;script.onload=script.onreadystatechange=function(){if(!script.readyState||/loaded|complete/.test(script.readyState)){dispose();if(callback){callback(200)}}};head.insertBefore(script,head.firstChild)}function send(s){var context=s.context||s,a=null,d=null;s.method=s.method.toUpperCase();s.charset=s.charset.toLowerCase();if(s.url&&s.url.slice(-1)=="?"){s.url=s.url.substr(0,s.url.length-1)}s.url=s.url.replace(/#(.*?)$/,"").replace("callback=?","");var URL=parse_url(s.url);if(s.data){d=s.data;if(typeof d=="object"){d=Ajax.SerializeJson(d,s.charset)}}if(s.dataType=="jsonp"){s.originDataType="jsonp";s.id="ajax_"+Math.random().toString().substr(2);s.dataType="script";s.url+=(URL.search?"&":"?")+s.jsonp+"="+s.id;window[s.id]=function(){s.succeed.apply(context,arguments)}}if(origin!=URL.origin&&s.dataType=="script"){send_crossdomain(s,s.originDataType=="jsonp"?null:function(){s.succeed.apply(context,arguments)});return}if(d){if(!s.headers["Content-Type"]){if(!s.contentType){s.headers["Content-Type"]="application/x-www-form-urlencoded"}else{s.headers["Content-Type"]=CONTENTTYPES[s.contentType]||s.contentType}}}if((s.method=="GET"||s.method=="HEAD")&&!s.cache){s.headers["If-Modified-Since"]=0;s.headers["Cache-Control"]="no-cache"}try{a=get_obj();if(s.async){a.onreadystatechange=function(){if(a.readyState==4){response.apply(s,[a,s])}}}if(s.timeout>0){try{a.timeout=s.timeout}catch(ex){}}s.beforesend.call(context,a);if(s.username&&s.username!=""){a.open(s.method,s.url,s.async,s.username,s.userpwd)}else{a.open(s.method,s.url,s.async)}for(var h in s.headers){if(!s.headers.hasOwnProperty(h)){continue}a.setRequestHeader(h,s.headers[h])}a.send(d);if(!s.async&&a.readyState==4){response.apply(s,[a,s])}}catch(ex){s.complete.call(context,a);s.error.call(context,ex.description,a)}}function extend(a){if(arguments.length<2){return null}var arg=null;for(var i=1;i>2;m=((g&3)<<4)|(h>>4);n=((h&15)<<2)|(j>>6);o=j&63;s+=f[k]+f[m]+f[n]+f[o]}if(q-r==2){g=t[p++];h=t[p++];s+=f[g>>2]+f[((g&3)<<4)|(h>>4)]+f[((h&15)<<2)]+"="}else{if(q-r==1){g=t[p++];s+=f[g>>2]+f[((g&3)<<4)]+"=="}}return s};var c=function(t){t=t.replace(/\s/g,"");if(t==""){return[]}var s=[];var g,h,j="";var k,m,n,o="";var p=0,q=t.length,r=q;if(t.slice(-1)=="="){r=q-4}while(p>4);h=((m&15)<<4)|(n>>2);j=((n&3)<<6)|o;s.push(g,h,j)}if(q!=r){k=e[t.charCodeAt(p++)];m=e[t.charCodeAt(p++)];if(t.slice(-2)=="=="){s.push((k<<2)|(m>>4))}else{if(t.slice(-1)=="="){n=e[t.charCodeAt(p++)];s.push((k<<2)|(m>>4),((m&15)<<4)|(n>>2))}}}return s};var b=a.Base64={};b.e=d;b.d=c;b.encode=function(g){if(typeof g=="string"){g=a.Utf8.getByteArray(g)}return d(g)};b.decode=function(g){return a.Utf8.getString(c(g))}})(window);; var MOEJS=(function(){var rsplit=function(string,regex){var result=regex.exec(string),retArr=new Array(),first_idx,last_idx,first_bit;while(result!=null){first_idx=result.index;last_idx=regex.lastIndex;if((first_idx)!=0){first_bit=string.substring(0,first_idx);retArr.push(string.substring(0,first_idx));string=string.slice(first_idx)}retArr.push(result[0]);string=string.slice(result[0].length);result=regex.exec(string)}if(!string==""){retArr.push(string)}return retArr},chop=function(string){return string.substr(0,string.length-1)},extend=function(d,s){for(var n in s){if(s.hasOwnProperty(n)){d[n]=s[n]}}};var EJS=function(options){options=typeof options=="string"?{view:options}:options;this.set_options(options);if(options.precompiled){this.template={};this.template.process=options.precompiled;EJS.update(this.name,this);return}if(options.element){if(typeof options.element=="string"){var name=options.element;options.element=document.getElementById(options.element);if(options.element==null){throw name+"does not exist!"}}if(options.element.value){this.text=options.element.value}else{this.text=options.element.innerHTML}this.name=options.element.id;this.type="["}else{if(options.url){options.url=EJS.endExt(options.url,this.extMatch);this.name=this.name?this.name:options.url;var url=options.url;var template=EJS.get(this.name,this.cache);if(template){return template}if(template==EJS.INVALID_PATH){return null}try{this.text=EJS.request(url+(this.cache?"":"?"+Math.random()))}catch(e){}if(this.text==null){throw ({type:"EJS",message:"There is no template at "+url})}}}var template=new EJS.Compiler(this.text,this.type);template.compile(options,this.name);EJS.update(this.name,this);this.template=template};EJS.prototype={render:function(object,extra_helpers){object=object||{};this._extra_helpers=extra_helpers;var v=new EJS.Helpers(object,extra_helpers||{});return this.template.process.call(object,object,v)},update:function(element,options){if(typeof element=="string"){element=document.getElementById(element)}if(options==null){_template=this;return function(object){EJS.prototype.update.call(_template,element,object)}}if(typeof options=="string"){params={};params.url=options;_template=this;params.onComplete=function(request){var object=eval(request.responseText);EJS.prototype.update.call(_template,element,object)};EJS.ajax_request(params)}else{element.innerHTML=this.render(options)}},out:function(){return this.template.out},set_options:function(options){this.type=options.type||EJS.type;this.cache=options.cache!=null?options.cache:EJS.cache;this.text=options.text||null;this.name=options.name||null;this.ext=options.ext||EJS.ext;this.extMatch=new RegExp(this.ext.replace(/\./,"."))}};EJS.endExt=function(path,match){if(!path){return null}match.lastIndex=0;return path+(match.test(path)?"":this.ext)};EJS.Scanner=function(source,left,right){extend(this,{left_delimiter:left+"%",right_delimiter:"%"+right,double_left:left+"%%",double_right:"%%"+right,left_equal:left+"%=",left_comment:left+"%#"});this.SplitRegexp=left=="["?/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/:new RegExp("("+this.double_left+")|(%%"+this.double_right+")|("+this.left_equal+")|("+this.left_comment+")|("+this.left_delimiter+")|("+this.right_delimiter+"\n)|("+this.right_delimiter+")|(\n)");this.source=source;this.stag=null;this.lines=0};EJS.Scanner.to_text=function(input){if(input==null||input===undefined){return""}if(input instanceof Date){return input.toDateString()}if(input.toString){return input.toString()}return""};EJS.Scanner.prototype={scan:function(block){scanline=this.scanline;regex=this.SplitRegexp;if(!this.source==""){var source_split=rsplit(this.source,/\n/);for(var i=0;i0){for(var i=0;i0){buff.push(put_cmd+'"'+clean(content)+'")')}content="";break;case scanner.double_left:content=content+scanner.left_delimiter;break;default:content=content+token;break}}else{switch(token){case scanner.right_delimiter:switch(scanner.stag){case scanner.left_delimiter:if(content[content.length-1]=="\n"){content=chop(content);buff.push(content);buff.cr()}else{buff.push(content)}break;case scanner.left_equal:buff.push(insert_cmd+"(EJS.Scanner.to_text("+content+")))");break}scanner.stag=null;content="";break;case scanner.double_right:content=content+scanner.right_delimiter;break;default:content=content+token;break}}});if(content.length>0){buff.push(put_cmd+'"'+clean(content)+'")')}buff.close();this.out=buff.script+";";var to_be_evaled="/*"+name+"*/this.process = function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {"+this.out+" return ___ViewO.join('');}}}catch(e){e.lineNumber=null;throw e;}};";try{eval(to_be_evaled)}catch(e){if(typeof JSLINT!="undefined"){JSLINT(this.out);for(var i=0;i").replace(/''/g,"'")}return""}};EJS.Helpers.prototype.date_tag=function(name,value,html_options){if(!(value instanceof Date)){value=new Date()}var month_names=["January","February","March","April","May","June","July","August","September","October","November","December"];var years=[],months=[],days=[];var year=value.getFullYear();var month=value.getMonth();var day=value.getDate();for(var y=year-15;y")};EJS.Helpers.prototype.start_tag_for=function(tag,html_options){return this.tag(tag,html_options)};EJS.Helpers.prototype.submit_tag=function(name,html_options){html_options=html_options||{};html_options.type=html_options.type||"submit";html_options.value=name||"Submit";return this.single_tag_for("input",html_options)};EJS.Helpers.prototype.tag=function(tag,html_options,end){if(!end){var end=">"}var txt=" ";for(var attr in html_options){if(html_options[attr]!=null){var value=html_options[attr].toString()}else{var value=""}if(attr=="Class"){attr="class"}if(value.indexOf("'")!=-1){txt+=attr+'="'+value+'" '}else{txt+=attr+"='"+value+"' "}}return"<"+tag+txt+end};EJS.Helpers.prototype.tag_end=function(tag){return""};EJS.Helpers.prototype.text_area_tag=function(name,value,html_options){html_options=html_options||{};html_options.id=html_options.id||name;html_options.name=html_options.name||name;value=value||"";if(html_options.size){html_options.cols=html_options.size.split("x")[0];html_options.rows=html_options.size.split("x")[1];delete html_options.size}html_options.cols=html_options.cols||50;html_options.rows=html_options.rows||4;return this.start_tag_for("textarea",html_options)+value+this.tag_end("textarea")};EJS.Helpers.prototype.text_tag=EJS.Helpers.prototype.text_area_tag;EJS.Helpers.prototype.text_field_tag=function(name,value,html_options){return this.input_field_tag(name,value,"text",html_options)};EJS.Helpers.prototype.url_for=function(url){return'window.location="'+url+'";'};EJS.Helpers.prototype.img_tag=function(image_location,alt,options){options=options||{};options.src=image_location;options.alt=alt;return this.single_tag_for("img",options)};EJS.newRequest=function(){var factories=[function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];for(var i=0;i