/** Klasse: ZoomPicture
* $Date$
* $Version$
* $Revision$
* - Element bestehend aus Vorschauansicht und vergrößerter Ansicht in einem Popupfenster
*
* @package de.inside.dynapi.wbt
* @extend de.inside.dynapi.DynObject
*/

/** Konstruktor: ZoomPicture
* - Erzeugt eine Instanz vom Typ ZoomPicture
* @param doc Referenz auf das Basisdokument
* @param id ID der erzeugten Instanz
*/
function ZoomPicture(url){
 this.zw     = 0; // Breite des Zoom-Bildes
 this.zh     = 0; // Höhe des Zoom-Bildes
 this.scrollbar = 'no';
 this.zi_win = null;
 
 this.init 			 = fn_init;
 this.show       = fn_show;
 this.getWin     = fn_getWin;
 
 // Image-Buffer
 this.zimg        = new Image();
 this.zimg.obj    = this;
 this.zimg.onload = fn_onload;
 
  function fn_init(){
    this.zimg.src    = url;
  }
 
  /** interne Methode: fn_onload
  * -
  */
  function fn_onload(){
    this.obj.loaded = true;
    this.obj.zw     = this.width;
    this.obj.zh     = this.height;
 }

 /** interne Methode: fn_show
 * - öffnet neues Fenster mit der Detailansicht der Grafik
 */
 function fn_show(){
      this.scrollbar = 'no';
      var offset = 100;
      var zh = this.zh;
      var zw = this.zw;
      
      if(this.zw> screen.width-offset){
        zw = screen.width-offset;
        if(this.zh > screen.height-offset)
          zh = screen.height - offset;
        else
          zh += offset;
        this.scrollbar = 'yes';
      }

      if(this.zh >screen.height-offset){
        zh = screen.height - offset;
        if(this.zw > screen.width-offset)
          zw = screen.width - offset;
        else
          zw += offset;
        this.scrollbar = 'yes';
      }
      
			this.zi_win = window.open('','Detailansicht','width='+zw+',height='+zh+',scrollbars='+this.scrollbar+',top=0,left=0');
			this.zi_win.document.write("<HTML><HEAD><TITLE>Detailansicht</TITLE></HEAD><BODY marginwidth='0' marginheight='0' topmargin='0' leftmargin='0' onblur='window.close()'><IMG SRC="+this.zimg.src+"></BODY></HTML>");
			this.zi_win.document.close();
			//this.zi_win.location.reload();

 }
 
 function fn_getWin(){
		return this.zi_win;
 }
}
