widok = function(file){ this.file=file; this.win=null; this.title=':::'; this.left=50; this.top=50; this.param='width=100, height=100, left=' + this.left + ', top=' + this.top; } widok.prototype.url = function(){ this.openImg('http://www.skipper.pl/lib_js/widok.php?path='+this.file); this.checkFocus(); } widok.prototype.path = function(){ if(!this.file){ alert('Wybierz zdjêcie.'); return; } this.openImg('about:blank'); this.checkFocus(); this.addBody(0); } widok.prototype.frame = function(){ this.openImg('about:blank','fullscreen'); window.onfocus(); this.addBody(1); this.win.focus(); } widok.prototype.openDoc = function(param){ if(param) this.param=param; else this.param='width=700, height=550, left=' + this.left + ', top=' + this.top; window.open(this.file,'',this.param); } widok.prototype.openImg = function(file,param){ if(param) this.param=param; this.win=window.open(file,'',this.param); } widok.prototype.checkFocus = function(){ if(this.win){ var winz=this.win; window.onfocus=function(){ winz.close(); } } } widok.prototype.addBody = function(margin){ if(this.win!=null){ var doc=this.win.document; var body=doc.body; doc.title=this.title; body.innerHTML=''; body.scroll='no'; body.style.padding='0px'; body.style.margin=margin+'px'; body.style.cursor='hand'; var el=doc.createElement("img"); el.alt='zamknij'; el.src=this.file; var winz=this.win; el.onclick=function(){ winz.close(); } body.appendChild(el); this.win.resizeTo(el.offsetWidth + (margin*2), el.offsetHeight + (margin*2)); this.win.moveTo(this.left,this.top); } }