// JavaScript Document
function openPopup() {
 	window.open('indexPop.php', 'win', 'height=800,width=1280,resizable=false,scrollbars=0,status=no')
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

var sImgSize = '';
var sImgHeight = 0;
var sImgWidth = 0;
var sImgHeightP = 0;
var sImgWidthP = 0;
var iWinH = 0;
var iWinW = 0;
var iScrH = 0;
var iScrW = 0;
var resize = false;

function $(sId) {
  return document.getElementById(sId);
}

function isIE() {
  bRet = false;
  if (typeof(window.pageYOffset) == 'number') {
    bRet = false;
  } else if (document.body && typeof(document.body.scrollTop) == 'number') {
    bRet = true;
  }
  return bRet;
}

function startAll() {
  startImage(); 
  resizeImage();
}

function resizeImage() {
  iDivWidth = 800;
  iDivHeight = 600;

  oDiv = $('oImg');
  sImgSize = 'P';
  sClass = 'zoomUp';

  if (typeof(window.pageYOffset) == 'number') {
    iWinW = window.innerWidth;
    iWinH = window.innerHeight;
    iScrW = window.pageXOffset;
    iScrH = window.pageYOffset;
    //alert('FF');
  } else if (document.body && typeof(document.body.scrollTop) == 'number') {
    iWinW = document.body.clientWidth;
    iWinH = document.body.clientHeight;
    iScrW = document.body.scrollLeft;
    iScrH = document.body.scrollTop;
    //alert('IE');
  } else if (document.documentElement && typeof(document.documentElement.scrollTop) == 'number') {
    iWinW = document.documentElement.clientWidth;
    iWinH = document.documentElement.clientHeight;
    iScrW = document.documentElement.scrollLeft;
    iScrH = document.documentElement.scrollTop;
  }

  sClass = (isIE() ? sClass + 'IE' : sClass);
  oDiv.style.top        = 0;
  oDiv.style.left       = 0;
  oDiv.style.height     = iWinH - 20;
  oDiv.align            = 'center';
  oDiv.className        = sClass;
}

function zoomImage(iType) {
  if (resize) {
    if (sImgSize == 'G') {
      resizeImage();
      startButtons();
    } else {
      zoomImgDown();
      moveButtons(iType);
    }
  }
}

function zoomImgDown() {
  oDiv.style.height = sImgHeightG;
  sImgSize = 'G';
  sClass = 'zoomDown';
  sClass = (isIE() ? sClass + 'IE' : sClass);
  oDiv.className = sClass;
}

function startImage() {
  oDiv = $('oImg');
  sImgHeightG = oDiv.height;
  sImgWidthG = oDiv.width;
  if (sImgHeightG < 1) {
    sImgHeightG = 1000;
    sImgWidthG  = 1361;
  }
}

function endImage() {
  oDiv = $('oImg');
  sImgHeightP = oDiv.height;
  sImgWidthP = oDiv.width;
  resize = true;
}

function startButtons() {
  if (iWinH == 0) {
    iWinH = document.body.clientHeight;
  }

  oL = $('oImgLeft');
  if (oL) {
    oL.style.left = 10 + 20;
    oL.style.top = iWinH / 2;
  }

  oR = $('oImgRight');
  if (oR) {
    oR.style.left = oImg.width - 120;
    oR.style.top = iWinH / 2;
  }
}

function moveButtons(iType) {
  if (iWinH == 0) {
    iWinH = document.body.clientHeight;
  }

  oL = $('oImgLeft');
  if (oL) {
    oL.style.left = 10 + 20;
    oL.style.top = sImgHeightG / 2;
  }

  oR = $('oImgRight');
  if (oR) {
    oR.style.left = oImg.width - 150;
    oR.style.top = sImgHeightG / 2;
  }
}
