function galeriaView(photo, format)
{
  var photoSrc = photo.src;
  if (photoSrc.indexOf("-t.jpg") == -1)
    return;
    
  photoSrc = photoSrc.split("-t.jpg");
  photoSrc = photoSrc[0] + ".jpg";
  
  if (format == "portret")
  {
    var width = "510";
    var height = "730";
  }
  else if (format == "landscape")
  {
    var width = "730";
    var height = "550";
  }
  else
  {
    var width = "730";
    var height = "730";
  }

  var galeriaOkno = window.open(photoSrc,"gv","width="+width+",height="+height+",toolbar=no");
  if (galeriaOkno)
    galeriaOkno.focus();
}

function zvyrazniPole(obj)
{
  obj.style.backgroundColor = "#fffbe3";
}
function obnovPole(obj)
{
  obj.style.backgroundColor = "transparent";
}

function formSupport(fields)
{
  var fields = fields.split(",");
  
  for (var i=0; i < fields.length; i++)
  {
    if (fields[i] == "email")
    {
      var tmp = eval("document.forms.mail."+fields[i]+".value");
      if (tmp != "")
      {
        if (tmp.search(/^[a-zA-Z0-9]+[a-zA-Z0-9\_\.\-]*[a-zA-Z0-9]{1,}[\@]{1}[a-zA-Z0-9]+[a-zA-Z0-9\._-]{0,}[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/i) == -1)
        {
          alert("Impegnato e-mail non e corretto.");
          return (false);
        }
      }
    }
    
    if (fields[i] == "text")
    {
      var tmp = eval("document.forms.mail."+fields[i]+".value");
      if (tmp.length < 1)
        {
          alert("Scrive il testo di messaggio qui.");
          return (false);
        }
    }
  }
  return true;
}

/* media foos */
var wplayer = "";

function playMedia (mSrc, mTitle, mSubTitle, mPlace, mWidth, mHeight)
{
  if (typeof(mWidth) == "undefined")
    mWidth = "400";
  if (typeof(mHeight) == "undefined")
    mHeight = "340";
  if (typeof(mPlace) == "undefined" || mPlace == "")
    mPlace = "media";

  if (typeof(mSubTitle) != "undefined")
  {
    if (mSubTitle == " ")
      mSubTitle = "";
    else
      mSubTitle = "<br>(" + mSubTitle + ")";
  }

  if (document.getElementById("mediaTitle") != null)
  {
    if (typeof(mTitle) != "undefined")
    {
      if (mTitle == " ")
        document.getElementById("mediaTitle").innerHTML = "";
      else
        document.getElementById("mediaTitle").innerHTML = "<br /><h3 class=\"podnadpis vlavo\">" + mTitle + mSubTitle + "</h3><br>";
    }
  }

  wplayer = new SWFObject("/media/mediaplayer.swf", "single", mWidth, mHeight, "7");
  wplayer.addParam("allowfullscreen","true");
  wplayer.addVariable("file", mSrc);
  wplayer.addVariable("width", mWidth);
  wplayer.addVariable("height", mHeight);
  wplayer.addVariable("volume", "100");
  wplayer.addVariable("autostart", "true");
  wplayer.write(mPlace);
}

