// ************************************************************
//		JavaScript code ued through out SimpleNews
// ************************************************************

var i=15;
/*function odecitej()
{
i=i-1;
document.forms["kom"].tlacitko.value = "Antispam delay " + i + " sec";
if (i > 0)
 setTimeout("odecitej()", 1000);
else 
document.forms["kom"].tlacitko.value = "Odešli (Submit)";
} 
*/
var winhandle = null;

function popUp(aURL, aWidth, aHeight, aTitle) {
  if ((winhandle != null) && (! winhandle.closed)){

    winhandle.document.images.src=aURL;

    var isNN=(navigator.appName=="Netscape")?1:0;
    var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

    if (isNN) {
      winhandle.innerHeight = aHeight + 20;
      winhandle.innerWidth  = aWidth + 20;
      winhandle.innerHeight = aHeight;
      winhandle.innerWidth  = aWidth;
    }
    else if (isIE) {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
      dWidth = aWidth - winhandle.document.body.clientWidth;
      dHeight = aHeight - winhandle.document.body.clientHeight;
      winhandle.resizeBy(dWidth, dHeight);
    }
    else {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
    }

  }
  else
  {
    winhandle=window.open("", "imagewin", 'width=' + aWidth + ', height=' + aHeight);

    with (winhandle.document){

      writeln('<html><head>');
      writeln('<title>' + aTitle + '</title>');
      writeln('<meta http-equiv="imagetoolbar" content="no">');
      writeln('</head>');
      writeln('<body bgcolor="#000000" topmargin="0" leftmargin="0" style="margin:0px;">');
      writeln('<a href="javascript:window.close();"><img name="arlesimage" src="' + aURL + '" style="display:block" border="0"></a>');
      writeln('</body></html>');
      close();
    }
  }

  winhandle.focus();

}

function videoUp(aURL, aWidth, aHeight, aTitle) {
  if ((winhandle != null) && (! winhandle.closed)){

    winhandle.document.images.src=aURL;
//    winhandle.document.images["arlesimage"].src=aURL;

    var isNN=(navigator.appName=="Netscape")?1:0;
    var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

    if (isNN) {
      winhandle.innerHeight = aHeight + 20;
      winhandle.innerWidth  = aWidth + 20;
      winhandle.innerHeight = aHeight;
      winhandle.innerWidth  = aWidth;
    }
    else if (isIE) {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
      dWidth = aWidth - winhandle.document.body.clientWidth;
      dHeight = aHeight - winhandle.document.body.clientHeight;
      winhandle.resizeBy(dWidth, dHeight);
    }
    else {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
    }

  }
  else
  {
    winhandle=window.open("", "imagewin", 'width=' + aWidth + ', height=' + aHeight);

    with (winhandle.document){

      writeln('<html><head>');
      writeln('<title>' + aTitle + '</title>');
      writeln('<meta http-equiv="imagetoolbar" content="no">');
      writeln('</head>');
      writeln('<body bgcolor="#000000" topmargin="0" leftmargin="0" style="margin:0px;">');
      writeln('<object width="430" height="355"><param name="movie" value="http://www.youtube.com/' + aURL + '&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/' + aURL+ '&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>');
      writeln('</body></html>');
      close();
    }
  }

  winhandle.focus();

}

function LogPopUp(aLog) {
  var zb = 'OK2KJT';
  var newurl = '../web/showlog.php?log=' + aLog;
  var newwin = window.open(newurl,zb,'width=500,height=500,resizable=yes,location=no,toolbar=no,menubar=yes,scrollbars=yes,directories=no');
  if (newwin != null && newwin.opener == null)
    newwin.opener = self;
  newwin.focus();
}

function eQSLPopUp(call, idqso) {
  var aWidth = 528;
  var aHeight = 339;
  var aTitle = "eQSl by OK2KJT";

  if ((winhandle != null) && (! winhandle.closed)){

    winhandle.document.images["arlesimage"].src=aURL;

    var isNN=(navigator.appName=="Netscape")?1:0;
    var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

    if (isNN) {
      winhandle.innerHeight = aHeight + 20;
      winhandle.innerWidth  = aWidth + 20;
      winhandle.innerHeight = aHeight;
      winhandle.innerWidth  = aWidth;
    }
    else if (isIE) {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
      dWidth = aWidth - winhandle.document.body.clientWidth;
      dHeight = aHeight - winhandle.document.body.clientHeight;
      winhandle.resizeBy(dWidth, dHeight);
    }
    else {
      winhandle.resizeTo(aWidth + 10, aHeight+29);
    }

  }
  else
  {
    winhandle=window.open("", "imagewin", 'width=' + aWidth + ', height=' + aHeight);

    with (winhandle.document){

      writeln('<html><head>');
      writeln('<title>' + aTitle + ' for ' + call + '</title>');
      writeln('<meta http-equiv="imagetoolbar" content="no">');
      writeln('</head>');
      writeln('<body bgcolor="#000000" topmargin="0" leftmargin="0" style="margin:0px;">');
      writeln('<a href="javascript:window.close();"><img name="eQSL-OK2KJT-' + call + '" src="../web/getqsl.php?id=' + idqso + '" style="display:block" border="0" title="Press Ctrl+P to print"></a>');
      writeln('</body></html>');
      close();
    }
  }

  winhandle.focus();

}

// Next Contest Countdown
var cas;
var nazev, ndny, text;
var delka, sirka;
var dny, hodiny, minuty, sekundy;
obr = new Image();
obr.src = "images/teplomer.gif"
obr1 = new Image();
obr1.src = "images/teplota.gif"
function countdown(nazev,cas,delka)
{
cas3 = cas - 1 ; //cas 3 - konec zavodu
cas2 = cas - 1 - (delka * 3600); //cas2 - zacatek zavodu
dny = Math.floor(cas2 / 86400);
ndny = "day";
if (dny > 1)
  ndny = "days";

hodiny = Math.floor((cas2 - (dny * 86400))/3600);
minuty = "0" + Math.floor((cas2 - (dny * 86400) - (hodiny * 3600))/60);
min = minuty.substr(minuty.length-2,2);
sekundy = "0" + Math.floor(cas2 - (dny * 86400) - (hodiny * 3600) - (minuty * 60));
sec = sekundy.substr(sekundy.length-2,2);
text = "<font color='#000000'>";
if (dny > 0)
  text = text + dny + " " + ndny + " ";
text = text + hodiny + ":" + min + ":" + sec + "</font>";
document.getElementById('countdown').innerHTML = text;
nazev2 = nazev;
delka2 = delka;
if (cas3 > (delka * 3600)) 
  setTimeout('countdown(nazev2,cas3,delka2)', 1000);
else {
  sirka = (((delka * 3600)-cas3) / (delka * 3600))* 110; //Vypocet sirky teplomeru
  document.getElementById('countdown').innerHTML = "<font color='#fe6903'><b>In progress</b></font>";
  document.getElementById('countdown2').style.background = "url(../index/images/teplomer.gif) no-repeat center bottom";
  document.getElementById('countdown2').innerHTML = "<img src='../index/images/teplota.gif' style='align: left; margin-left: 4px; width: "+ sirka+"px; height: 13px;'>";
  setTimeout('countdown(nazev2,cas3,delka2)', 100000);
}  
}

