String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};
function AjaxWindow(a,c,e,g,h,b,i,d){this.id=h;this.data=i;this.textarea=g;this.height=e;this.width=c;this.url=a.indexOf("?")==-1?a+"?t="+Math.round((new Date).getTime()/1E3):a+"&t="+Math.round((new Date).getTime()/1E3);this.manager=b;this.active=1;this.history=[];this.position=null;this.cursor=[];this.dataType=d;this.init=function(){$("body").append('<div class="windowBox" id="windowBox'+this.id+'"></div><div class="hidden" id="AWM_data"></div>');$("#windowBox"+this.id).css({width:this.width,height:"auto",
opacity:1,left:($(window).width()-$("#windowsBox").width())/2}).append('<div class="loading" style="text-align:center;"><img style="margin:20px;" src="../style/loading.gif" alt="Na\u010d\u00edt\u00e1n\u00ed..." /></div>').data("manager",this.manager);$.get(this.url,this.data,function(f){var j=f.indexOf("<body")+6,k=f.indexOf("</body>")-j;$("#AWM_data").html(f.substr(j,k));$("#windowBox0 .loading").remove();$("#windowBox0").append($("#AWM_data .AWMcnt"));$("#AWM_data").remove();AWManager.resizeBackground();
$("#windowBox0").append('<img class="close_img" src="../style/close2.gif" onclick="AWManager.closeAll();" />');$("#backgroundDiv").click(AWManager.closeAll)})};this.setActive=function(){this.active=1;this.setZIndex(9090)};this.clearActive=function(){this.setZIndex(9080);this.active=0};this.getActive=function(){return this.active};this.setZIndex=function(f){$("#windowBox"+this.id).css("z-index",f)};this.close=function(){$("#windowBox"+this.id).remove()};return true}
var AWManager={windows:[],windowsId:[],mouseUp:0,copy:{type:"",value:""},resizeBackground:function(){$("#backgroundDiv").css({height:___getPageSize()[1]})},newWindow:function(a,c,e,g,h,b,i){newId=AWManager.windowsId.length;AWManager.windowsId.push(newId);if(newId==0){$("body").append('<div id="backgroundDiv"></div>');$("#backgroundDiv").css({opacity:0.7,width:___getPageSize()[0],height:___getPageSize()[1]})}if(!b){b={};b.left=(___getPageSize()[0]-c)/2;b.top=___getPageScroll()[1]+50;for(var d in AWManager.windows){if($("#windowBox"+
AWManager.windows[d].id).offset().top+20>=b.top)b.top=$("#windowBox"+this.windows[d].id).offset().top+20;if($("#windowBox"+AWManager.windows[d].id).offset().left+20>=b.left)b.left=$("#windowBox"+this.windows[d].id).offset().left+20}}(d=AWManager.getActiveWindow())&&d.clearActive();a=new AjaxWindow(a,c,e,g,newId,this,h,i);AWManager.windows.push(a);a.init();a.setActive();$("#windowBox"+newId).css({top:b.top,left:b.left});return true},getWindow:function(a){for(var c in AWManager.windows)if(AWManager.windowsId[c]==
a.substr(9)*1)return AWManager.windows[c];return null},getActiveWindow:function(){for(var a in AWManager.windows)if(AWManager.windows[a].getActive())return AWManager.windows[a];return null},closeWindow:function(a,c){a=AWManager.getWindow(c);a.close();for(var e in AWManager.windows)if(a==AWManager.windows[e]){AWManager.windows.splice(e,1);AWManager.windowsId.splice(e,1)}this.windows.length==0&&$("#backgroundDiv").fadeOut(function(){$("#backgroundDiv").remove()});return true},closeAll:function(){for(var a in AWManager.windows)AWManager.windows[a].close();
AWManager.windows=[];AWManager.windowsId=[];$("#backgroundDiv").fadeOut(function(){$("#backgroundDiv").remove()});return true}};
