
if(typeof IAJS=="undefined"){var IAJS={};IAJS.CONFIG={dateFormat:{euro:0,american:1,iso:2},debug:true,showDebugCategory:{error:true,warn:true,time:false,info:false,window:true},animateCE:true,animateCESpeed:.2,expandTextarea:true,controllerIdCounter:0};IAJS.CONFIG.defaultDateFormat=IAJS.CONFIG.dateFormat.euro;IAJS.RESOURCE={};IAJS.RESOURCE.log={DEFAULT:0,INIT:1,VALIDATION:2,BOOTSTRAP:3,MASTER:4,SUBORDINATE:5,EVENT:6};}
IAJS.init=function(){}
IAJS.CONTROLLER=function(){}
IAJS.controllerCollection=IAJS.controllerCollection||{};IAJS.formCollection=IAJS.formCollection||{};IAJS.VALIDATION=function(){}
IAJS.log=function(message,category,controller,source){}
IAJS.form=function(){};IAJS.formManager={add:function(f,c){if(!IAJS.formCollection[f.id])IAJS.formCollection[f.id]=new IAJS.CONTROLLER.Form(f).init();if(c&&c.controllerId)IAJS.formCollection[f.id].register(c);},register:function(c){if(c&&c.getCheckInsideForm()){if(f=YAHOO.util.Dom.getAncestorByTagName(c.node,"form")){IAJS.formManager.add(f,c);}else{IAJS.log("Could not find form element for controller","warn",c,IAJS.RESOURCE.log.BOOTSTRAP);}}else{return false;}
return true;}}
IAJS.controllerManager={add:function(c){if(!c.controllerId&&!IAJS.controllerManager.initControllerId(c))return false;IAJS.controllerCollection[c.controllerId]=c;return true;},get:function(id){return(IAJS.controllerCollection)?IAJS.controllerCollection:null;},initMaster:function(c){if((master=IAJS.ELATTR.getMaster(c))&&(m=master.controller||master.element)){switch(m.action){case'enable':IAJS.Event.On(m,"onEnableChange",c.onMasterChange,c);break;case'valid':IAJS.Event.On(m,"onValidationChange",c.onMasterChange,c);break;case'change':IAJS.Event.On(m,"onChange",c.onMasterChange,c);break;default:IAJS.Event.On(m,"onChange",c.onMasterChange,c);IAJS.Event.On(m,"onEnableChange",c.onMasterChange,c);IAJS.Event.On(m,"onValidationChange",c.onMasterChange,c);break;}}},initSubordinate:function(c){if(subordinate=IAJS.ELATTR.getSubordinate(c)){var value=IAJS.Event.On(subordinate.controller,"onChange",c.onSubordinateChange,c);(!value)?IAJS.log("subordinate hook error","error",c):c.onSubordinateChange();}},addListeners:function(){IAJS.controllerManager.initMaster();IAJS.controllerManager.initSubordinate();},initControllerId:function(c){try{var key=null;if(c.node&&c.node.getAttribute("elattr")&&!c.elattr)c.initAttribute();if(c.elattr&&c.elattr.id)key=c.elattr.id;else if(c.node&&c.node.id)key=c.node.id;else if(c.input&&c.input.id)key=c.input.id;else if(c.objectType)key=c.objectType+"_"+IAJS.CONFIG.controllerIdCounter++;else key=("controller_"+IAJS.CONFIG.controllerIdCounter++);c.controllerId=key;}catch(e){IAJS.log("failed to created controller id"+e,"error",c,IAJS.RESOURCE.log.INIT);return false;}
return true;}}
IAJS.Event=function(){};IAJS.Event.On=function(c,type,fn,scope){if(!c||!type){IAJS.log("EVENT: invalid arguments (c: "+c+", e: "+type+")","warn");return false;}
var c=(typeof(c)=="object")?c.controllerId:c;if(!c||!IAJS.controllerCollection[c]){IAJS.log("EVENT: controller not found in collection (c: "+c+", e: "+type+")","warn");return false;}
if(!type||!IAJS.controllerCollection[c].getEvents()){IAJS.log("EVENT: controller event not found (c: "+c+", e: "+type+")","warn");return false;}
var events=IAJS.controllerCollection[c].getEvents();if(!events[type]){IAJS.log("EVENT: controller event not found (c: "+c+", e: "+type+")","warn");return false;}
if(scope){events[type].subscribe(fn,scope,true);}else{events[type].subscribe(fn);}
return true;}
IAJS.Event.logCustom=function(c){if(!c&&!c.event)return false;for(var key in c.event){c.event[key].subscribe(function(e){IAJS.log("event."+e+" fired","warn",c);});}}
IAJS.ELATTR={};IAJS.ELATTR.parseMaster=function(c){if(c&&c.elattr&&c.elattr.master&&c.elattr.master!=""){masterArr=c.elattr.master.split(",");if(!masterArr&&masterArr.length<2)return false;var masterController=(masterArr[1])?masterArr[0]:false;var masterElement=(masterArr[1])?masterArr[1]:masterArr[0];var masterAction=masterArr[2]||false;return{controller:masterController,element:masterElement,action:masterAction};}else{return false;}}
IAJS.ELATTR.getMaster=function(c){var master=IAJS.ELATTR.parseMaster(c);if(master){if(!IAJS.controllerCollection[master.controller||master.element]){IAJS.log("elattr:master found but not in controllerCollection","error",c,IAJS.RESOURCE.log.MASTER);return false;}}else{return false;}
return master;}
IAJS.ELATTR.parseSubordinate=function(c){if(c&&c.elattr&&c.elattr.subordinate&&c.elattr.subordinate!=""){subordinateArr=c.elattr.subordinate.split(",");if(!subordinateArr&&subordinateArr.length<2)return false;var subordinateController=(subordinateArr[1])?subordinateArr[0]:false;var subordinateElement=(subordinateArr[1])?subordinateArr[1]:subordinateArr[0];return{controller:subordinateController,element:subordinateElement};}else{return false;}}
IAJS.ELATTR.getSubordinate=function(c){var subordinate=IAJS.ELATTR.parseSubordinate(c);if(subordinate){if(!IAJS.controllerCollection[subordinate.controller]){IAJS.log("elattr:subordinate found but not in controllerCollection","error",c,IAJS.RESOURCE.log.SUBORDINATE);return false;}}else{return false;}
return subordinate;}
IAJS.ELATTR.calcDateDiff=function(date,diff){if(!date||!diff)return false;if((/[^0-9|d|m|y]+/).test(diff))return false;var date1=date.toStructuredDateArray();date1=new Date(date1[2],date1[1],date1[0]);var date2=new Date(date1.getTime());IAJS.log("CC "+date1.getDay()+" "+date1.getMonth()+" "+date1.getYear(),"error");var yearsDiff=diff.match(/(\d+)y/);var monthsDiff=diff.match(/(\d+)m/);var daysDiff=diff.match(/(\d+)d/);if(yearsDiff)date2.setFullYear(date1.getFullYear()+yearsDiff[1]);if(monthsDiff){var newMonth=parseInt(date1.getMonth())+parseInt(monthsDiff[1]);var years=0;IAJS.log("BB "+newMonth,"error");if(newMonth<0){while(newMonth<0){newMonth+=12;years-=1;}}else if(newMonth>11){while(newMonth>11){newMonth-=12;years+=1;}}
date2.setMonth(newMonth);date2.setFullYear(date1.getFullYear()+years);}
if(daysDiff){date2.setDate(date1.getDate()+daysDiff[1]);}
return date2;}
Date.prototype.format=function(m,r){var d=this,a,fix=function(n,c){return(n=n+"").length<c?new Array(++c-n.length).join("0")+n:n};var r=r||{},f={j:function(){return d.getDate()},w:function(){return d.getDay()},y:function(){return(d.getFullYear()+"").slice(2)},Y:function(){return d.getFullYear()},n:function(){return d.getMonth()+1},m:function(){return fix(f.n(),2)},g:function(){return d.getHours()%12||12},G:function(){return d.getHours()},H:function(){return fix(d.getHours(),2)},h:function(){return fix(f.g(),2)},d:function(){return fix(f.j(),2)},N:function(){return f.w()+1},i:function(){return fix(d.getMinutes(),2)},s:function(){return fix(d.getSeconds(),2)},S:function(){return d.getSeconds()},ms:function(){return fix(d.getMilliseconds(),3)},a:function(){return d.getHours()>11?"pm":"am"},A:function(){return f.a().toUpperCase()},O:function(){return d.getTimezoneOffset()/60},z:function(){return(d-new Date(d.getFullYear()+"/1/1"))/864e5>>0},L:function(){var y=f.Y();return(!(y&3)&&(y%1e2||!(y%4e2)))?1:0},t:function(){var n;return(n=d.getMonth()+1)==2?28+f.L():n&1&&n<8||!(n&1)&&n>7?31:30},W:function(){var a=f.z(),b=364+f.L()-a,nd=(new Date(d.getFullYear()+"/1/1").getDay()||7)-1;return(b<=2&&((d.getDay()||7)-1)<=2-b)?1:(a<=2&&nd>=4&&a>=(6-nd))?new Date(d.getFullYear()-1+"/12/31").format("%W%"):(1+(nd<=3?((a+nd)/7):(a-(7-nd))/7)>>0);}}
return m.replace(/%(.*?)%/g,function(t,s){return r[s]?r[s](d,function(s){return f[s]&&f[s]();}):f[s]?f[s]():"%"+(s&&s+"%");});}
String.prototype.replaceAll=function(needle,replacement)
{var str=this
while(str.indexOf(needle)>-1)
{str=str.replace(needle,replacement);}
return str;}
String.prototype.pad=function(l,s,t){return s||(s=" "),(l-=this.length)>0?(s=new Array(Math.ceil(l/s.length)+1).join(s)).substr(0,t=!t?l:t==1?0:Math.ceil(l/2))+this+s.substr(0,l-t):this;};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();}
String.prototype.camelize=function(){var parts=this.split('-'),len=parts.length;if(len==1)return parts[0];var camelized=this.charAt(0)=='-'?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++)
camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1);return camelized;}
String.prototype.toReadableDate=function(format)
{var date_arr=this.split("-");var day=date_arr[0];var month=date_arr[1];var year=date_arr[2];var d=new Date(year,month-1,day);var functions={DayName:function(d,f){return LOCALIZE.days[f('w')];},MonthName:function(d,f){return LOCALIZE.month[f('n')-1];}}
return d.format(format,functions);}
String.prototype.toReadableTime=function(format)
{var time_arr=this.split(/[\s\.,\/\+_,:=]+/);var hour=time_arr[0];var minute=time_arr[1];var second=time_arr[2];var d=new Date(1970,1,1,hour,minute,second);if(format)
return d.format(format);else
return d;}
String.prototype.toReadablePhone=function(){phoneString=this.replace(/([\\\/\.\-\(\)\s,])/ig,"");return phoneString.replace(/^00/g,"+");}
String.prototype.toStructuredDate=function()
{date_arr=this.toStructuredDateArray();var day=date_arr[0];var month=date_arr[1];var year=date_arr[2]||new Date().getUTCFullYear();if(year&&year.length<4)year="2".pad(4-year.length,"0",1)+year;return day.pad(2,"0")+"-"+(month&&month.pad(2,"0"))+"-"+year;}
String.prototype.toStructuredDateArray=function(){val=this.replace(/^[\s]+/,"");return val.split(/[\s\.,\/\+_,:=\-]+/);}
String.prototype.toStructuredTime=function(asArray){timeString=this.toLowerCase();timeString=timeString.replace(/^[\s]+/,"");timeString=timeString.replace(/[\s\.,\/\+_,=:\-]+/g,":");if((/[^0-9|u|h|m|s|:]+/).test(timeString))return false;if(timeString.match(/[u|h|m|s]/)){var hour=timeString.match(/(\d+)[h|u]/);var minute=timeString.match(/(\d+)m/);var second=timeString.match(/(\d+)s/);hour=(!hour)?"0":hour[1];minute=(!minute)?"0":minute[1];second=(!second)?"0":second[1];}else{var time_arr=timeString.split(":");var hour=time_arr[0]||"0";var minute=time_arr[1]||"0";var second=time_arr[2]||"0";}
return(asArray)?new Array(hour,minute,second):hour.pad(2,"0")+":"+minute.pad(2,"0")+":"+second.pad(2,"0");}
String.prototype.toStructuredUrl=function(assumeScheme){if(this.length==0)return;urlString=this.toLowerCase();urlString=urlString.replace(/\s+$/);if(assumeScheme&&!(/:\/\//).test(urlString))urlString=assumeScheme+"://"+urlString;return urlString;}
String.prototype.removeSeperators=function(){return this.replace(/([\.\-\/\\\s,])/ig,"");}
Array.prototype.indexOf=function(object){for(var i=0,length=this.length;i<length;i++)
if(this[i]==object)return i;return-1;}
IAJS.CONTROLLER.BaseController=function(node){this.objectType="BaseController";this.node=node;this.input;this.response;this.elattr;this.validationCode;this.isEnabled;};IAJS.CONTROLLER.BaseController.prototype.init=function(){}
IAJS.CONTROLLER.BaseController.prototype.hookAfterInit=function(){}
IAJS.CONTROLLER.BaseController.prototype.hookBeforeSubmit=function(o){if(this.elattr&&this.elattr.required){if(this.validationCode!=IAJS.RESPONSE.OK)return false;}
return true;if(this.validationCode==IAJS.RESPONSE.FALLTHROUGH&&this.elattr&&this.elattr.required){this.validationCode=IAJS.RESPONSE.MANDATORY;return false;}
return true;}
IAJS.CONTROLLER.BaseController.prototype.validate=function(){return IAJS.RESPONSE.INVALID;}
IAJS.CONTROLLER.BaseController.prototype.getResponse=function(input_id){return YAHOO.util.Dom.get("response_"+input_id);}
IAJS.CONTROLLER.BaseController.prototype.initAttribute=function(){if(!YAHOO.lang.isObject(this.elattr)){this.elattr=new Object();if(this.node){attrStr=this.node.getAttribute("elattr");if(YAHOO.lang.isString(attrStr)){attrArr=attrStr.split(";");if(YAHOO.lang.isArray(attrArr)){for(i=0;i<attrArr.length;i++){if(YAHOO.lang.isString(attrArr[i])){kv=attrArr[i].split(":");val=(kv[1]==='false')?false:kv[1];this.elattr[kv[0]]=(val)?val:true;}}}}}}}
IAJS.CONTROLLER.BaseController.prototype.getAttr=function(attr){return(this.elattr&&this.elattr[attr])?this.elattr[attr]:false;}
IAJS.CONTROLLER.BaseController.prototype.setAttr=function(elattr,value){if(this.elattr)this.elattr['attr']=value;}
IAJS.CONTROLLER.BaseController.prototype.parseAttr=function(elm){if(elm&&elm.getAttribute("elattr")){attrStr=elm.getAttribute("elattr");if(YAHOO.lang.isString(attrStr)){var attrValue=new Object();attrArr=attrStr.split(";");if(YAHOO.lang.isArray(attrArr)){for(i=0;i<attrArr.length;i++){if(YAHOO.lang.isString(attrArr[i])){kv=attrArr[i].split(":");val=(kv[1]==='false')?false:kv[1];attrValue[kv[0]]=val;}}}}}
return(attrValue)?attrValue:false;}
IAJS.CONTROLLER.BaseController.prototype.hasResponse=function(){return(this.input&&this.response);}
IAJS.CONTROLLER.BaseController.prototype.getCheckInsideForm=function(){return false;}
IAJS.CONTROLLER.BaseController.prototype.getEvents=function(){return(this.event)?this.event:false;}
IAJS.CONTROLLER.BaseController.prototype.setEnabled=function(value,args,me){if(args){var m=IAJS.ELATTR.getMaster(this);value=(m&&m.element==args[0].target)?true:false;}
if(this.input){(value)?this.input.removeAttribute("disabled"):this.input.setAttribute("disabled","disabled");}
if(this.hasResponse){if(value){this.validate();}else{if(this.validationCode&&this.validationCode!=IAJS.RESPONSE.OK){Response.clear(this.response);}}}
if(this.enabled)this.enabled=value;if(this.event&&this.event.onEnableChange&&this.event.onEnableChange!=null){this.event.onEnableChange.fire({enabled:value});}}
IAJS.CONTROLLER.BaseController.prototype.enabledHandler=function(e){var elm=YAHOO.event.getTarget(e);try{this.setEnabled(elm.checked);IAJS.log("enabledHandler: "+elm.id+", "+elm.checked+", "+elm.value+", "+e.type,"info",this,IAJS.RESOURCE.log.EVENT);}catch(e){IAJS.log("enabledHandler: could not call handler for "+elm.type,"warn",this,IAJS.RESOURCE.log.EVENT);}}
IAJS.CONTROLLER.BaseController.prototype.hasEvent=function(type){return(this.event&&this.event[type]);}
IAJS.CONTROLLER.BaseController.prototype.onSubordinateChange=function(){return false;}
IAJS.CONTROLLER.BaseController.prototype.onMasterChange=function(value){var master=IAJS.ELATTR.getMaster(this);if(master){this.setEnabled(IAJS.controllerCollection[master.element].getChecked());}}
IAJS.CONTROLLER.BaseController.prototype._initEvent=function(){return false;}
IAJS.CONTROLLER.BaseController.defaultMasterEvents=function(){return{onEnableChange:null,onChange:null,onValidationChange:null}}
IAJS.CONTROLLER.BaseController.initDefaultMasterEvents=function(c){if(c&&c.event){c.event.onChange=new YAHOO.util.CustomEvent("onChange",c);c.event.onEnableChange=new YAHOO.util.CustomEvent("onEnableChange",c);c.event.onValidationChange=new YAHOO.util.CustomEvent("onValidationChange",c);}}
IAJS.CONTROLLER.VatBase=function(node){this.node=node;this.insideForm=true;this.objectType="VatBase";}
YAHOO.extend(IAJS.CONTROLLER.VatBase,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.VatBase.prototype.init=function(node){this.node=node;if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("textfield","input",this.node)[0];this.initAttribute();this.response=this.getResponse(this.input.id);if(this.hasResponse()){YAHOO.util.Event.on(this.input,"blur",this.validate,this,true);}}}
IAJS.CONTROLLER.VatBase.prototype.getCountry=function(){};IAJS.CONTROLLER.VatBase.prototype.hookAfterInit=function(){this.validate();};IAJS.CONTROLLER.VatBase.prototype.validate=function(){this.validationCode=IAJS.VALIDATION.vat(this.getCountry(),this.input.value);if(this.hasResponse()){this.responseAction()};};IAJS.CONTROLLER.VatBase.prototype.responseAction=function(){switch(this.validationCode){case IAJS.RESPONSE.OK:Response.clear(this.response);break;case IAJS.RESPONSE.INVALID:Response.set(this.response,"error",LOCALIZE.messages.VAT_INVALID);break;case IAJS.RESPONSE.FALLTHROUGH:default:Response.clear(this.response);}};IAJS.CONTROLLER.VatBase.prototype.getCheckInsideForm=function(){return true;}
IAJS.CONTROLLER.Checkbox=function(node,owner){this.node=node;this.owner=owner|false;this.isSelected=false;this.objectType="Checkbox";this.event=IAJS.CONTROLLER.BaseController.defaultMasterEvents(this);};YAHOO.extend(IAJS.CONTROLLER.Checkbox,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.Checkbox.prototype.init=function(){if(this.node){this.id=this.node.getAttribute("id");this.input=(this.node.type&&this.node.type==="checkbox")?(this.node):(YAHOO.util.Dom.getElementsBy(function(elm){return(elm.type==="checkbox")},"input",this.node)[0]||null);(this.owner)?YAHOO.util.Event.on(this.input,"click",this.owner.select,this,this.owner):YAHOO.util.Event.on(this.input,"click",this.select,this,true);IAJS.CONTROLLER.BaseController.initDefaultMasterEvents(this);}
return this;};IAJS.CONTROLLER.Checkbox.prototype.select=function(){this.isSelected=this.node.checked;this.event.onChange.fire(this);}
IAJS.CONTROLLER.Checkbox.prototype.getChecked=function(){return this.input.checked;}
IAJS.CONTROLLER.Checkbox.prototype.validate=function(){return false;};IAJS.CONTROLLER.Checkbox.prototype.responseAction=function(){return false;};IAJS.CONTROLLER.Date=function(node){IAJS.CONTROLLER.Date.superclass.constructor.call(this,node);this.objectType="Date";this.node=node;this.id;this.date=null;this.dateFormat=IAJS.CONFIG.defaultDateFormat;this.event=IAJS.CONTROLLER.BaseController.defaultMasterEvents(this);}
YAHOO.extend(IAJS.CONTROLLER.Date,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.Date.prototype.init=function(){if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("textfield","input",this.node)[0];this.initAttribute();this._initEvent();}else{return false;}
if(this.input){this.id=this.input.id;this.response=this.getResponse(this.id);if(this.elattr.format)this.dateFormat=this.elattr.format;this.date=new IAJS.Date(this.input.value,this.dateFormat).init();var hasDatePicker=document.getElementById("datepicker_"+this.id);if(hasDatePicker){this.datepicker=new IAJS.CONTROLLER.DatePicker(this);if(this.datepicker){try{this.datepicker.init();}catch(e){IAJS.log("could not initalize datapicker","error",this,IAJS.RESOURCE.log.INIT);}}else{IAJS.log("could not create datepicker","error",this,IAJS.RESOURCE.log.INIT);}}}else{return false;}
if(this.hasResponse()){YAHOO.util.Event.on(this.input,"blur",this.validate,this,true);}
return true;}
IAJS.CONTROLLER.Date.prototype._initEvent=function(){IAJS.CONTROLLER.BaseController.initDefaultMasterEvents(this);}
IAJS.CONTROLLER.Date.prototype.setDate=function(date){this.input.value=date;this.validate();}
IAJS.CONTROLLER.Date.prototype.focus=function(){this.input.focus();}
IAJS.CONTROLLER.Date.prototype.getDate=function(){return(this.date)?this.input.value:false;}
IAJS.CONTROLLER.Date.prototype.hookAfterInit=function(){this.validate();}
IAJS.CONTROLLER.Date.prototype.validate=function(){var v=this.validationCode;this.validationCode=this._validate();this.responseAction();if(v!=this.validationCode)this.event.onValidationChange.fire();if(this.event.onChange.previousValue&&this.event.onChange.previousValue!=this.input.value)this.event.onChange.fire();this.event.onChange.previousValue=this.input.value;}
IAJS.CONTROLLER.Date.prototype._validate=function(){this.date=new IAJS.Date(this.input.value,this.dateFormat).init();if(this.date.isEmpty())return IAJS.RESPONSE.FALLTHROUGH;if(!this.date.isDate())return IAJS.RESPONSE.INVALID;mindate=false;maxdate=false;dif=false;var m=IAJS.ELATTR.getMaster(this);if(m){var master=(m.controller)?IAJS.controllerCollection[m.controller]:IAJS.controllerCollection[m.element];if(master.validationCode==IAJS.RESPONSE.OK){nr=this.elattr.diff;prefix=nr.substring(0,1);if(prefix=="-"){mindate=new IAJS.Date(master.date.asFormattedString(),this.dateFormat).init();mindate.addDay(nr*1);}
else if(prefix=="+"){maxdate=new IAJS.Date(master.date.asFormattedString(),this.dateFormat).init();maxdate.addDay(nr*1);}
else{nr=nr*1;mindate=new IAJS.Date(master.date.asFormattedString(),this.dateFormat).init();mindate.addDay(-nr);maxdate=new IAJS.Date(master.date.asFormattedString(),this.dateFormat).init();maxdate.addDay(nr);}
dif=true;}}else{if(this.elattr.mindate)mindate=new IAJS.Date(this.elattr.mindate).init();if(this.elattr.maxdate)maxdate=new IAJS.Date(this.elattr.maxdate).init();}
if(dif){if(!this.date.isInRange(mindate,maxdate))return IAJS.RESPONSE.OUTOFRANGE;}
else{if(mindate){if(this.date.isBefore(mindate))return IAJS.RESPONSE.TOLOW;}
if(maxdate){if(this.date.isAfter(maxdate))return IAJS.RESPONSE.TOHIGH;}}
return IAJS.RESPONSE.OK;}
IAJS.CONTROLLER.Date.prototype.responseAction=function(){IAJS.log("response "+this.validationCode,"info",this,IAJS.RESOURCE.log.VALIDATION);switch(this.validationCode){case IAJS.RESPONSE.OK:Response.set(this.response,"confirmation",this.date.toReadableDate("%DayName% %j% %MonthName% %Y%"));break;case IAJS.RESPONSE.INVALID:Response.set(this.response,"error",LOCALIZE.messages.DATE_INVALID);break;case IAJS.RESPONSE.OUTOFRANGE:case IAJS.RESPONSE.TOHIGH:case IAJS.RESPONSE.TOLOW:Response.set(this.response,"error",this.date.toReadableDate("%DayName% %j% %MonthName% %Y%")+" "+LOCALIZE.messages.DATE_OUT_OF_RANGE);break;case IAJS.RESPONSE.MANDATORY:Response.set(this.response,"error",LOCALIZE.messages.DATE_MANDATORY);break;case IAJS.RESPONSE.FALLTHROUGH:default:Response.clear(this.response);}}
IAJS.CONTROLLER.Date.prototype.getCheckInsideForm=function(){return true;}
IAJS.CONTROLLER.Date.prototype.setEnabled=function(value){IAJS.CONTROLLER.Date.superclass.setEnabled.call(this,value);if(this.datepicker)this.datepicker.setEnabled(value);}
IAJS.CONTROLLER.Date.prototype.onSubordinateChange=function(){var subordinate=IAJS.ELATTR.getSubordinate(this);if(subordinate){var selected=IAJS.controllerCollection[subordinate.controller].getSelected();if(selected)this.setEnabled(selected[subordinate.element]);}}
IAJS.CONTROLLER.Form=function(form){this.form=form;this.controllers={};this.event={onSubmit:null,onSubmitError:null}}
IAJS.CONTROLLER.Form.prototype.init=function(){this._initEvent();YAHOO.util.Event.on(this.form,"submit",this._handleSubmit,this,true);return this;}
IAJS.CONTROLLER.Form.prototype.register=function(c){if(c&&c.controllerId){this.controllers[c.controllerId]=c;this.event.onSubmit.subscribe(c.hookBeforeSubmit,c,true);}}
IAJS.CONTROLLER.Form.prototype._handleSubmit=function(e){var value=this.event.onSubmit.fire();IAJS.log("handleSubmit "+this.form.id+" "+value,"error");if(!value){alert("uuuu");YAHOO.util.Event.stopEvent(e);}}
IAJS.CONTROLLER.Form.prototype._handleSubmitError=function(e){var t=YAHOO.util.Event.getTarget(e).id;var value=IAJS.formCollection[t].event.onSubmit.fire();IAJS.log("---- done "+f.id+" "+value,"error");}
IAJS.CONTROLLER.Form.prototype._initEvent=function(){this.event.onSubmit=new YAHOO.util.CustomEvent("onSubmit",this);this.event.onSubmitError=new YAHOO.util.CustomEvent("onSubmitError",this);}
IAJS.CONTROLLER.Number=function(node){this.node=node;this.objectType="Number";}
YAHOO.extend(IAJS.CONTROLLER.Number,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.Number.prototype.init=function(){if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("textfield","input",this.node)[0];this.initAttribute();this.response=this.getResponse(this.input.id);}
if(this.hasResponse()||(this.elattr&&this.elattr.response)){YAHOO.util.Event.on(this.input,"blur",this.validate,this,true);}}
IAJS.CONTROLLER.Number.prototype.hookAfterInit=function(){this.validate();}
IAJS.CONTROLLER.Number.prototype.validate=function(){this.validationCode=IAJS.VALIDATION.number(this.input.value,this.elattr['min'],this.elattr['max'],this.elattr['decimals']);this.responseAction();}
IAJS.CONTROLLER.Number.prototype.responseAction=function(){switch(this.validationCode){case IAJS.RESPONSE.OK:if(this.hasResponse()){Response.clear(this.response);}
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.removeClass(this.input,this.elattr.response);}
break;case IAJS.RESPONSE.INVALID:if(this.hasResponse()){Response.set(this.response,"error",LOCALIZE.messages.NUMBER_INVALID)}
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response)};break;case IAJS.RESPONSE.TOLOW:if(this.hasResponse())Response.set(this.response,"error",LOCALIZE.messages.NUMBER_TOO_LOW)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response);};break;case IAJS.RESPONSE.TOHIGH:if(this.hasResponse())Response.set(this.response,"error",LOCALIZE.messages.NUMBER_TOO_HIGH)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response)}
break;case IAJS.RESPONSE.NUMBER.EXCEED_DECIMAL:if(this.hasResponse())Response.set(this.response,"error",LOCALIZE.messages.NUMBER_EXCEED_DECIMAL)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response)};break;case IAJS.RESPONSE.NUMBER.NO_FLOAT:if(this.hasResponse())Response.set(this.response,"error",LOCALIZE.messages.NUMBER_NO_FLOAT)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response)};break;case IAJS.RESPONSE.MANDATORY:if(this.hasResponse())Response.set(this.response,"error",LOCALIZE.messages.NUMBER_MANDATORY)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.addClass(this.input,this.elattr.response)};break;case IAJS.RESPONSE.FALLTHROUGH:if(this.hasResponse()){Response.clear(this.response)}
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.removeClass(this.input,this.elattr.response)};break;default:if(this.hasResponse())Response.clear(this.response)
else if(this.elattr&&this.elattr.response){YAHOO.util.Dom.removeClass(this.input,this.elattr.response)};}}
IAJS.CONTROLLER.Number.prototype.getCheckInsideForm=function(){return true;}
IAJS.CONTROLLER.Textarea=function(node){this.node=node;this.rows;this.x=0;this.y=0;this.remaining;this.maxExpand;this.maxLength=0;this.objectType="Textarea";}
YAHOO.extend(IAJS.CONTROLLER.Textarea,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.Textarea.prototype.init=function(){if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("","textarea",this.node)[0];this.initAttribute();if(this.input)this.rows=(this.input.getAttribute("rows"))?this.input.getAttribute("rows"):5;this.remaining=YAHOO.util.Dom.getElementsByClassName("amount","span",this.node)[0]
this.response=YAHOO.util.Dom.getElementsByClassName("remaining","div",this.node)[0];this.maxLength=this.elattr["maxlength"];}
if(this.hasResponse()){YAHOO.util.Event.on(this.input,"keyup",this.keyup,this,true);YAHOO.util.Event.on(this.input,"change",this.keyup,this,true);YAHOO.util.Event.on(this.input,"blur",this.validate,this,true);}}
IAJS.CONTROLLER.Textarea.prototype.hookAfterInit=function(){this.validate();this.updateRemaining();this.updateRows();}
IAJS.CONTROLLER.Textarea.prototype.keyup=function(e){this.updateRemaining();this.updateRows();}
IAJS.CONTROLLER.Textarea.prototype.setExpand=function(){doExpand=IAJS.CONFIG.expandTextarea;attr=this.elattr['maxexpand']*1;if(IAJS.CONFIG.expandTextarea===false||attr===false){this.maxExpand=false;}else{this.maxExpand=(attr>this.rows)?attr:this.rows*2;}}
IAJS.CONTROLLER.Textarea.prototype.updateRows=function(){if(this.maxExpand){var number_of_enters=this.input.value.split("\n").length;var number_of_lines=parseInt(this.input.value.length/this.input.getAttribute("cols"));var number_rows=(number_of_enters>=number_of_lines)?number_of_enters:number_of_lines;if(number_rows<=this.rows){this.input.rows=this.rows;}else if(number_rows<=this.maxExpand){YAHOO.util.Dom.setStyle(this.input,"height","");this.input.rows=number_rows;}}}
IAJS.CONTROLLER.Textarea.prototype.mousedown=function(e){YAHOO.util.Dom.setStyle(this.input,"color","#ff0000");var reg=new YAHOO.util.Dom.getRegion(this.input);YAHOO.util.Event.on(this.input,"mousemove",this.mousemove,this,true);YAHOO.util.Event.on(this.input,"mouseup",this.mouseup,this,true);}
IAJS.CONTROLLER.Textarea.prototype.mouseup=function(){YAHOO.util.Dom.setStyle(this.input,"color","#000000");YAHOO.util.Event.removeListener(this.input,"mousemove",this.mousemove);}
IAJS.CONTROLLER.Textarea.prototype.mousemove=function(e){YAHOO.util.Dom.setStyle(this.input,"color","#00ff00");}
IAJS.CONTROLLER.Textarea.prototype.validate=function(){this.validationCode=IAJS.VALIDATION.textarea(this.input.value,this.elattr.maxlength);}
IAJS.CONTROLLER.Textarea.prototype.updateRemaining=function(){if(this.maxLength>0){var remaining=this.maxLength-this.input.value.length;this.remaining.innerHTML=""+remaining;}}
IAJS.CONTROLLER.Textarea.prototype.responseAction=function(){switch(this.validationCode){case IAJS.RESPONSE.OK:Response.clear(this.response);break;case IAJS.RESPONSE.INVALID:Response.set(this.response,"error",LOCALIZE.messages.TEXT_MANDATORY);break;case IAJS.RESPONSE.TEXT.TOLONG:Response.set(this.response,"error",LOCALIZE.messages.TEXT_TOLONG);break;case IAJS.RESPONSE.FALLTHROUGH:default:Response.clear(this.response);}}
IAJS.CONTROLLER.Textarea.prototype.getCheckInsideForm=function(){return true;}
IAJS.CONTROLLER.Textfield=function(node){this.node=node;this.objectType="Textfield";}
YAHOO.extend(IAJS.CONTROLLER.Textfield,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.Textfield.prototype.init=function(){if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("textfield","input",this.node)[0];this.initAttribute();}}
IAJS.CONTROLLER.Textfield.prototype.hookAfterInit=function(){}
IAJS.CONTROLLER.Textfield.prototype.setEnabled=function(value){IAJS.CONTROLLER.Textfield.superclass.setEnabled.call(this,value);}
IAJS.CONTROLLER.Textfield.prototype.setVisible=function(value){(value)?this.input.removeAttribute("hidden"):this.input.setAttribute("hidden","hidden");}
IAJS.CONTROLLER.Textfield.prototype.onSubordinateChange=function(){var subordinate=IAJS.ELATTR.getSubordinate(this);if(subordinate){var selected=IAJS.controllerCollection[subordinate.controller].getSelected();if(selected)this.setEnabled(selected[subordinate.element]);if(!this.labelChecked&&IAJS.controllerCollection[subordinate.controller].objectType=="Dropdownlist"){var l=YAHOO.util.Dom.getElementsBy(function(el){return(el.getAttribute("for"));},"label",this.node)[0];YAHOO.util.Dom.addClass(l,"hidden");}
this.labelChecked=true;}};IAJS.CONTROLLER.Vat=function(node){this.node=node;this.countryElm;this.objectType="Vat";}
YAHOO.extend(IAJS.CONTROLLER.Vat,IAJS.CONTROLLER.VatBase);IAJS.CONTROLLER.Vat.prototype.init=function(){if(this.node){IAJS.CONTROLLER.Vat.superclass.init.call(this,this.node);this.countryElm=YAHOO.util.Dom.getElementsBy(function(el){return true},"select",this.node)[0];this.initAttribute();this._initEvent();if(this.hasResponse()){YAHOO.util.Event.on(this.countryElm,"change",this.validate,this,true);}}}
IAJS.CONTROLLER.Vat.prototype.getCountry=function(){return(this.countryElm)?this.countryElm.options[this.countryElm.selectedIndex].value:null;};IAJS.CONTROLLER.Vat.prototype.setEnabled=function(value){value=!value;(value)?this.countryElm.removeAttribute("disabled"):this.countryElm.setAttribute("disabled","disabled");(value)?this.input.removeAttribute("disabled"):this.input.setAttribute("disabled","disabled");}
IAJS.CONTROLLER.VatBelgium=function(node){this.node=node;this.objectType="VatBelgium";}
YAHOO.extend(IAJS.CONTROLLER.VatBelgium,IAJS.CONTROLLER.VatBase);IAJS.CONTROLLER.VatBelgium.prototype.init=function(){if(this.node){IAJS.CONTROLLER.Vat.superclass.init.call(this,this.node);this.initAttribute();this._initEvent();}}
IAJS.CONTROLLER.VatBelgium.prototype.getCountry=function(){return"BE";}
IAJS.Date=function(dateString,format){this._now=new Date();this.monthArray=new Array(31,28,31,30,31,30,31,31,30,31,30,31);this.format=(format)?format:false;this.dateString=(dateString)?dateString:"";this._date=false;this.init=function(){if(this.dateString.toUpperCase()=="NOW"){this._date=new Date();}else{var arr=this._doFormat();switch(this.format){case IAJS.CONFIG.dateFormat.iso:this._setDate(arr,[2,1,0]);break;case IAJS.CONFIG.dateFormat.american:this._setDate(arr,[1,0,2]);break;case IAJS.CONFIG.dateFormat.iso:default:this._setDate(arr,[0,1,2]);}}
return this;}
this.isDate=function(){return(this._date)?true:false;}
this.isEmpty=function(){return(!this.dateString||this.dateString=="")?true:false;}
this.getTimestamp=function(){return(this._date)?this._date.getTime():0;}
this.getDateObject=function(){return(this._date)?this._date:null;}
this.getDay=function(){return(this._date)?this._date.getDate():false;}
this.getMonth=function(){return(this._date)?this._date.getMonth()+1:false;}
this.getYear=function(){return(this._date)?this._date.getFullYear():false;}
this.addDay=function(days){if(isNaN(parseInt(days)))return false;if(this._date){this._date.setDate(this._date.getDate()+parseInt(days));}
return true;}
this.isInRange=function(minDate,maxDate){var cur=this.getTimestamp();if(!minDate&&!maxDate)return null;if(minDate&&maxDate)return(cur<minDate.getTimestamp()||cur>maxDate.getTimestamp());if(!maxDate)return(cur<minDate.getTimestamp());if(!minDate)return(cur>maxDate.getTimestamp());}
this.isBefore=function(date){if(date===undefined||date===null)return null;return(this.getTimestamp()<date.getTimestamp())?true:false;}
this.isEqual=function(date){if(date===undefined||date===null)return null;return(this.getTimestamp()===date.getTimestamp())?true:false;}
this.isAfter=function(date){if(date===undefined||date===null)return null;return(this.getTimestamp()>date.getTimestamp())?true:false;}
this.asFormattedString=function(format,seperator){if(!this._date)return null;var format=format||IAJS.CONFIG.defaultDateFormat;var sep=(seperator)?seperator:"-";var ret=null;switch(format){case IAJS.CONFIG.dateFormat.iso:ret=this.getYear()+sep+this.getMonth()+sep+this.getDay();break;case IAJS.CONFIG.dateFormat.american:ret=this.getMonth()+sep+this.getDay()+sep+this.getYear();break;case IAJS.CONFIG.dateFormat.euro:ret=this.getDay()+sep+this.getMonth()+sep+this.getYear();default:}
return ret;}
this.toReadableDate=function(formatString){d=this._date;var functions={DayName:function(d,f){return LOCALIZE.days[f('w')];},MonthName:function(d,f){return LOCALIZE.month[f('n')-1];}}
return d.format(formatString,functions);}
this._setDate=function(arr,sequence){d=(arr[sequence[0]])?this._makeDay(arr[sequence[0]]):false;m=(arr[sequence[1]])?this._makeMonth(arr[sequence[1]]):false;y=this._makeYear(arr[sequence[2]]);if(this._isLeapYear(y))this.monthArray[1]=29;if(d>this.monthArray[m-1])d=false;this._date=(d&&m&&y)?new Date(y,m-1,d):false;}
this._makeDay=function(str){if(str.length>2)return false;d=str*1;if(d<1||d>31)return false;return d;}
this._makeMonth=function(str){if(str.length>2)return false;m=str*1;if(m<1||m>12)return false;return m;}
this._makeYear=function(str){var year=str||new Date().getUTCFullYear();if(year&&year.length<4)year="2".pad(4-year.length,"0",1)+year;return year;}
this.isValidFormat=function(){}
this._doFormat=function(){val=this.dateString.replace(/^[\s]+/,"");return val.split(/[\s\.,\/\+_,:=\-]+/);}
this._isLeapYear=function(y){return(((y%4==0)&&(y%100!=0))||(y%400==0))?true:false;}}
function Response(){};Response.clear=function(response)
{if(response.hasChildNodes())
response.removeChild(response.firstChild);}
Response.set=function(response,cls,msg)
{Response.clear(response);Response.add(response,cls,msg)}
Response.add=function(response,cls,msg)
{if(cls=="error")cls="fieldError";var newdiv=document.createElement(response.tagName);YAHOO.util.dom.addClass(newdiv,cls);newdiv.innerHTML=msg;if(response.hasChildNodes())
response.replaceChild(newdiv,response.firstChild);else
response.appendChild(newdiv);YAHOO.util.Dom.addClass(newdiv,cls);}
HandlerHelper=function(){};HandlerHelper.getAttr=function(elattr,keyname){if(!elattr||elattr.length<=0)return"";var arr;if(elattr.indexOf(",")>-1){arr=elattr.split(",")}else{arr=[elattr];}
for(var i=0;i<arr.length;i++)
{var key=arr[i].split("=")[0];var val=arr[i].split("=")[1];if(key==keyname)
return val;}
return"";}
HandlerHelper.isInViewport=function(el){var $D=YAHOO.util.Dom;var viewportRegion=new YAHOO.util.Region(0,$D.getViewportWidth(),$D.getViewportHeight(),0);var elementRegion=new $D.getRegion(el);return viewportRegion.contains(elementRegion);}
listManager=function(){this.listArray=new Object;this.add=function(obj){grId="group_"+obj.id
if(!listArray[grId]){switch(obj.objectType){case"Checkbox":group=new IAJS.CONTROLLER.CheckBoxList(grId);break;case"Radio":group=new IAJS.CONTROLLER.RadioList(grId);break;}
listArray[grId]=group;}
listArray[grId].add(obj);}}
IAJS.RESPONSE={OK:1,INVALID:2,FALLTHROUGH:4,INVALIDFORMAT:8,OUTOFRANGE:16,TOHIGH:32,TOLOW:64,MANDATORY:128,EMPTY:256};IAJS.RESPONSE.TEXT={TOLONG:8};IAJS.RESPONSE.NUMBER={NO_FLOAT:8,EXCEED_DECIMAL:16};IAJS.VALIDATION.date=function(date,mindate,maxdate){if(date.length==0)return IAJS.RESPONSE.FALLTHROUGH;var dateStamp=IAJS.VALIDATION.isDate(date.toStructuredDate());if(dateStamp==IAJS.RESPONSE.INVALID||isNaN(dateStamp.getTime()))return IAJS.RESPONSE.INVALID;if(mindate!=undefined&&mindate!=""&&mindate!=null){var minStamp=IAJS.VALIDATION.isDate(mindate.toStructuredDate());var minCompare=(minStamp==IAJS.RESPONSE.INVALID||isNaN(minStamp.getTime()))?-2:dateStamp>=minStamp;if(!minCompare)return IAJS.RESPONSE.TOLOW;}
if(maxdate!=undefined&&maxdate!=""&&maxdate!=null){var maxStamp=IAJS.VALIDATION.isDate(maxdate.toStructuredDate());var maxCompare=(maxStamp==IAJS.RESPONSE.INVALID||isNaN(maxStamp.getTime()))?-2:dateStamp<=maxStamp;if(!maxCompare)return IAJS.RESPONSE.TOHIGH;}
return IAJS.RESPONSE.OK;}
IAJS.VALIDATION.dateDiff=function(date,dateDiff,minDiff,maxDiff){if(!date||!dateDiff||!(minDiff||maxDiff))return IAJS.RESPONSE.FALLTHROUGH;var date1=date.toStructuredDate().toStructuredDateArray();var date2=dateDiff.toStructuredDate().toStructuredDateArray();var yearCalc=date1[2]-date2[2];var monthCalc=date1[1]-date2[1]+(date1[2]-date2[2])*12;var dayCalc=IAJS.VALIDATION.dateDiffCalc(date,dateDiff);if(minDiff){if((/[^0-9|d|m|y]+/).test(minDiff))return IAJS.RESPONSE.INVALIDFORMAT;var yearsDiff=minDiff.match(/(\d+)y/);var monthsDiff=minDiff.match(/(\d+)m/);var daysDiff=minDiff.match(/(\d+)d/);if(yearsDiff&&(yearCalc<yearsDiff[1]))return IAJS.RESPONSE.TOLOW;if(monthsDiff&&(monthCalc<monthsDiff[1]))return IAJS.RESPONSE.TOLOW;if(daysDiff&&(dayCalc<daysDiff[1]))return IAJS.RESPONSE.TOLOW;}
if(maxDiff){if((/[^0-9|d|m|y]+/).test(maxDiff))return IAJS.RESPONSE.INVALIDFORMAT;var yearsDiff=maxDiff.match(/(\d+)y/);var monthsDiff=maxDiff.match(/(\d+)m/);var daysDiff=maxDiff.match(/(\d+)d/);if(yearsDiff&&(yearCalc>yearsDiff[1]))return IAJS.RESPONSE.TOHIGH;if(monthsDiff&&(monthCalc>monthsDiff[1]))return IAJS.RESPONSE.TOHIGH;if(daysDiff&&(dayCalc>daysDiff[1]))return IAJS.RESPONSE.TOHIGH;}
return IAJS.RESPONSE.OK;}
IAJS.VALIDATION.dateDiffCalc=function(date1,date2){var date1=date1.toStructuredDateArray();var date2=date2.toStructuredDateArray();date1=new Date(date1[2],date1[1],date1[0]);date2=new Date(date2[2],date2[1],date2[0]);var diff=new Date();diff.setTime(Math.abs(date1.getTime()-date2.getTime()));var days=Math.floor(diff.getTime()/(1000*60*60*24));return days;}
IAJS.VALIDATION.time=function(time,mintime,maxtime){if(time.length==0)return IAJS.RESPONSE.FALLTHROUGH;var timeStamp=IAJS.VALIDATION.isTime(time.toStructuredTime());if(timeStamp==IAJS.RESPONSE.INVALID||isNaN(timeStamp.getTime()))return IAJS.RESPONSE.INVALID;if(mintime!=undefined&&mintime!=""&&mintime!=null){var minStamp=IAJS.VALIDATION.isTime(mintime.toStructuredTime());var minCompare=(minStamp==IAJS.RESPONSE.INVALID||isNaN(minStamp.getTime()))?-2:timeStamp.getTime()>=minStamp.getTime();if(!minCompare)return IAJS.RESPONSE.OUTOFRANGE;}
if(maxtime!=undefined&&maxtime!=""&&maxtime!=null){var maxStamp=IAJS.VALIDATION.isTime(maxtime.toStructuredTime());var maxCompare=(maxStamp==IAJS.RESPONSE.INVALID||isNaN(maxStamp.getTime()))?-2:timeStamp.getTime()<=maxStamp.getTime();if(!maxCompare)return IAJS.RESPONSE.OUTOFRANGE;}
return IAJS.RESPONSE.OK;}
IAJS.VALIDATION.timeRange=function(time,timeDiff,minDiff,maxDiff){if(!time||!timeDiff||!(minDiff||maxDiff))return IAJS.RESPONSE.INVALIDFORMAT;var t1=time.toStructuredTime(true);var t2=timeDiff.toStructuredTime(true);IAJS.log("IAJS.VALIDATION.timeRange "+t1+", "+t2,"info",IAJS.RESOURCE.log.VALIDATION);var diff=Date.UTC(0,0,1,t2[0],t2[1],t2[2],0)-Date.UTC(0,0,1,t1[0],t1[1],t1[2],0);if(minDiff){if(minDiff.charAt(0)=="+"||minDiff.charAt(0)=="-"){var t=minDiff.substr(1).toStructuredTime(true);var td=Date.UTC(0,0,1,t[0],t[1],t[2],0)-Date.UTC(0,0,1,0,0,0,0);if(minDiff.charAt(0)=="+"){if(Math.abs(diff)<td||(td-diff)<0)return IAJS.RESPONSE.OUTOFRANGE;}else{if(Math.abs(diff)<td||(td-diff)>0)return IAJS.RESPONSE.OUTOFRANGE;}}else{var t=minDiff.toStructuredTime(true);var td=Date.UTC(0,0,1,t[0],t[1],t[2],0)-Date.UTC(0,0,1,0,0,0,0);if(Math.abs(diff)<td)return IAJS.RESPONSE.OUTOFRANGE;}}
if(maxDiff){if(maxDiff.charAt(0)=="+"||maxDiff.charAt(0)=="-"){var t=maxDiff.substr(1).toStructuredTime(true);var td=Date.UTC(0,0,1,t[0],t[1],t[2],0)-Date.UTC(0,0,1,0,0,0,0);if(maxDiff.charAt(0)=="+"){if(Math.abs(diff)>td||(td-diff)<0)return IAJS.RESPONSE.OUTOFRANGE;}else{if(Math.abs(diff)>td||(td-diff)>0)return IAJS.RESPONSE.OUTOFRANGE;}}else{var t=maxDiff.toStructuredTime(true);var td=Date.UTC(0,0,1,t[0],t[1],t[2],0)-Date.UTC(0,0,1,0,0,0,0);if(Math.abs(diff)<td)return IAJS.RESPONSE.OUTOFRANGE;}}
return IAJS.RESPONSE.OK;}
IAJS.VALIDATION.email=function(email)
{if(email.length==0)return IAJS.RESPONSE.FALLTHROUGH;var val=(/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\.\/0-9=?A-Z^_`a-z{|}~]+$/).test(email);return(val)?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.url=function(url,allowedShemes)
{if(!url||url.length==0)return IAJS.RESPONSE.FALLTHROUGH;var shemes=(allowedShemes)?allowedShemes.replace(/,\s*/gi,"|"):"https|http|ftp";var checkUrl=new RegExp("^("+shemes+"):\/\/([a-zA-Z0-9\\.]+?)(\\.[a-zA-Z]{2,3})(\:[0-9]{2,5})?(\/[a-zA-Z0-9_\?=&;\%\"\.\+-\:]*)*$");return(checkUrl.test(url))?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.vat=function(countryCode,vatCode){if(vatCode.length==0)return IAJS.RESPONSE.FALLTHROUGH;if(countryCode.length==0&&vatCode.length)return IAJS.RESPONSE.FALLTHROUGH;switch(countryCode){case"BE":return IAJS.VALIDATION.vatBE(vatCode);break;case"NL":return IAJS.VALIDATION.vatNL(vatCode);break;case"UK":return IAJS.VALIDATION.vatGB(vatCode);break;default:return IAJS.RESPONSE.INVALID;}}
IAJS.VALIDATION.vatBE=function(vatCode){vatCode=vatCode.removeSeperators();if(!(/^(0\d{9}|\d{9})$/).test(vatCode))return IAJS.RESPONSE.INVALID;if(vatCode.length==9){return(IAJS.VALIDATION.doMod(vatCode.substring(0,7),vatCode.substring(7),97))?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;;}else{return(IAJS.VALIDATION.doMod(vatCode.substring(0,8),vatCode.substring(8),97))?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;;}}
IAJS.VALIDATION.vatNL=function(vatCode){vatCode=vatCode.removeSeperators();return IAJS.RESPONSE.FALLTHROUGH;}
IAJS.VALIDATION.vatGB=function(vat){vat=vat.removeSeperators();return IAJS.RESPONSE.FALLTHROUGH;}
IAJS.VALIDATION.bankaccount=function(countryCode,bankaccountNumber){if(bankaccountNumber.length==0)return IAJS.RESPONSE.FALLTHROUGH;if(countryCode.length==0&&bankCode.length)return IAJS.RESPONSE.FALLTHROUGH;switch(countryCode){case"BE":IAJS.log("validate belgian bankaccount ","info",IAJS.RESOURCE.log.VALIDATION);return IAJS.VALIDATION.bankBE(bankaccountNumber);break;default:return IAJS.RESPONSE.FALLTHROUGH;}}
IAJS.VALIDATION.bankBE=function(bankaccountNumber){bankaccountNumber=bankaccountNumber.removeSeperators();if(!(/^\d{12}$/).test(bankaccountNumber))return IAJS.RESPONSE.INVALID;var val=IAJS.VALIDATION.doMod(bankaccountNumber.substring(0,10),bankaccountNumber.substring(10),false);return(val)?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.telephone=function(countryCode,phonenumber)
{if(phonenumber.length==0||countryCode.length==0)return IAJS.RESPONSE.FALLTHROUGH;switch(countryCode){case"BE":return IAJS.VALIDATION.telephoneBE(phonenumber);default:return IAJS.VALIDATION.telephoneBasic(phonenumber);}}
IAJS.VALIDATION.telephoneBE=function(phonenumber)
{if(phonenumber.length==0)return IAJS.RESPONSE.FALLTHROUGH;phonenumber=phonenumber.replace(/^\+/g,"");phonenumber=phonenumber.replace(/([\\\/\.\-\(\)\s,])/ig,"");var val=(/^[0-9]{3,18}$/).test(phonenumber);return(val)?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.telephoneBasic=function(phonenumber)
{if(phonenumber.length==0)return IAJS.RESPONSE.FALLTHROUGH;phonenumber=phonenumber.replace(/^\+/g,"");phonenumber=phonenumber.replace(/([\\\/\.\-\(\)\s,])/ig,"");var val=(/^[0-9]{3,18}$/).test(phonenumber);return(val)?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.niss=function(nissNumber){if(nissNumber.length==0)return IAJS.RESPONSE.FALLTHROUGH;nissNumber=nissNumber.removeSeperators();if(!(/^\d{11}$/).test(nissNumber))return IAJS.RESPONSE.INVALID;var val=IAJS.VALIDATION.doMod(nissNumber.substring(0,9),nissNumber.substring(9),97);return(val)?IAJS.RESPONSE.OK:IAJS.RESPONSE.INVALID;}
IAJS.VALIDATION.isDate=function(date)
{var date_arr=date.split("-");var day=date_arr[0];var month=date_arr[1];var year=date_arr[2];if(month<1||month>12)return IAJS.RESPONSE.INVALID;if(day<1||day>31)return IAJS.RESPONSE.INVALID;if(month==2){if(((year%4==0)&&(year%100!=0))||(year%400==0)){if(day>29)return IAJS.RESPONSE.INVALID;}
else{if(day>28)return IAJS.RESPONSE.INVALID;}}
if((month==4)||(month==6)||(month==9)||(month==11)){if(day>30)return IAJS.RESPONSE.INVALID;}
return new Date(year,month,day);}
IAJS.VALIDATION.isTime=function(time)
{if(!time||time.length==0)return IAJS.RESPONSE.INVALID;var time_arr=time.split(":");var hour=time_arr[0];var minute=time_arr[1];var second=time_arr[2];if(hour<0||hour>23)
return IAJS.RESPONSE.INVALID;if(minute<0||minute>59)
return IAJS.RESPONSE.INVALID;if(second<0||second>59)
return IAJS.RESPONSE.INVALID;return new Date(1970,1,1,hour,minute,second);}
IAJS.VALIDATION.number=function(number,min,max,decimals){if(number.length==0)return IAJS.RESPONSE.FALLTHROUGH;number=number.replace(/^\s+/,"");number=number.replace(/\s+$/,"");result=number.match(/^[-|+]?(\d*)([\.|,]?\d+)$/);if(result==null)return IAJS.RESPONSE.INVALID;number=number.replace(",",".");number=Number(number);if(number==Number.NaN)return IAJS.RESPONSE.INVALID;if(min&&number<Number(min))return IAJS.RESPONSE.TOLOW;if(max&&number>Number(max))return IAJS.RESPONSE.TOHIGH;if(decimals&&result.length>2&&result[2].length-1>Number(decimals)){return(decimals>0)?IAJS.RESPONSE.NUMBER.EXCEED_DECIMAL:IAJS.RESPONSE.NUMBER.NO_FLOAT;}
return IAJS.RESPONSE.OK;}
IAJS.VALIDATION.doMod=function(number,control,extractor){if(!IAJS.VALIDATION.isInteger(number))return false;if(!IAJS.VALIDATION.isInteger(control))return false;var check=(extractor)?extractor-number%97:number%97;return(control==check)?true:false;};IAJS.VALIDATION.isInteger=function(str){return(/^\d+$/).test(str);};IAJS.VALIDATION.textarea=function(str,maxlength){if(maxlength&&str.length>maxlength)return IAJS.RESPONSE.TEXT.TOLONG;return IAJS.RESPONSE.OK;};IAJS.CONTROLLER.VatBase=function(node){this.node=node;this.insideForm=true;this.objectType="VatBase";}
YAHOO.extend(IAJS.CONTROLLER.VatBase,IAJS.CONTROLLER.BaseController);IAJS.CONTROLLER.VatBase.prototype.init=function(node){this.node=node;if(this.node){this.input=YAHOO.util.Dom.getElementsByClassName("textfield","input",this.node)[0];this.initAttribute();this.response=this.getResponse(this.input.id);if(this.hasResponse()){YAHOO.util.Event.on(this.input,"blur",this.validate,this,true);}}}
IAJS.CONTROLLER.VatBase.prototype.getCountry=function(){};IAJS.CONTROLLER.VatBase.prototype.hookAfterInit=function(){this.validate();};IAJS.CONTROLLER.VatBase.prototype.validate=function(){this.validationCode=IAJS.VALIDATION.vat(this.getCountry(),this.input.value);if(this.hasResponse()){this.responseAction()};};IAJS.CONTROLLER.VatBase.prototype.responseAction=function(){switch(this.validationCode){case IAJS.RESPONSE.OK:Response.clear(this.response);break;case IAJS.RESPONSE.INVALID:Response.set(this.response,"error",LOCALIZE.messages.VAT_INVALID);break;case IAJS.RESPONSE.FALLTHROUGH:default:Response.clear(this.response);}};IAJS.CONTROLLER.VatBase.prototype.getCheckInsideForm=function(){return true;}
YAHOO.Tools=function(){keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";regExs={quotes:/\x22/g,startspace:/^\s+/g,endspace:/\s+$/g,striptags:/<\/?[^>]+>/gi,hasbr:/<br/i,hasp:/<p>/i,rbr:/<br>/gi,rbr2:/<br\/>/gi,rendp:/<\/p>/gi,rp:/<p>/gi,base64:/[^A-Za-z0-9\+\/\=]/g,syntaxCheck:/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/}
jsonCodes={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'}
return{version:'1.0'}}();YAHOO.Tools.getHeight=function(elm){var elm=$(elm);var h=$D.getStyle(elm,'height');if(h=='auto'){elm.style.zoom=1;h=elm.clientHeight+'px';}
return h;}
YAHOO.Tools.getCenter=function(elm){var elm=$(elm);var cX=Math.round(($D.getViewportWidth()-parseInt($D.getStyle(elm,'width')))/2);var cY=Math.round(($D.getViewportHeight()-parseInt(this.getHeight(elm)))/2);return[cX,cY];}
YAHOO.Tools.makeTextObject=function(txt){return document.createTextNode(txt);}
YAHOO.Tools.makeChildren=function(arr,elm){var elm=$(elm);for(var i in arr){_val=arr[i];if(typeof _val=='string'){_val=this.makeTxtObject(_val);}
elm.appendChild(_val);}}
YAHOO.Tools.styleToCamel=function(str){var _tmp=str.split('-');var _new_style=_tmp[0];for(var i=1;i<_tmp.length;i++){_new_style+=_tmp[i].substring(0,1).toUpperCase()+_tmp[i].substring(1,_tmp[i].length);}
return _new_style;}
YAHOO.Tools.removeQuotes=function(str){var checkText=new String(str);return String(checkText.replace(regExs.quotes,''));}
YAHOO.Tools.trim=function(str){return str.replace(regExs.startspace,'').replace(regExs.endspace,'');}
YAHOO.Tools.stripTags=function(str){return str.replace(regExs.striptags,'');}
YAHOO.Tools.hasBRs=function(str){return str.match(regExs.hasbr)||str.match(regExs.hasp);}
YAHOO.Tools.convertBRs2NLs=function(str){return str.replace(regExs.rbr,"\n").replace(regExs.rbr2,"\n").replace(regExs.rendp,"\n").replace(regExs.rp,"");}
YAHOO.Tools.stringRepeat=function(str,repeat){return new Array(repeat+1).join(str);}
YAHOO.Tools.stringReverse=function(str){var new_str='';for(i=0;i<str.length;i++){new_str=new_str+str.charAt((str.length-1)-i);}
return new_str;}
YAHOO.Tools.printf=function(){var num=arguments.length;var oStr=arguments[0];for(var i=1;i<num;i++){var pattern="\\{"+(i-1)+"\\}";var re=new RegExp(pattern,"g");oStr=oStr.replace(re,arguments[i]);}
return oStr;}
YAHOO.Tools.setStyleString=function(el,str){var _tmp=str.split(';');for(x in _tmp){if(x){__tmp=YAHOO.Tools.trim(_tmp[x]);__tmp=_tmp[x].split(':');if(__tmp[0]&&__tmp[1]){var _attr=YAHOO.Tools.trim(__tmp[0]);var _val=YAHOO.Tools.trim(__tmp[1]);if(_attr&&_val){if(_attr.indexOf('-')!=-1){_attr=YAHOO.Tools.styleToCamel(_attr);}
$D.setStyle(el,_attr,_val);}}}}}
YAHOO.Tools.getSelection=function(_document,_window){if(!_document){_document=document;}
if(!_window){_window=window;}
if(_document.selection){return _document.selection;}
return _window.getSelection();}
YAHOO.Tools.removeElement=function(el){if(!(el instanceof Array)){el=new Array($(el));}
for(var i=0;i<el.length;i++){if(el[i].parentNode){el[i].parentNode.removeChild(el);}}}
YAHOO.Tools.setCookie=function(name,value,expires,path,domain,secure){var argv=arguments;var argc=arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:'/';var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;document.cookie=name+"="+escape(value)+
((expires==null)?"":("; expires="+expires.toGMTString()))+
((path==null)?"":("; path="+path))+
((domain==null)?"":("; domain="+domain))+
((secure==true)?"; secure":"");}
YAHOO.Tools.getCookie=function(name){var dc=document.cookie;var prefix=name+'=';var begin=dc.indexOf('; '+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else{begin+=2;}
var end=document.cookie.indexOf(';',begin);if(end==-1){end=dc.length;}
return unescape(dc.substring(begin+prefix.length,end));}
YAHOO.Tools.deleteCookie=function(name,path,domain){if(getCookie(name)){document.cookie=name+'='+((path)?'; path='+path:'')+((domain)?'; domain='+domain:'')+'; expires=Thu, 01-Jan-70 00:00:01 GMT';}}
YAHOO.Tools.getBrowserEngine=function(){var opera=((window.opera&&window.opera.version)?true:false);var safari=((navigator.vendor&&navigator.vendor.indexOf('Apple')!=-1)?true:false);var gecko=((document.getElementById&&!document.all&&!opera&&!safari)?true:false);var msie=((window.ActiveXObject)?true:false);var version=false;if(msie){if(typeof document.body.style.maxHeight!="undefined"){version='7';}else{version='6';}}
if(opera){var tmp_version=window.opera.version().split('.');version=tmp_version[0]+'.'+tmp_version[1];}
if(gecko){if(navigator.registerContentHandler){version='2';}else{version='1.5';}
if((navigator.vendorSub)&&!version){version=navigator.vendorSub;}}
if(safari){try{if(console){if((window.onmousewheel!=='undefined')&&(window.onmousewheel===null)){version='2';}else{version='1.3';}}}catch(e){version='1.2';}}
var browsers={ua:navigator.userAgent,opera:opera,safari:safari,gecko:gecko,msie:msie,version:version}
return browsers;}
YAHOO.Tools.getBrowserAgent=function(){var ua=navigator.userAgent.toLowerCase();var opera=((ua.indexOf('opera')!=-1)?true:false);var safari=((ua.indexOf('safari')!=-1)?true:false);var firefox=((ua.indexOf('firefox')!=-1)?true:false);var msie=((ua.indexOf('msie')!=-1)?true:false);var mac=((ua.indexOf('mac')!=-1)?true:false);var unix=((ua.indexOf('x11')!=-1)?true:false);var win=((mac||unix)?false:true);var version=false;var mozilla=false;if(!firefox&&!safari&&(ua.indexOf('gecko')!=-1)){mozilla=true;var _tmp=ua.split('/');version=_tmp[_tmp.length-1].split(' ')[0];}
if(firefox){var _tmp=ua.split('/');version=_tmp[_tmp.length-1].split(' ')[0];}
if(msie){version=ua.substring((ua.indexOf('msie ')+5)).split(';')[0];}
if(safari){version=this.getBrowserEngine().version;}
if(opera){version=ua.substring((ua.indexOf('opera/')+6)).split(' ')[0];}
var browsers={ua:navigator.userAgent,opera:opera,safari:safari,firefox:firefox,mozilla:mozilla,msie:msie,mac:mac,win:win,unix:unix,version:version}
return browsers;}
YAHOO.Tools.checkFlash=function(){var br=this.getBrowserEngine();if(br.msie){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");var versionStr=axo.GetVariable("$version");var tempArray=versionStr.split(" ");var tempString=tempArray[1];var versionArray=tempString.split(",");var flash=versionArray[0];}catch(e){}}else{var flashObj=null;var tokens,len,curr_tok;if(navigator.mimeTypes&&navigator.mimeTypes['application/x-shockwave-flash']){flashObj=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;}
if(flashObj==null){flash=false;}else{tokens=navigator.plugins['Shockwave Flash'].description.split(' ');len=tokens.length;while(len--){curr_tok=tokens[len];if(!isNaN(parseInt(curr_tok))){hasVersion=curr_tok;flash=hasVersion;break;}}}}
return flash;}
YAHOO.Tools.setAttr=function(attrsObj,elm){if(typeof elm=='string'){elm=$(elm);}
for(var i in attrsObj){switch(i.toLowerCase()){case'listener':if(attrsObj[i]instanceof Array){var ev=attrsObj[i][0];var func=attrsObj[i][1];var base=attrsObj[i][2];var scope=attrsObj[i][3];$E.addListener(elm,ev,func,base,scope);}
break;case'classname':case'class':elm.className=attrsObj[i];break;case'style':YAHOO.Tools.setStyleString(elm,attrsObj[i]);break;default:elm.setAttribute(i,attrsObj[i]);break;}}}
YAHOO.Tools.create=function(tagName){tagName=tagName.toLowerCase();elm=document.createElement(tagName);var txt=false;var attrsObj=false;if(!elm){return false;}
for(var i=1;i<arguments.length;i++){txt=arguments[i];if(typeof txt=='string'){_txt=YAHOO.Tools.makeTextObject(txt);elm.appendChild(_txt);}else if(txt instanceof Array){YAHOO.Tools.makeChildren(txt,elm);}else if(typeof txt=='object'){YAHOO.Tools.setAttr(txt,elm);}}
return elm;}
YAHOO.Tools.insertAfter=function(elm,curNode){if(curNode.nextSibling){curNode.parentNode.insertBefore(elm,curNode.nextSibling);}else{curNode.parentNode.appendChild(elm);}}
YAHOO.Tools.inArray=function(arr,val){if(arr instanceof Array){for(var i=(arr.length-1);i>=0;i--){if(arr[i]===val){return true;}}}
return false;}
YAHOO.Tools.checkBoolean=function(str){return((typeof str=='boolean')?true:false);}
YAHOO.Tools.checkNumber=function(str){return((isNaN(str))?false:true);}
YAHOO.Tools.PixelToEm=function(size){var data={};var sSize=(size/13);data.other=(Math.round(sSize*100)/100);data.msie=(Math.round((sSize*0.9759)*100)/100);return data;}
YAHOO.Tools.PixelToEmStyle=function(size,prop){var data='';var prop=((prop)?prop.toLowerCase():'width');var sSize=(size/13);data+=prop+':'+(Math.round(sSize*100)/100)+'em;';data+='*'+prop+':'+(Math.round((sSize*0.9759)*100)/100)+'em;';if((prop=='width')||(prop=='height')){data+='min-'+prop+':'+size+'px;';}
return data;}
YAHOO.Tools.base64Encode=function(str){var data="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;do{chr1=str.charCodeAt(i++);chr2=str.charCodeAt(i++);chr3=str.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
data=data+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4);}while(i<str.length);return data;}
YAHOO.Tools.base64Decode=function(str){var data="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;str=str.replace(regExs.base64,"");do{enc1=keyStr.indexOf(str.charAt(i++));enc2=keyStr.indexOf(str.charAt(i++));enc3=keyStr.indexOf(str.charAt(i++));enc4=keyStr.indexOf(str.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;data=data+String.fromCharCode(chr1);if(enc3!=64){data=data+String.fromCharCode(chr2);}
if(enc4!=64){data=data+String.fromCharCode(chr3);}}while(i<str.length);return data;}
YAHOO.Tools.getQueryString=function(str){var qstr={};if(!str){var str=location.href.split('?');if(str.length!=2){str=['',location.href];}}else{var str=['',str];}
if(str[1].match('#')){var _tmp=str[1].split('#');qstr.hash=_tmp[1];str[1]=_tmp[0];}
if(str[1]){str=str[1].split('&');if(str.length){for(var i=0;i<str.length;i++){var part=str[i].split('=');if(part[0].indexOf('[')!=-1){if(part[0].indexOf('[]')!=-1){var arr=part[0].substring(0,part[0].length-2);if(!qstr[arr]){qstr[arr]=[];}
qstr[arr][qstr[arr].length]=part[1];}else{var arr=part[0].substring(0,part[0].indexOf('['));var data=part[0].substring((part[0].indexOf('[')+1),part[0].indexOf(']'));if(!qstr[arr]){qstr[arr]={};}
qstr[arr][data]=part[1];}}else{qstr[part[0]]=part[1];}}}}
return qstr;}
YAHOO.Tools.getQueryStringVar=function(str){var qs=this.getQueryString();if(qs[str]){return qs[str];}else{return false;}}
YAHOO.Tools.padDate=function(n){return n<10?'0'+n:n;}
YAHOO.Tools.encodeStr=function(str){if(/["\\\x00-\x1f]/.test(str)){return'"'+str.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=jsonCodes[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"';}
return'"'+str+'"';}
YAHOO.Tools.encodeArr=function(arr){var a=['['],b,i,l=arr.length,v;for(i=0;i<l;i+=1){v=arr[i];switch(typeof v){case'undefined':case'function':case'unknown':break;default:if(b){a.push(',');}
a.push(v===null?"null":YAHOO.Tools.JSONEncode(v));b=true;}}
a.push(']');return a.join('');}
YAHOO.Tools.encodeDate=function(d){return'"'+d.getFullYear()+'-'+YAHOO.Tools.padDate(d.getMonth()+1)+'-'+YAHOO.Tools.padDate(d.getDate())+'T'+YAHOO.Tools.padDate(d.getHours())+':'+YAHOO.Tools.padDate(d.getMinutes())+':'+YAHOO.Tools.padDate(d.getSeconds())+'"';}
YAHOO.Tools.fixJSONDate=function(dateStr){var tmp=dateStr.split('T');var fixedDate=dateStr;if(tmp.length==2){var tmpDate=tmp[0].split('-');if(tmpDate.length==3){fixedDate=new Date(tmpDate[0],(tmpDate[1]-1),tmpDate[2]);var tmpTime=tmp[1].split(':');if(tmpTime.length==3){fixedDate.setHours(tmpTime[0],tmpTime[1],tmpTime[2]);}}}
return fixedDate;}
YAHOO.Tools.JSONEncode=function(o){if((typeof o=='undefined')||(o===null)){return'null';}else if(o instanceof Array){return YAHOO.Tools.encodeArr(o);}else if(o instanceof Date){return YAHOO.Tools.encodeDate(o);}else if(typeof o=='string'){return YAHOO.Tools.encodeStr(o);}else if(typeof o=='number'){return isFinite(o)?String(o):"null";}else if(typeof o=='boolean'){return String(o);}else{var a=['{'],b,i,v;for(var i in o){v=o[i];switch(typeof v){case'undefined':case'function':case'unknown':break;default:if(b){a.push(',');}
a.push(YAHOO.Tools.JSONEncode(i),':',((v===null)?"null":YAHOO.Tools.JSONEncode(v)));b=true;}}
a.push('}');return a.join('');}}
YAHOO.Tools.JSONParse=function(json,autoDate){var autoDate=((autoDate)?true:false);try{if(regExs.syntaxCheck.test(json)){var j=eval('('+json+')');if(autoDate){function walk(k,v){if(v&&typeof v==='object'){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i]);}}}
if(k.toLowerCase().indexOf('date')>=0){return YAHOO.Tools.fixJSONDate(v);}else{return v;}}
return walk('',j);}else{return j;}}}catch(e){console.log(e);}
throw new SyntaxError("parseJSON");}
YAHOO.tools=YAHOO.Tools;YAHOO.TOOLS=YAHOO.Tools;YAHOO.util.Dom.create=YAHOO.Tools.create;$A=YAHOO.util.Anim;$E=YAHOO.util.Event;$D=YAHOO.util.Dom;$T=YAHOO.Tools;$=YAHOO.util.Dom.get;$$=YAHOO.util.Dom.getElementsByClassName;var IA=(function(){return{bootstrap:function(){var nodes,node,i,j,eltype;nodes=YAHOO.util.Dom.getElementsBy(function(el){return el.getAttribute("eltype");});for(j=0;j<nodes.length;j++){node=nodes[j];var eltype=node.getAttribute("eltype");var eltypeNs=eltype.match(/(.+)?:(.+)/);if(eltypeNs==null){controllerName='IAJS.CONTROLLER.'+eltype.capitalize().camelize();}else{controllerName=eltypeNs[1]+"."+eltypeNs[2].capitalize().camelize();}
try{var controller=eval("new "+controllerName+"(node)");controller.init();IAJS.controllerManager.add(controller);IAJS.formManager.register(controller);controller.hookAfterInit();}catch(ex){}}
try{for(var i in IAJS.controllerCollection){IAJS.controllerManager.initMaster(IAJS.controllerCollection[i]);IAJS.controllerManager.initSubordinate(IAJS.controllerCollection[i]);}}catch(e){}}}})();YAHOO.util.Event.onDOMReady(IA.bootstrap);
