dp_common={modalData:{height:460,width:940,rendering:"fadeIn",baseZIndex:500,stack:[],opacity:0.5},linkedFormsTree:{linkedFormsGroups:{defaultGroup:new Array()},linkedFormsGroupsNum:0},doModal:function(g,c,l,m,e){if(l.div){m=l.height;e=l.width;l=l.div}var a=jQuery(l);var h=jQuery('<input type="text"/>');h.css("position","absolute").css("top","-666px").css("left","-666px").css("height","0px").css("width","0px").css("background","#fff").css("color","#fff").css("border","0px");a.append(h);if(m==null){m=dp_common.modalData.height}if(e==null){e=dp_common.modalData.width}var j=jQuery(window).height();var f=jQuery(window).width();if(Number(m)==m){if(m>j){m=j}var b=""+((j-m)/2)+"px";m=""+m+"px"}else{d=""}if(Number(e)==e){if(e>f){e=f}var d=""+((f-e)/2)+"px";e=""+e+"px"}else{d=""}if(jQuery.browser.msie!=true|parseFloat(jQuery.browser.version)>7){this.waitForNewPage(null,true)}dp_common.modalData.stack.push(a);a.css("z-index",dp_common.modalData.stack.length+dp_common.modalData.baseZIndex);switch(this.modalData.rendering){case"animate":var i=""+(j/2)+"px";var k=""+(f/2)+"px";a.css({display:"",height:"0px",width:"0px",top:i,left:k}).animate({top:b,left:d,height:m,width:e});break;case"fadeIn":a.css({height:m,width:e,display:"none",top:b,left:d}).fadeIn(function(){jQuery(this).css("display","block")});break}a.bind("keydown",function(o){var n=(o.keyCode?o.keyCode:o.which);if(parseInt(n)==27){dp_common.exitModal()}});h.focus()},exitModal:function(d,e){var b=dp_common.modalData.stack.pop();if(b){switch(this.modalData.rendering){case"animate":var a=""+(jQuery(window).height()/2)+"px";var c=""+(jQuery(window).width()/2)+"px";b.animate({height:"0px",width:"0px",top:a,left:c},"linear",function(){jQuery(this).css("display","none");dp_common.resumeThisPage()});break;case"fadeIn":b.fadeOut();break}}if(jQuery.browser.msie!=true|parseFloat(jQuery.browser.version)>7){this.resumeThisPage()}},waitForNewPage:function(g,f,e){var d;if(dp_common.modalData.stack.length!=0){d=dp_common.modalData.stack[dp_common.modalData.stack.length-1]}else{d=jQuery("body")}var c="display:none;";d.append('<div class="gray-layer" style="'+c+'"> </div>');var b=d.children(".gray-layer:last");if(f!=true){b.html("<div ><span> </span></div>")}dp_common.modalData.stack.push(b);if(e==true){var a=0}else{var a=this.modalData.opacity}b.css("z-index",dp_common.modalData.stack.length+dp_common.modalData.baseZIndex).css("opacity",a).fadeIn("fast",g);return true},resumeThisPage:function(){var a=dp_common.modalData.stack.pop();if(a){if(!a.hasClass("gray-layer")){dp_common.modalData.stack.push(a);throw ("Resuming page failed since no wait has been done properly")}a.fadeOut("fast",function(){jQuery(this).remove()})}return true},bindEvent:function(c,d,f,b,a,e){if(e){d.unbind(c)}d.each(function(){jQuery(this).bind(c,function(g){if(b!=null){return b[f](this,g,a)}else{return f(this,g,a)}})})},bindEvents:function(b){for(var a=b.length;a-->0;){var c=b[a];dp_common.bindEvent(c[0],c[1],c[2],c[3],c[4],c[5])}},textFilter:function(e,d,b){e.find(".matchesSearch").each(function(){jQuery(this).replaceWith(jQuery(this).text())});if(d!=""){if(b==null){b=" "}d=d.replace("\\","\\\\").replace("[","\\[").replace("(","\\(");var a=b+":not(:has(*))",c=new RegExp("("+d+")","ig");e.each(function(){var f=this;f.style.display="none";jQuery(a,this).each(function(){var h=jQuery(this).text(),g=h.replace(c,'<span class="matchesSearch">$1</span>');if(g!=h){jQuery(this).html(g);f.style.display=""}})})}else{e.css("display","")}},sortHtml:function(c,d,a){var b=function(g,f){var i=jQuery(d,g).text().toUpperCase(),h=jQuery(d,f).text().toUpperCase();if(a>0){return(i>h)?1:((i<h)?-1:0)}else{return(h>i)?1:((h<i)?-1:0)}};var e=c.children().get();c.children().remove();e.sort(b);jQuery.each(e,function(f,g){c.append(g)})},sortTable:function(a,e,f){var d=f.table,g=f.callback,c=jQuery(a),b=c.hasClass("ascending");dp_common.waitForNewPage(function(){jQuery(".sort",d).removeClass("ascending").removeClass("descending");var h=null,i=c.parent().children().index(a);if(b){h=-1;c.addClass("descending")}else{h=1;c.addClass("ascending")}dp_common.sortHtml(jQuery("tbody",d),"td:eq("+i+")",h);if(typeof(g)=="function"){g(d)}dp_common.resumeThisPage()})},__stripeRows:function(a){a.filter(":even").removeClass("odd").addClass("even");a.filter(":odd").removeClass("even").addClass("odd");a.removeClass("last").removeClass("last");a.filter(":first").addClass("first");a.filter(":last").addClass("last")},stripeTable:function(a,b){var c=jQuery("tbody tr:visible",a);dp_common.__stripeRows(c);return true},stripeList:function(a,b){var c=jQuery(a).children("li:visible");dp_common.__stripeRows(c);return true},validateInput:function(e,b,c){var k=e.getAttribute("wl-validate"),g=e.getAttribute("wl-required"),n=null,l=/^$|([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6})/i,h,f,m,d,a,j;switch(e.tagName.toLowerCase()){case"input":case"textarea":n=e.value;break;case"select":n=e.options[e.selectedIndex].value;break;default:alert(e.tagName)}if(g!=null&&n==""){c.invalid(e);return}switch(k){case"re":h=new RegExp(e.getAttribute("wl-re"));if(n.match(h)){c.valid(e)}else{c.invalid(e)}break;case"email":if(n.match(l)){c.valid(e)}else{c.invalid(e)}break;case"email-list":f=n.split(",");m=true;for(d in f){email=jQuery.trim(f[d]);if(m&&!email.match(l)){c.invalid(e);m=false}}if(m){c.valid(e)}break;case"ip":h=/^$|^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;m=true;if(n.match(h)){j=n.split(".");for(d in j){if(j[d]>255){m=false}}}else{m=false}if(m){c.valid(e)}else{c.invalid(e)}break;case"byte":h=/^$|^(\d{1,3})$/;m=true;if(n.match(h)){if(n>255){m=false}}else{m=false}if(m){c.valid(e)}else{c.invalid(e)}break;case"ns":h=/^$|^[a-z0-9\-\_]+\.([a-z0-9\-\_]+\.)*[a-z0-9\-\_]+\.[a-z]{2,4}(\.[a-z]{2})?$/i;if(n.match(h)){c.valid(e)}else{c.invalid(e)}break;case"aname":h=/^$|^[a-z0-9-\.\*]|^_[a-z0-9-\.\*]/;if(n.match(h)){c.valid(e)}else{c.invalid(e)}break;case"custom":a=e.getAttribute("wl-method");if(c[a](e)){c.valid(e)}else{c.invalid(e)}break;default:return}},delayedValidateInputTimer:-1,delayedValidateInput:function(a,b,c){dp_common.clearValidateInputTimer(a,b);dp_common.delayedValidateInputTimer=setTimeout(function(){dp_common.validateInput2(a,b,c)},2000)},clearValidateInputTimer:function(a,b){if(dp_common.delayedValidateInputTimer!=-1){clearTimeout(dp_common.delayedValidateInputTimer);dp_common.delayedValidateInputTimer=-1}},bindValidation:function(a,d,c){dp_common.debugLog("bindValidation : deprecated method");this.bindEvent("blur",a,"validateInput",this,d);if(c!=null){var b=function(){jQuery(a).each(function(){dp_common.validateInput(this,null,d)})};this.bindEvent("click",c,b)}},getInputValue:function(a,e){var b=a.get(0),d,c;if(b==null){return null}switch(b.tagName.toLowerCase()){case"input":d=b.getAttribute("type");switch(d){case"radio":c=a.filter(":checked").get(0);if(c==null){return""}return c.value;case"checkbox":if(!b.checked){return""}}case"textarea":return b.value;case"select":return b.options[b.selectedIndex].value;default:dp_common.debugLog("Unhandled input tag:"+b.tagName);return null}},getAllInputsValue:function(a){var b=[];a.each(function(){switch(this.tagName.toLowerCase()){case"input":type=this.getAttribute("type");switch(type){case"radio":case"checkbox":if(this.checked){b.push(this.value)}break;default:b.push(this.value)}break;case"textarea":b.push(this.value);break;case"select":b.push(this.options[this.selectedIndex].value);break;default:dp_common.debugLog("Unhandled input tag:"+domInput.tagName)}});return b},setInputValue:function(a,e){var b=a.get(0),d,c;if(b==null){return}switch(b.tagName.toLowerCase()){case"input":d=b.getAttribute("type");switch(d){case"radio":c=a.filter('[value="'+e+'"]').get(0);if(c==null){return}c.checked=true;return;case"checkbox":b.checked=(b.value==e)||e==true;return}case"textarea":b.value=e;return;case"select":c=a.find('option[value="'+e+'"]').get(0);if(c==null){return}c.selected=true;return;default:dp_common.debugLog("Unhandled input tag:"+b.tagName);return}},cleanDomainName:function(a){a=a.replace(/[^\w^\.^-]/g,"");return a},setSelectOptions:function(j,b,a,d,g){var f=j.get(0);if(f==null){return}var c=0;if(f.options.length){c=f.options.length}for(var k=c;k>=0;k--){f.remove(k)}opt={};for(var e=0;e<b.length;e++){opt=document.createElement("option");opt.text=a[e];opt.value=b[e];try{f.add(opt,null)}catch(h){f.options.add(opt,f.selectedIndex)}if(d&&opt.value==d){f.options[e].selected=true}if(g&&g.length>0){jQuery(opt).attr("class",g[e])}}return},createForm:function(e,a,c,f,d){var b={inputDescriptors:e,container:a,submit:c,callback:f,errormsgs:[],formOptions:[],mutualErrMsgClearForm:false,initialize:function(){var g,h;if(dp_common.valorized(d)){this.formOptions=d}for(option in this.formOptions){opval=this.formOptions[option];switch(option){case"clearGroupFormsErrMsgs":if(opval!=false){if(opval=="defaultGroup"){throw ("dp_common::createForm: "+opval+" is not a valid form group TAG")}tree=dp_common.linkedFormsTree.linkedFormsGroups;if(opval===true){opval="defaultGroup";if(tree.defaultGroup.length==0){dp_common.linkedFormsTree.linkedFormsGroupsNum+=1}}this.mutualErrMsgClearForm=opval;if(!dp_common.valorized(tree[opval])){tree[opval]=new Array();dp_common.linkedFormsTree.linkedFormsGroupsNum+=1}(tree[opval]).push(this)}break}}if(this.mutualErrMsgClearForm){allThisMemberSelectors=jQuery(this.container).find(":input");dp_common.bindEvent("focus",allThisMemberSelectors,"clearErrMsgsInMyGroup",this,null,false);allThisMemberLinks=jQuery(this.container).find("a").filter(".pribttn, .link");dp_common.bindEvent("mousedown",allThisMemberLinks,"clearErrMsgsInMyGroup",this,null,false)}for(g in this.inputDescriptors){h=this.inputDescriptors[g];h.name=g;h.selector=jQuery(':input[name="'+g+'"]',a).removeClass("erroneous");jQuery(".error."+g,a).hide();if(h.value!=undefined){dp_common.setInputValue(h.selector,h.value);h.initialValue=new Object(h.value)}if(h.disabled==undefined){h.isEnabled=true}if(h.isEnabled){this.enableInput(g)}else{this.disableInput(g)}dp_common.bindValidation2(h,this);if(h.type=="date"&&jQuery.datepicker!=null){h.selector.datepicker();if(h.yearRange){h.selector.datepicker("option","yearRange",h.yearRange)}else{h.selector.datepicker("option","yearRange","-100:+10")}if(h.format){h.selector.datepicker("option","dateFormat",h.format)}if(h.start){h.selector.datepicker("option","minDate",new Date(h.start,0,1))}if(h.end){h.selector.datepicker("option","maxDate",new Date(h.end,0,1))}}else{if(h.type=="password-check"){h.check=this.inputDescriptors[h.check]}}if(h.textSelected){dp_common.bindEvent("focus",h.selector,"selectedText",this,null,true)}if(h.dummyText){dp_common.setDummyText(h.selector,h.dummyText);h.initialDummyText=new Object(h.dummyText)}}dp_common.bindEvent("click",this.submit,"onSubmit",this,null,true)},signalError:function(h,i,g){if(typeof g=="string"){if(typeof this.errormsgs[g]=="string"){if(this.errormsgs[g].length>0){jQuery(".error."+h,a).html(this.errormsgs[g])}}}jQuery(".error."+h,a).fadeIn();jQuery(':input[name="'+h+'"]',this.container).addClass("erroneous");sCWclass=this.inputDescriptors[h].signalCorrectWithClass;if(dp_common.valorized(sCWclass)){jQuery(':input[name="'+h+'"]',this.container).removeClass(sCWclass)}this.inputDescriptors[h].hasError=true;this.inputDescriptors[h].isEnabled=true;this.showSubmit()},signalCorrect:function(g,h){jQuery(".error."+g,a).fadeOut();jQuery(':input[name="'+g+'"]',this.container).removeClass("erroneous");sCWclass=this.inputDescriptors[g].signalCorrectWithClass;if(dp_common.valorized(sCWclass)&&sCWclass!=false){if(!jQuery(':input[name="'+g+'"]',this.container).hasClass(sCWclass)){jQuery(':input[name="'+g+'"]',this.container).addClass(sCWclass)}}this.inputDescriptors[g].hasError=false;this.inputDescriptors[g].isEnabled=true;this.showSubmit()},signalNotAvailable:function(g,h){jQuery(".error."+g,a).fadeOut();this.inputDescriptors[g].hasError=false;this.inputDescriptors[g].isEnabled=false;this.showSubmit()},signalsResetAll:function(g,i,h){if(!dp_common.valorized(g)){g=this}for(desc in g.inputDescriptors){jQelement=jQuery(':input[name="'+desc+'"]',g.container);jQelement.removeClass("erroneous");dpcommDesc=g.inputDescriptors[desc];sCWclass=dpcommDesc.signalCorrectWithClass;if(dp_common.valorized(sCWclass)&&sCWclass!=false){jQelement.removeClass(sCWclass)}if(dpcommDesc.hasError){dpcommDesc.hasError=false;dpcommDesc.isEnabled=true;jQuery(".error."+desc,g.container).fadeOut();if(h!==true){if(dp_common.valorized(dpcommDesc.initialValue)){dp_common.setInputValue(jQelement,dpcommDesc.initialValue)}else{if(dp_common.valorized(dpcommDesc.initialDummyText)){dp_common.setInputValue(jQelement,dpcommDesc.initialDummyText)}else{dp_common.setInputValue(jQelement,null)}}}}if(i===true){g.showSubmit()}}},hasErrors:function(){for(var g in this.inputDescriptors){if(this.inputDescriptors[g].hasError){return true}}return false},disableInput:function(g){var h=this.inputDescriptors[g];h.isEnabled=false;h.selector.each(function(){this.disabled=true});h.selector.parents("label:first, .container."+g).fadeOut();this.signalNotAvailable(g)},enableInput:function(g){var h=this.inputDescriptors[g];h.isEnabled=true;h.selector.each(function(){this.disabled=false});h.selector.parents("label:first, .container."+g).fadeIn()},showSubmit:function(){if(this.hasErrors()){if(typeof this.formOptions.submitActionOnErrors=="function"){this.formOptions.submitActionOnErrors(this.submit)}else{this.submit.fadeOut()}}else{this.submit.fadeIn()}},selectedText:function(g){g.select()},clearErrMsgsInMyGroup:function(){dp_common.clearValidateInputTimer();group=this.mutualErrMsgClearForm;formsGroupArr=dp_common.linkedFormsTree.linkedFormsGroups[group];for(var g=0;g<formsGroupArr.length;g++){if(this!=formsGroupArr[g]){this.signalsResetAll(formsGroupArr[g],true)}}},onSubmit:function(j,k){var l={},g,m;for(g in this.inputDescriptors){m=this.inputDescriptors[g];if(m.selector.size()>0&&m.isEnabled){dp_common.validateInput2(null,null,[m,this]);if(m.isArray!=true){l[g]=dp_common.getInputValue(m.selector);if(m.dummyText!=null&&l[g]==m.dummyText){l[g]=""}}else{g=g+"[]";l[g]=dp_common.getAllInputsValue(m.selector);if(m.dummyText!=null){for(var h=0;h<l[g].length;h++){if(l[g][h]==m.dummyText){l[g][h]=""}}}}}}if(!this.hasErrors()){this.callback(l,this)}k.stopPropagation();return true}};b.initialize();return b},setDummyText:function(b,a){if(a){dp_common.bindEvent("focus",b,"onSetDummyText",this,{focus:true,text:a});dp_common.bindEvent("blur",b,"onSetDummyText",this,{focus:false,text:a});jQuery(b).each(function(){dp_common.onSetDummyText(this,null,{focus:false,text:a})})}},onSetDummyText:function(a,b,c){if(c.focus){if(a.value==c.text){a.value=""}}else{if(a.value==""){a.value=c.text}}},bindValidation2:function(d,e){var g=this;this.bindEvents([["blur",d.selector,"validateInput2",this,[d,e]],["change",d.selector,"validateInput2",this,[d,e]],["keyup",d.selector,"delayedValidateInput",this,[d,e]]]);if(d.selector.get(0)&&(d.selector.get(0).getAttribute("type")=="checkbox")){this.bindEvent("click",d.selector,"validateInput2",this,[d,e],true)}var f=jQuery(".tooltip."+d.name,e.container);if(f.size()>0){var b=jQuery(".container."+d.name,e.container);if(b.size()==0){b=d.selector}var c=function(){f.fadeIn()};var a=function(){f.fadeOut()};this.bindEvents([["blur",d.selector,a],["mouseenter",b,c],["mouseleave",b,a]])}},validateInput2:function(b,q,s){var j=s[0],a=s[1],p=j.selector,v=j.name,o=null,l=j.required?true:false,f=j.type,n=j.maxChars,u=null,m=null,e=false,r=0,k=null,t=null,h=null,d=/^([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6})$/i,c=/^([A-Z0-9._%+-]+)$/i,g=/^([0-9]{2,5}[ ]*[0-9]{4,})$/i;dp_common.clearValidateInputTimer(b,q);switch(p.size()){case 0:a.signalNotAvailable(v,p);return;case 1:if(p.is(":disabled")){a.signalNotAvailable(v,p);return}if(p.get(0).getAttribute("type")=="checkbox"&&p.get(0).checked==false){o=""}else{o=dp_common.getInputValue(p)}break;default:o=dp_common.getInputValue(p);break}if(n!=null&&o.length>n){a.signalError(v,b,"toolong");return}if(o==""||o==null){if(l!=false){a.signalError(v,b,"required");return}else{a.signalCorrect(v,b);return}}if(j.uppercase==true){o=o.toUpperCase();dp_common.setInputValue(j.selector,o)}switch(f){case"re":if(typeof(j.regExpMods)!="undefined"){u=new RegExp(j.regExp,j.regExpMods)}else{u=new RegExp(j.regExp)}if(o.match(u)){a.signalCorrect(v,b)}else{a.signalError(v,b,"format")}break;case"email":if(o.match(d)){a.signalCorrect(v,b)}else{a.signalError(v,b,"format")}break;case"email-list":m=o.split(",");e=true;for(r in m){email=jQuery.trim(m[r]);if(e&&!email.match(d)){a.signalError(v,b,"format");e=false}}if(e){a.signalCorrect(v,b)}break;case"email-account":if(o.match(c)){a.signalCorrect(v,b)}else{a.signalError(v,b,"format")}break;case"ip":u=/^$|^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;e=true;if(o.match(u)){k=o.split(".");for(r in k){if(k[r]>255){e=false}}}else{e=false}if(e){a.signalCorrect(v,b)}else{a.signalError(v,b)}break;case"byte":u=/^$|^(\d{1,3})$/;e=true;if(o.match(u)){if(o>255){e=false}}else{e=false}if(e){a.signalCorrect(v,b)}else{a.signalError(v,b)}break;case"ns":u=/^$|^[a-z0-9\-\_]+\.([a-z0-9\-\_]+\.)*[a-z0-9\-\_]+\.[a-z]{2,4}(\.[a-z]{2})?$/i;if(o.match(u)){a.signalCorrect(v,b)}else{a.signalError(v,b)}break;case"aname":u=/^$|^[a-z0-9-\.\*]|^_[a-z0-9-\.\*]/;if(o.match(u)){a.signalCorrect(v,b)}else{a.signalError(v,b)}break;case"custom":if(j.method(p,q)){a.signalCorrect(v,b)}else{a.signalError(v,b)}break;case"date":if(o==null){break}if(jQuery.datepicker){a.signalCorrect(v,b);break}t=dp_common.parseDate(o,j.locale);if(t==null){a.signalError(v,b)}else{a.signalCorrect(v,b)}break;case"phone":if(o.match(g)){a.signalCorrect(v,b)}else{a.signalError(v,b,"format")}break;case"password-check":h=dp_common.getInputValue(j.check.selector);if(o!=h){a.signalError(v,b,"different")}else{a.signalCorrect(v,b)}break;default:a.signalCorrect(v,b);return}},messageHandlers:[],registerMessageHandler:function(a){this.messageHandlers.push(a)},info:function(a){for(var b in this.messageHandlers){this.messageHandlers[b].handleMessage("info",a)}},warning:function(a){for(var b in this.messageHandlers){this.messageHandlers[b].handleMessage("warning",a)}},error:function(a){for(var b in this.messageHandlers){this.messageHandlers[b].handleMessage("error",a)}},sessionExpired:function(a){for(var b in this.messageHandlers){this.messageHandlers[b].handleMessage("session-expired",a)}},debugLoggers:[],registerDebugLogger:function(a){this.debugLoggers.push(a)},debugLog:function(a){for(var b in this.debugLoggers){this.debugLoggers[b].debugLog(a)}if(window.console&&window._debugMode){window.console.debug(a)}},postData:function(d,f){var a=jQuery("body");var g="virtualForm"+(jQuery(".virtualForm").size()+1);var c='<form class="virtualForm '+g+'" action="'+d+'" method="post" style="display:none">';for(var e in f){if((f[e] instanceof Array)){for(var b in f[e]){c+='<input type="hidden" value="'+f[e][b]+'" name="'+e+'"/>'}}else{if((f[e] instanceof Object)){c+='<textarea style="display: none;" name="'+e+'">'+JSON.stringify(f[e])+"</textarea>"}else{c+='<input type="hidden" value="'+f[e]+'" name="'+e+'"/>'}}}c+="</form>";a.append(c);a.children("form."+g).get(0).submit()},asyncLoad:function(url,params,container,object,callback,contextData,noBlocking){var cb=function(data){var re=/\[H\]([\s\w\W]+)\[\/H\]/m,json=data.match(re),response=null,debugRe=/\[D\]([\s\w\W]+)\[\/D\]/mg,debug=data.match(debugRe),appendRe=/\[A\]1\[\/A\]/m,append=data.match(appendRe),cleanRe=/<!--([\s\w\W]*?)-->/mg;if(debug!=""&&debug!=null){dp_common.debugLog(debug)}if(container!=null){var str=data.replace(cleanRe,"");if(!append){jQuery(container).html(str)}else{jQuery(container).append(str)}}if(json!=null&&json[1]!=null){eval("response= "+json[1].replace(":null,",':"",'))}if(noBlocking!=true){dp_common.resumeThisPage()}if(response!=null){if(response.dp_info!=null){dp_common.info(response.dp_info);response.dp_info=null}if(response.dp_warning!=null){dp_common.warning(response.dp_warning);response.dp_warning=null}if(response.dp_error!=null){dp_common.error(response.dp_error);response.dp_error=null}if(response.dp_session_expired!=null){dp_common.sessionExpired(response.dp_session_expired);response.dp_session_expired=null}}if(object!=null&&callback!=null){object[callback](response,append,contextData)}else{if(callback!=null){callback(response,append,contextData)}}};if(noBlocking!=true){this.debugLog("Blocking ajax call:"+url);this.waitForNewPage()}jQuery.post(url,params,cb)},parseDate:function(c,b){var h,a,g,f,e;switch(b){case"ita":f=/(\d{1,2})[\/ -](\d{1,2})[\/ -](\d{4})/;break;default:f=/(\d{4})[\/ -](\d{2})[\/ -](\d{2})/}f=c.match(f);if(f==null){return null}switch(b){case"ita":h=f[3];a=f[2];g=f[1];break;default:h=f[1];a=f[2];g=f[3]}h=parseInt(h,10);a=parseInt(a,10);g=parseInt(g,10);if(a<1||a>12){return null}switch(a){case 11:case 4:case 6:case 9:e=30;break;case 2:e=28;if((h%4==0&&h%100!=0)||h%400==0){e=29}break;default:e=31}if(g<1||g>e){return null}return[h,a,g]},checkZipGeo:function(a,c){if(a.length==0){return true}switch(c){case"IT":var b="^[0-9]{5}$";regexp=new RegExp(b);if(a.match(regexp)){return true}else{return false}break;case"ES":var b="^[0-9]{5}$";regexp=new RegExp(b);if(a.match(regexp)){if(a<1000||a>52999){return false}else{return true}}else{return false}break;default:return true}return false},assureInstantiability:function(d){var c=d.split(".");var b=window;var a=c.shift();var e=a;if(a=="window"){a=c.shift();e+="."+a}while(c.length>0){if(b[a]==null){b[a]=new Object()}else{if(typeof b[a]!="object"){throw e+"."+a+" is not an object"}}b=b[a];a=c.shift();e+="."+a}},valorized:function(b){var a=true;a&=(b!=undefined);a&=(typeof b!="undefined");a&=(b!=null);a&=(typeof b!="null");return a}};dp_common.htmlSnippets={close:'<a class="close" href="#" onclick="return false">X</a>',loading:'<div class="loading">Loading...</div>',header:function(a){alert("deprecato, rimuovere htmlSnippets.header()");if(a==null||a==undefined){a=""}return'<div class="hd">'+a+"</div>"},body:function(a){alert("deprecato, rimuovere htmlSnippets.body()");if(a==null||a==undefined){a=""}return'<div class="bd">'+a+"</div>"},footer:function(a){alert("deprecato, rimuovere htmlSnippets.footer()");if(a==null||a==undefined){a=""}return'<div class="ft">'+a+"</div>"},modalDialog:function(b,d,c){if(typeof c=="undefined"){c=""}var a='<div class="modalDialog '+c+'"><p class="close clickMe">X</p><div class="body"><h2 class="sectionTitle">'+b+'</h2><div class="modalDialogInner">'+d+"</div></div></div>";return a}};dp_common.TabView=function(a,f){var b={transition:f};var e=jQuery(a).children("ul:first").children("li");var c=jQuery(a).children("div:first").children();c.hide();b.activate=function(g){if(!isNaN(g)){g=e.get(g)}e.removeClass("selected");jQuery(g).addClass("selected");var h=e.index(g);switch(this.transition){case"fade":c.fadeOut();jQuery(c.get(h)).fadeIn();break;case"slide":c.slideUp();jQuery(c.get(h)).slideDown();break;default:c.hide();jQuery(c.get(h)).show()}};e.click(function(){b.activate(this)});var d=e.filter(".selected").get(0);if(d==null){d=e.get(0)}jQuery(d).click();return b};dp_common.ListModule=function(a){this.mainDiv=a;this.menus={}};dp_common.ListModule.prototype.operationSelected=function(a,b){if(this.isEditing(a,b)){this.closeEditing();return}this.closeEditing(b);this._LU_menu=b;this._LU_operation=a;var c="setupOperation_"+a;if(this[c]==null){dp_common.debugLog("Unhandeld operation:"+a);return}this[c](b.container)};dp_common.ListModule.prototype.isEditing=function(a,b){return this._LU_menu==b&&this._LU_operation==a};dp_common.ListModule.prototype.closeEditing=function(b,a,d){if(b==null){this._LU_menu=null;this._LU_operation=null}if(d==null){d="slideUp"}jQuery("li.editing",this.mainDiv).removeClass("editing").find("div.form-panel")[d]();jQuery(".externalActions .selected",this.mainDiv).removeClass("selected");for(var c in this.menus){if(this.menus[c]!=b){this.menus[c].reset()}}if(this.editingForm!=null){jQuery(this.editingForm.container)[d]();this.editingForm=null}};dp_common.ListModule.prototype.initList=function(){this.closeEditing();this.bindFilterAndSorting();var b=this,a=jQuery(".items-list",this.mainDiv);dp_common.stripeList(a);if(b.menus!=null){jQuery(a).children("li").each(function(){b.menus[this.id]=hierarch.common.smartMenu(this,b)})}};dp_common.ListModule.prototype.filterList=function(a,b,c){this.closeEditing();filter=a.value;dp_common.textFilter(jQuery(c).children("li"),filter,".dpc_fc");if(jQuery(c).children("li:visible").size()==0){jQuery(c).children("li.items-no-match").show()}else{jQuery(c).children("li.items-no-match").hide()}this.initList();b.stopPropagation()};dp_common.ListModule.prototype.sortList=function(){this.closeEditing();dp_common.waitForNewPage();var c=jQuery(".items-list",this.mainDiv);var d;if(jQuery(".items-sort-by",this.mainDiv).size()==0){d="dpc_sort"}else{d=jQuery(".items-sort-by :selected",this.mainDiv).get(0).value}var b=jQuery(".items-sort-ascending",this.mainDiv).get(0).checked?1:0;var a="."+d;dp_common.sortHtml(c,a,b);this.initList();dp_common.resumeThisPage()};dp_common.ListModule.prototype.cloneForm=function(d,b,e){if(e==null){e="slideDown"}var f=jQuery(".hiddenForms ."+d,this.mainDiv);var a=jQuery(b).addClass("editing").find("div.form-panel");a.css("display","none").html(f.clone().html())[e]();var c=a.get(0);dp_common.bindEvent("click",jQuery(".cancel",c),"closeEditing",this);return c};dp_common.ListModule.prototype.bindFilterAndSorting=function(){var a=this.mainDiv.get(0);dp_common.bindEvents([["click",jQuery(".items-sort-go",a),"sortList",this,null,true],["keyup",jQuery(".items-filter",a),"filterList",this,jQuery("ul.items-list",a).get(0),true]])};dp_common.zipCoupleArray=function(b,a){res=[];for(var c in b){if(b[c]!="undefined"&&a[c]!="undefined"){res.push([b[c],a[c]])}}return res};dp_common.slideNextElement=function(a){jQuery(a).click(function(){jQuery(this).next().slideToggle("slow");if(jQuery(this).hasClass("open")){jQuery(this).removeClass("open")}else{jQuery(this).addClass("open")}})};
