﻿function _sizeWindow() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  if(arguments[0]=="w") return myWidth;
  if(arguments[0]=="h") return myHeight;
}

function OpenWinOurteamPhotos(index){
    var strUrl = '../images/ourteam/pictures/pictures.html?'  + index; 
    _width = 660;
    _height = 520;
    _left = (_sizeWindow("w") - _width)/2;
    _top = (_sizeWindow("h") - _height)/2;
    _screenX = _left;
    _screenY = _top;
    window.open(strUrl, "","menubar=no, status=no, toolbar=no, resizable=no, width="+ _width +", height="+ _height +", left="+ _left +", top="+ _top +", screenX="+ _screenX +", screenY="+ _screenY);
}

//================================================================
var pics = new Array();
var currImg;

for(var i = 0; i < 15; i++) {
    var image = new Image();
    image.src = "../images/ourteam/photos/" + (i + 1) + ".jpg";
    pics.push(image);
}

function showNextImg() {
    currImg = ++currImg % pics.length;
    var img = document.getElementById("gallery");
    img.src = pics[currImg].src;
}

function showPrevImg() {
    currImg = (currImg == 0) ? pics.length - 1 : --currImg;
    var img = document.getElementById("gallery");
    img.src = pics[currImg].src;
}

function ShHiPhoto() {
    var img = document.getElementById("gallery");
    if(arguments[0]==1) img.style.visibility = "visible";
    if(arguments[0]==0) img.style.visibility = "hidden";
}

function ShowPhotos() {
    var miniObj = document.getElementById("miniPhoto");
    var fullObj = document.getElementById("fullPhoto");
    
    var img = document.getElementById("gallery");    
    var patern = /\d/;
    img.style.visibility = "hidden";    
    if(patern.test(arguments[0]))
    {    
        if(miniObj && fullObj)
        {            
            currImg =  parseInt(arguments[0]);
            img.src = pics[--currImg].src;
            
            miniObj.style.visibility = "hidden";
            miniObj.style.display = "none";                
            fullObj.style.display = "block";
            fullObj.style.visibility = "visible";
            ShHiPhoto(1);
            return;
        }
    }
    else
    {
        if(arguments[0]=="Prev")
        {
            showPrevImg();
            ShHiPhoto(1);
            return;
        }
        if(arguments[0]=="Next") 
        {
            showNextImg();
            ShHiPhoto(1);
            return;
        }
        fullObj.style.visibility = "hidden";
        fullObj.style.display = "none";                
        miniObj.style.display = "block";
        miniObj.style.visibility = "visible";               
        return;
    }
}