function resizeWin()
{
  if (window.innerWidth)
  {
    iWidth = window.innerWidth;
    iHeight = window.innerHeight;
  }
  else
  {
    iWidth = document.documentElement.clientWidth;
    iHeight = document.documentElement.clientHeight;
  }
  
  iWidth = 1020 - iWidth;
  iHeight = 700 - iHeight;
  if (iWidth > 0 || iHeight > 0)
    window.resizeBy(iWidth, iHeight);
}

function preload(imgObj,imgSrc)
{
  eval(imgObj + ' = new Image()');
  eval(imgObj + '.src = "' + imgSrc + '"');
}

preload("mn01", "../images/mn_logo_ov.gif");
preload("mn02", "../images/mn_images_ov.gif");
preload("sn01", "../images/sn_address_ov.gif");
preload("sn02", "../images/sn_profile_ov.gif");
preload("sn03", "../images/sn_partners_ov.gif");
preload("sn04", "../images/sn_clients_ov.gif");
preload("sn05", "../images/sn_competitions_ov.gif");
preload("sn06", "../images/sn_download_ov.gif");

function browseDetail(dir)
{
	curImage += dir;
	
	if (curImage == imageList.length)
    curImage = 0;
  else if (curImage < 0)
    curImage = imageList.length - 1;
  
  // display image
  showDetail(curImage);
}

function showDetail(index)
{
  showImg(index);
  setNumber(index);
}

function showImg(index)
{
  if (imageList.length == 0)
    return;
    
  // make sure that the current image is set, also when selected from numbers
  curImage = index;
  // display current image
  var imgField = document.getElementById("detail_photo");
  imgField.src = imageList[index][0];
  imgField.alt = imageList[index][1];
}

function setNumber(curImage)
{
	var anchorElements = document.getElementsByTagName('a');
	for(i=0; i<anchorElements.length; i++) {
		if (anchorElements[i].id.indexOf('photo') == 0) {
			anchorElements[i].style.color = '#B4B4B4';
	  }
	}	
	
	pictNumber = document.getElementById("photo" + curImage);
  if (pictNumber)
    pictNumber.style.color = '#DA0000';
}

function initDetail()
{
  for (var i=0; i<imageList.length; i++)
    preload("img_" + i, imageList[i][0]);

  showDetail(curImage);
}
