/*
  zoomwindow.js   ../include

  (c) by ulrich lange, bochum, germany
      all rights reserved.

  rev  date        description
  -----------------------------------------------------------
  1.0  30.05.2009  script developed
  -----------------------------------------------------------
*/

var img    = 0;
var len    = 0;
var pos    = 0;

var image_mid          = 0;
var image_mid_top      = 0;
var image_passepartout = 70;
var image_offset       = 0;
var image_number       = 0;

var image_path         = "";
var image_name         = "";
var image_name_tmp     = "";
var image_name_large   = "";


var cf                 = new Array(0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,1.00,1.00);
var cc                 = 0;
var int                = 20;
var zoom_speed         = 20;

function zoom_window(img)
{
 close_window();
 image_number     = img + img_offset;
 width_available  = window.innerWidth;
 height_available = window.innerHeight;
 if ( (navigator.userAgent.search(/MSIE/)) != -1 )
 {
  width_available  = document.all.id_body.offsetWidth;
  height_available = document.all.id_body.offsetHeight;
 }

 left_space       = (width_available - website_box_width) / 2
 image_path       = document.images[image_number].src;
 image_width      = 550;
 image_height     = 400;
 image_mid        = width_available / 2;
 image_mid_top    = height_available / 2;

 image_name_large = image_path.replace(/%20/g, " ");

 pos_left = image_mid - image_width / 2 - image_passepartout / 2 - image_offset;
 pos_top  = image_mid_top - image_height / 2 - image_passepartout / 2 - image_offset;

 cc = 0;
 zoom();
}

function zoom()
{
 if (cc <= (int-1))
 {
  pos_leftZo = pos_left + (image_width + image_passepartout + image_offset) * ((1-cf[cc])/2);
  pos_topZo  = pos_top  + (image_height + image_passepartout + image_offset) * ((1-cf[cc])/2);
  passepZ    = image_passepartout / 2 * cf[cc];
  offsetZ    = image_offset * cf[cc];
  width_Zo   = (image_width  + image_passepartout + image_offset) * cf[cc];
  height_Zo  = (image_height + image_passepartout + image_offset) * cf[cc];
  width_Zp   = (image_width  + image_passepartout) * cf[cc];
  height_Zp  = (image_height + image_passepartout) * cf[cc];
  width_Z    = image_width  * cf[cc];
  height_Z   = image_height * cf[cc];

  document.getElementById('ptr_zoom').innerHTML='' +
    '<div class="overlay_window" style="left:'+pos_leftZo+'px; top:'+pos_topZo+'px; width:'+width_Zo+'px; height:'+height_Zo+'px; z-index:0;">' +
    ' <div class="black_frame" style="left:'+passepZ+'px; top:'+passepZ+'px; width:'+width_Zp+'px; height:'+height_Zp+'px; z-index:0;"></div>' +
    ' <div class="image_frame" style="left:'+(passepZ*2)+'px; top:'+(passepZ*2)+'px; width:'+width_Z+'px; height:'+height_Z+'px; z-index:0;">' +
    '  <img src="'+image_name_large+'" border=0 alt="" style="position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:0;">' +
    ' </div>' +
    '</div>';
  cc++;
  setTimeout("zoom()",zoom_speed);
 }
 else
 {

  text_close       = "close image with mouse click.";
  text_empty       = "";
  orientation_flag = "l";

  document.getElementById('ptr_zoom').innerHTML='' +
    '<div class="overlay_window" style="left:'+pos_left+'px; top:'+pos_top+'px; width:'+(image_width+image_passepartout+image_offset)+'px; height:'+(image_height+image_passepartout+image_offset)+'px; z-index:0;">' +
    ' <div class="black_frame" style="left:'+image_offset+'px; top:'+image_offset+'px; width:'+(image_width+image_passepartout)+'px; height:'+(image_height+image_passepartout)+'px; z-index:0;">' +
    '  <div class="xbox" style="right:0px; top:15px; width:80px; height:10px; z-index:0;">' +
    '   <a href="javascript:void(0)" onClick="close_window()">close window</a>' +
    '  </div>' +
    ' </div>' +
    ' <div class="image_frame" style="left:'+(image_passepartout/2+image_offset)+'px; top:'+(image_passepartout/2+image_offset+5)+'px; width:'+image_width+'px; height:'+image_height+'px; z-index:0;">' +
    '  <a href="javascript:void(0)" onClick="close_window()" onMouseOver="show_overlay_text_on(2,text_close,text_empty)" onMouseOut="show_overlay_text_off()">' +
    '   <img src="'+image_name_large+'" border=0 alt="" style="position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:1;">' +
    '  </a>' +
    ' </div>' +
    '</div>';
 }
}

function close_window()
{
 document.getElementById('ptr_zoom').innerHTML='<div></div>';
 show_overlay_text_off();
}

// ---------- end of java script ----------