function Popup(n){this.drawed=false;this.visible=false;this.configured=false;this.n=n;this.configure=function(options){if(typeof options=="undefined"){var opt={};} else{opt=options;} if(typeof opt.type=="undefined"){return false;} if(typeof opt.modal=="undefined"){opt.modal=false;} if(typeof opt.bg=="undefined"){opt.bg='light';} if(typeof opt.width=="undefined"){opt.width='100px';} if(typeof opt.height=="undefined"){opt.height='100px';} if(typeof opt.top=="undefined"){opt.top="centered";} if(typeof opt.left=="undefined"){opt.left="centered";} this.type=opt.type.toLowerCase();this.modal=opt.modal;this.bg=opt.bg.toLowerCase();this.imp=PopupFactory.get(this.type);this.imp.configure(options);this.imp.n=this.n;this.width=opt.width;this.height=opt.height;this.left=opt.left;this.top=opt.top;this.configured=true;} this.draw=function(){if($('.popup-container').size()==0){$('body').append('');} if(this.drawed==false){str='';$('.popup-container').append(str);PopupManager.setActive(this);this.imp.load();this.bindEvents();this.drawed=true;Common.centerPopup();} else{this.show();}} this.refresh=function(){try{this.imp.refresh();} catch(error){}} this.bindEvents=function(){$(this.getSelector()+' .popup-body').mouseover(function(){var n=$(this).parents('.popup-window').attr('n');PopupManager.setActive(PopupManager.get(n));});} this.getSelector=function(){return'.popup-window[n="'+this.n+'"]';} this.show=function(){var obj=$(this.getSelector());if(obj.size()>0){obj.show();} this.visible=true;} this.hide=function(){var obj=$(this.getSelector());if(obj.size()>0){obj.hide();} this.visible=false;} this.close=function(){var obj=$(this.getSelector());if(obj.size()>0){obj.remove();} if($('.popup-window').size()==0){$('.popup-container').remove();} this.drawed=false;this.visible=false;}}