var modale=Class.create();modale.prototype.initialize=function(e,b){if(!e){e="modal"}if(!b){b=4001}this.div=$(e);if(this.div){return}this.id=e;var d=document.createElement("div");d.id=e;d.style.position="absolute";d.style.visibility="hidden";d.style.left=0;d.style.top=0;d.style.zIndex=b;document.body.appendChild(d);this.div=d;this.debug_level=20;this.debug_scope="modal";var c='<table id="'+e+'_table" width="250" border="0" cellpadding="0" cellspacing="0"><tr id="'+e+'_tr1"><td width="10" height="10"><img width="10" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_tl.png"></td><td width="99%" height="10"><img width="100%" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_t.png"></td><td width="10" height="10"><img width="10" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_tr.png"></td></tr><tr id="'+e+'_tr2"><td width="10"><img width="10" height="10" id="'+e+'_img_l" class="pngfix" src="'+URL.L+'/modal/shadow_white_l.png"></td><td width="99%" bgcolor="white"><div id="'+e+'_inner"><table width="100%" xheight="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><img src="'+URL.L+'/z.gif" width="30" height="30" style="display:none" id="'+e+'_icon"/><span id="'+e+'_flash" style="display:none"></span></td><td width="99%" style="padding-left:10px;padding-right:10px"><div id="'+e+'_message" style="font:normal 12px arial,verdana,sans-serif"></div><div id="'+e+'_form" style="display:none;"></div><div id="'+e+'_progress" style="margin-top:15px;height:15px;border:solid 1px #000;display:none"></div><div id="'+e+'_buttons" style="margin-top:15px;padding:0;display:none;"><form><input type="reset" class="submit" value="'+_MSG.ok.toUpperCase()+'" id="'+e+'_ok">&nbsp;&nbsp;<input type="reset" class="reset"  value="'+_MSG.cancel.toUpperCase()+'" id="'+e+'_nok"></form></div></td></tr></table></div></td><td width="10"><img width="10" height="10" id="'+e+'_img_r" class="pngfix" src="'+URL.L+'/modal/shadow_white_r.png"></td></tr><tr id="'+e+'_tr3"><td width="10" height="10"><img width="10" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_bl.png"></td><td width="99%" height="10"><img width="100%" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_b.png"></td><td width="10" height="10"><img width="10" height="10" class="pngfix" src="'+URL.L+'/modal/shadow_white_br.png"></td></tr></table>';
d.innerHTML=c;this.modal={div:d,table:$(e+"_table"),inner:$(e+"_inner"),message:$(e+"_message"),form:$(e+"_form"),icon:$(e+"_icon"),flash:$(e+"_flash"),progress:$(e+"_progress"),buttons:$(e+"_buttons"),ok:$(e+"_ok"),nok:$(e+"_nok"),tr1:$(e+"_tr1"),tr2:$(e+"_tr2"),tr3:$(e+"_tr3")};var a=this;this.modal.ok.onclick=this.modal.nok.onclick=function(){this.blur();a.shutup();if(typeof this.on_click=="function"){this.on_click()}};this.set_position_observer=this.set_position.bindAsEventListener(this)};modale.prototype.shutup=function(){if(this.timer_hide){clearTimeout(this.timer_hide)}_hide_doc_player("modal",false);this.timer_hide=undefined;this.reset_table_sizes();Event.stopObserving(window,"resize",this.set_position_observer);Event.stopObserving(window,"scroll",this.set_position_observer);this.showing=0;this.is_shown=0;if(this.overlay&&this.overlay.is_shown){this.overlay.hide()}this.div.style.visibility="hidden";this.modal.flash.style.visibility="hidden"};modale.prototype.fix_table_sizes=function(){var a=Element.getDimensions(this.modal.inner);if(this.options.flash&&a.height<32){a.height=32}this.modal.tr1.childNodes[1].childNodes[0].style.width=(a.width)+"px";this.modal.tr2.childNodes[0].childNodes[0].style.height=(a.height)+"px";this.modal.tr2.childNodes[2].childNodes[0].style.height=(a.height)+"px";this.modal.tr3.childNodes[1].childNodes[0].style.width=(a.width)+"px"};modale.prototype.reset_table_sizes=function(){this.modal.tr1.childNodes[1].childNodes[0].style.width="10px";this.modal.tr2.childNodes[0].childNodes[0].style.height="30px";this.modal.tr2.childNodes[2].childNodes[0].style.height="30px";this.modal.tr3.childNodes[1].childNodes[0].style.width="10px";this.modal.inner.style.display="none"};modale.prototype.set_position=function(){var c=this.div;if(!this.dimensions){this.dimensions=Element.getDimensions(c)}var a=this.options.pos_x;var n=this.options.pos_y;if(this.options.area){var i=Element.getDimensions(this.options.area);var g=_find_x(this.options.area)+_pi((i.width-this.dimensions.width)/2);var f=_find_y(this.options.area)+_pi((i.height-this.dimensions.height)/2)
}else{var e=_find_page_size();var h=e[2];var b=e[3];var m=e[4];var k=e[5];var g=m+_pi((h-this.dimensions.width)/2);var f=k+_pi((b-this.dimensions.height)/2)}var l=(typeof a=="function")?a(this.dimensions.width):(typeof a=="number")?a:g;var j=(typeof n=="function")?n(this.dimensions.height):(typeof n=="number")?n:f;c.style.top=j+"px";c.style.left=l+"px";IOL.debug("modal resized..."+c.style.visibility,"",this)};modale.prototype.say=function(e,a,d,c){if(this.is_shown||this.showing){this.shutup()}if(this.timeout){clearTimeout(this.timeout)}_hide_doc_player("modal",true);this.showing=true;if(!e){e=_MSG.processing}if(typeof a!="object"){a={}}if(d&&typeof d!="object"){d={}}if(c&&typeof c!="object"){c={}}this.options=a;if(a.overlay){if(!this.overlay){this.overlay=new overlay()}this.overlay.show()}a.width=a.width||250;var g=this.div;var f=this.id;this.modal.inner.style.display="block";if(typeof e=="object"){this.modal.message.innerHTML=e.innerHTML}else{this.modal.message.innerHTML=e.replace(/\n/g,"<br/>")}if(a.progress){while(this.modal.progress.childNodes.length){this.modal.progress.removeChild(this.modal.progress.childNodes[0])}var b=document.createElement("div");b.style.width="0%";b.style.height="15px";b.style.backgroundColor="#0087e1";this.modal.progress.appendChild(b);this.modal.progress.style.width="300px";this.modal.progress.style.display="block";if(a.width<350){a.width=350}}else{this.modal.progress.innerHTML="";this.modal.progress.style.display="none"}if(a.icon){this.modal.icon.src=URL.L+"/status/"+a.icon+"_30x30.gif";this.modal.icon.style.width="30px";this.modal.icon.style.height="30px";this.modal.icon.style.display="block";a.width+=40}else{this.modal.icon.style.display="none"}if(a.flash&&!a.icon){this.modal.flash.style.display="block";swfobject.embedSWF(URL.L+"/status/"+a.flash+"_30x30.swf",f+"_flash",30,30,"7.0.0");a.width+=40}else{$(f+"_flash").hide()}this.modal.table.style.width=$(f).style.width=a.width+"px";if(d||c){this.modal.ok.style.display="none";this.modal.ok.style.visibility="hidden";this.modal.nok.style.display="none";
this.modal.nok.style.visibility="hidden";if(d){this.modal.ok.value=(d.label)?d.label.toUpperCase():_MSG.ok.toUpperCase();this.modal.ok.on_click=(d.onclick)?d.onclick:null;this.modal.ok.style.display="inline";this.modal.ok.style.visibility="visible"}if(c){this.modal.nok.value=(c.label)?c.label.toUpperCase():_MSG.cancel.toUpperCase();this.modal.nok.on_click=(c.onclick)?c.onclick:null;this.modal.nok.style.display="inline";this.modal.nok.style.visibility="visible"}this.modal.buttons.style.display="block"}else{this.modal.buttons.style.display="none"}if(a.timeout){this.timeout=setTimeout(function(){this.shutup()}.bind(this),a.timeout)}this.fix_table_sizes();this.set_position();IOL.debug("added observers","",this);Event.observe(window,"resize",this.set_position_observer,false);Event.observe(window,"scroll",this.set_position_observer,false);g.style.visibility="visible";if(d){this.modal.ok.focus();Effect.Pulsate(this.modal.ok,{pulses:1,duration:0.3})}else{if(c){this.modal.nok.focus();Effect.Pulsate(this.modal.nok,{pulses:1,duration:0.3})}}this.is_shown=1;this.showing=0};modale.prototype.repeat=function(d,a,c,b){if(typeof a!="object"){a={}}if(d){this.modal.message.innerHTML=d.replace(/\n/g,"<br/>")}if(a.progress&&this.modal.progress.firstChild){this.modal.progress.firstChild.style.width=(a.progress<=100)?a.progress+"%":"100%"}if(typeof c=="object"){this.modal.ok.value=(c.label)?c.label.toUpperCase():_MSG.ok.toUpperCase();this.modal.ok.on_click=(c.onclick)?c.onclick:null}if(typeof b=="object"){this.modal.nok.value=(b.label)?b.label.toUpperCase():_MSG.cancel.toUpperCase();this.modal.nok.on_click=(b.onclick)?b.onclick:null}};modale.prototype.complain=function(c,b,e,d){if(typeof b!="object"){b={}}b.icon="nok";if(typeof c=="object"){if(c.error&&c.error.id){var a=c.error.id;var f=(_MSG["api_err_"+a])?_MSG["api_err_"+a]:_MSG.err_failed+" #"+a}else{var f=_MSG.err_failed+" #??"}}else{var f=(_MSG[c])?_MSG[c]:_MSG.err_failed}return this.say(f,b,e,d)};modale.prototype.is_showing=function(){return this.showing};