var el = null;

function hoverRollOver(element) {
  element.origClassName = element.className;
  element.className = element.className + "Hover";
}

function hoverRollOff(element) {
  element.className = element.origClassName;
}

function SwitchMenu(obj) {
  var elnew = document.getElementById(obj);
  if ( el != null && el != elnew ) {
    el.style.display = "none";
  }
  el = elnew;
  if ( el.style.display != "block" ) {
    el.style.display = "block";
  } else {
    el.style.display = "none";
  }
}

function fbID(imageName) {
  var imageID = imageName.substr(1,11);
  if (imageID == '20040829033') return '602239';
  if (imageID == '20040829034') return '602238';
  if (imageID == '20040829039') return '602236';
  if (imageID == '20040830062') return '602234';
  if (imageID == '20040830069') return '602233';
  if (imageID == '20040831080') return '602232';
  if (imageID == '20040925006') return '602230';
  if (imageID == '20050114017') return '602221';
  if (imageID == '20050530003') return '602211';
  if (imageID == '20050703003') return '602208';
  if (imageID == '20050704021') return '602207';
  if (imageID == '20050706044') return '602206';
  if (imageID == '20050723014') return '602202';
  if (imageID == '20050829031') return '602196';
  if (imageID == '20050829034') return '602195';
  if (imageID == '20050831046') return '602193';
  if (imageID == '20050831050') return '602192';
  if (imageID == '20050831055') return '602189';
  if (imageID == '20050901076') return '602186';
  if (imageID == '20050902081') return '602185';
  if (imageID == '20050902103') return '602184';
  if (imageID == '20060330034') return '602166';
  if (imageID == '20060430015') return '602156';
  if (imageID == '20060621008') return '602153';
  if (imageID == '20060912010') return '602146';
  if (imageID == '20060912019') return '602145';
  if (imageID == '20060912022') return '602144';
  if (imageID == '20060914054') return '602140';
  if (imageID == '20060914055') return '602139';
  if (imageID == '20060914057') return '602138';
  if (imageID == '20060916068') return '602136';
  if (imageID == '20060916091') return '602133';
  if (imageID == '20060920151') return '602131';
  if (imageID == '20061231006') return '693315';
  if (imageID == '20070210010') return '693301';
  if (imageID == '20070304010') return '693299';
  if (imageID == '20070304013') return '693298';
  if (imageID == '20070318008') return '693297';
  if (imageID == '20070408007') return '714647';
  if (imageID == '20070415003') return '714646';
  if (imageID == '20070703038') return '754964';
  if (imageID == '20070703039') return '754963';
  if (imageID == '20070704055') return '754962';
  if (imageID == '20070705070') return '754960';
  if (imageID == '20070706088') return '754959';
  if (imageID == '20070706100') return '754956';
  if (imageID == '20070710157') return '754952';
  if (imageID == '20070711174') return '754947';
  if (imageID == '20070711177') return '754946';
  if (imageID == '20070722013') return '803014';
  if (imageID == '20070930005') return '803010';
  if (imageID == '20071006037') return '803008';
  if (imageID == '20071006062') return '803007';

  return '';
}

function openPicture(imageName,imageWidth,imageHeight,alt) {
  var wWidth = imageWidth+50;
  var wHeight = imageHeight+60;
  if (alt != '')
   wHeight = wHeight + 15 + 16*((alt.length+100) / 100);
  var newWindow = window.open("","Mapař","width="+wWidth+",height="+wHeight+",resizable=yes");
  newWindow.document.open();
  newWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
  newWindow.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
  newWindow.document.write('<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1250"/>');
  newWindow.document.write('<title>Mapař</title>');
  newWindow.document.write('<link rel="stylesheet" type="text/css" href="../../res/pagestyles.css"/>');
  newWindow.document.write('</head><body><center>');
  newWindow.document.write('<p><img src="images/'+imageName+'" width="'+imageWidth+'" height="'+imageHeight+'" class="bigimg" alt="'+imageName.substr(1,11)+'"/></p>');
  var fbIdent = fbID(imageName);
  if (fbIdent == '')
  {
    newWindow.document.write('<b class="phid">'+imageName.substr(1,11)+'</b> ');
  }
  else
  {
    newWindow.document.write('<a href="http://www.fotobanka.cz/show.php?image_id='+fbIdent+'" target="_blank"><b class="phidr">'+imageName.substr(1,11)+' (nákup)</b></a> ');  
  }
  newWindow.document.write(alt);
  newWindow.document.write('</center></body></html>');
  newWindow.document.close();
  newWindow.focus();
}

