function formatTable()
{
  var tbl = document.getElementById("schedule");
  var class_name;

  if (tbl) {
    for (var i=0; i<tbl.rows[0].cells.length; i++)
    {

      if (i == 0) {
        class_name = "header header_first";
      } else if (i == (tbl.rows[0].cells.length-1)){
        class_name = "header header_last";
      } else {
        class_name = "header";
      }

       tbl.rows[0].cells[i].className = class_name;
    }

    for (var i=1; i<tbl.rows.length; i++)
    {
      for (var j=0; j<tbl.rows[0].cells.length; j++)
      {
        if (i % 2 == 0) tbl.rows[i].cells[j].className = "even";
      }
    }
  }
}

function validate(frm)
{
  if (frm.elements["full_name"].value == "")
  {
  	alert(frm.elements["full_name"].title);
  	frm.elements["full_name"].focus();
  	return false;
  }

  if (frm.elements["telephone"].value == "")
  {
  	alert(frm.elements["telephone"].title);
  	frm.elements["telephone"].focus();
  	return false;
  }

  if (frm.elements["email"].value == "")
  {
  	alert(frm.elements["email"].title);
  	frm.elements["email"].focus();
  	return false;
  }

  if (!frm.elements["email"].value.match(/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/))
  {
  	alert(frm.elements["email"].title);
  	frm.elements["email"].focus();
  	return false;
  }

  return true;
}

var popUp = null;
function printIt(lang, id)
{
  var iWidth = 754;
  var iHeight = 600;

  var iLeft = (screen.width  - iWidth) / 2 ;
  var iTop  = (screen.height - iHeight) / 2 ;

  var iUrl     = "index.php?screen=printable&id=" + id + "&lang=" + lang;
  var iTitle   = "PopUpWindow"
  var iOptions = 'width='+iWidth+',height='+iHeight+',top='+iTop+',left='+iLeft+',toolbar=0,directories=0,menubar=0,status=0,resizable=0,location=0,scrollbars=1,titlebar=0,dependent=yes'

  if (!popUp || popUp.closed)
  {
    popUp = window.open(iUrl, iTitle, iOptions);
  } else {
    popUp.focus();
  }
}

$(document).ready(function()
{
  $(".subject").change(function(){
    $("#workshop").attr("value", "");
    $("#masterclass").attr("value", "");
  });
  
  $('.lightbox').lightBox({
		fixedNavigation: true,
		imageLoading: '../images/lightbox/loading.gif',
		imageBtnPrev: '../images/lightbox/previous.gif',
		imageBtnNext: '../images/lightbox/next.gif',
		imageBtnClose: '../images/lightbox/close.gif',
		imageBlank: '../images/lightbox/blank.gif',
		txtImage: 'Εικόνα',
		txtOf: 'από'
	});
});
