﻿function OverServis ()
{
   if (document.design.Element0.value == "")
   {
      document.design.Element0.focus();
      alert ("Nezadal(a) jste Vaše jméno");
      return false;
   }
   if (document.design.Element1.value == "")
   {
      document.design.Element1.focus();
      alert ("Nezadal(a) jste Vaše přijmení");
      return false;
   }
   if (document.design.Element2.value == "")
   {
      document.design.Element2.focus();
      alert ("Nezadal(a) jste název ulice");
      return false;
   }
   if (document.design.Element3.value == "")
   {
      document.design.Element3.focus();
      alert ("Nezadal(a) jste město");
      return false;
   }
   if (document.design.Element4.value == "")
   {
      document.design.Element4.focus();
      alert ("Nezadal(a) jste PSČ");
      return false;
   }
  if (document.design.Element5.value == "")
   {
      document.design.Element5.focus();
      alert ("Nezadal(a) jste stát");
      return false;
   }
 
   if (document.design.Element6.value == "")
   {
      document.design.Element6.focus();
      alert ("Nezadal(a) jste telefon");
      return false;
   }
   inpCell=document.design.Element6.value;
   tel=/^[0-9]{9,12}$/
   if (!tel.test(inpCell))
   {
      document.design.Element6.focus();
      alert ("Chybný formát telefonního čísla");
      return false;
   }

   
   if (document.design.Element8.value == "")
   {
      document.design.Element8.focus();
      alert ("Nezadal(a) jste Váš e-mail");
      return false;
   }
   inpMail=document.design.Element8.value;
   mail=/^.+@.+\..{2,3}$/;
   if (!mail.test(inpMail))
   {
      document.design.Element8.focus();
      alert ("Chybný formát e-mailu");
      return false;
   }


}

function GetCustomMenuPositionRoot(pos)
{
	pos.x=-1;
	pos.y=278;
}

function GetCustomMenuElementTagName(root)
{
	return "BODY";
}




var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

var someMenuEntered = 0;
var mainMenuVisible = 0;
var regionMenuVisible = 0;
var reglocMenuVisible = 0;
var currentVisibleLocMenu = 0;
var currentScript = 'none';

function getObj(id) {
  if (isDOM) return document.getElementById(id);
  if (isIE4) return document.all[id];
  if (isNS4) return document.layers[id];
}

function setTopOffset() {
  if (navigator.appName.indexOf('Microsoft') < 0) {
    getObj('body_table').style.top='-2px';
    getObj('bottom_line').style.top='-2px';
  }
}

function selectTopItem(obj) {
  getObj(obj).style.color='black';
  getObj(obj).style.background='#ffd469';
}

function selectMenuItem(obj) {
  getObj(obj).style.color='black';
  getObj(obj).style.background='#ffd469';
}

function deselectTopItem(obj) {
  getObj(obj).style.color='white';
  getObj(obj).style.background='black';
}

function deselectMenuItem(obj) {
  getObj(obj).style.color='black';
  getObj(obj).style.background='#c4daf7';
}

function setCurrentScript(sname) {
  currentScript = sname;
}

function checkDropMenu(id) {
  if (id == 1) someMenuEntered = 1;
  if (id == 0) {
    if (someMenuEntered == 1) {
      hideMainMenu();
      hideRegionMenu();
      hideRegLocMenu();
      hideCurrentLocMenu();
      someMenuEntered = 0;
    }
  }
}

function toggleMainMenu() {
  if (mainMenuVisible == 0) {
    hideRegionMenu();
    hideRegLocMenu();
    hideCurrentLocMenu();
    showMainMenu();
  } else {
    hideMainMenu();
  };
}

function showMainMenu() {
  mainMenuVisible = 1;
  getObj('main_menu').style.display='block';
}

function hideMainMenu() {
  mainMenuVisible = 0;
  getObj('main_menu').style.display='none';
}

function toggleRegionMenu() {
  if (regionMenuVisible == 0) {
    hideMainMenu();
    hideRegLocMenu();
    hideCurrentLocMenu();
    showRegionMenu();
  } else {
    hideRegionMenu();
  };
}

function showRegionMenu() {
  regionMenuVisible = 1;
  var l = getObj('mtop1').clientWidth + 15;
  getObj('region_menu').style.left = l + 'px';
  getObj('region_menu').style.display='block';
}

function hideRegionMenu() {
  regionMenuVisible = 0;
  getObj('region_menu').style.display='none';
}

function toggleRegLocMenu() {
  if (reglocMenuVisible == 0) {
    hideMainMenu();
    hideRegionMenu();
    hideCurrentLocMenu();
    showRegLocMenu();
  } else {
    hideCurrentLocMenu();
    hideRegLocMenu();
  }
}

function showRegLocMenu() {
  reglocMenuVisible = 1;
  var lof = getObj('mtop1').clientWidth + getObj('mtop2').clientWidth + 17;
  getObj('regloc_menu').style.left = lof + 'px';
  getObj('regloc_menu').style.display='block';
}

function hideRegLocMenu() {
  reglocMenuVisible = 0;
  getObj('regloc_menu').style.display='none';
}

function callScript(sname) {
  var url = sname + '?lang=1&rg=4&loc=3&prg=0';
  location.href = url;
}

function callScriptCamera(sname, cpart, camid) {
  var url = sname + '?lang=1&rg=4&loc=3&cpart=' + cpart + '&cam=' + camid;
  location.href = url;
}

function callScriptRegionData(sname,id) {
  var url = sname + '?lang=1&rg=' + id;
  location.href = url;
}

function callScriptAllData(sname) {
  var url = sname + '?lang=1';
  location.href = url;
}

function callURL(url) {
  location.href = url;
}

function callCurrentScript(id) {
  var url = currentScript + '?lang=1&rg=' + id + '&loc=3';
  location.href = url;
}

function callCurrentScriptAllData() {
  var url = currentScript + '?lang=1';
  location.href = url;
}

function callLocation(rg,loc) {
  var url = 'stredisko.php?lang=1&rg=' + rg +'&loc=' + loc;
  location.href = url;
}

function showLocMenu(id,por) {
  var tof = (getObj('regloc' + id).clientHeight * por) + por + 15;
  var lof = getObj('mtop1').clientWidth + getObj('mtop2').clientWidth + getObj('regloc_menu').clientWidth + 17;
  hideCurrentLocMenu();
  getObj('loc_menu' + id).style.left = lof + 'px';
  getObj('loc_menu' + id).style.top = tof + 'px';
  getObj('loc_menu' + id).style.display = 'block';
  currentVisibleLocMenu = id;
}

function hideCurrentLocMenu() {
  if (currentVisibleLocMenu != 0) {
    getObj('loc_menu' + currentVisibleLocMenu).style.display='none';
    currentVisibleLocMenu = 0;
  }
}

function WebLauncher(adr) {
  var url = "http://" + adr;
  if (adr.indexOf("http") == 0) url = adr;
  window.open(url,"","toolbar=no,scrollbars=yes,location=no,status=no,left=10,top=50,width=800,height=500,resizable=1");
}

function ImageLauncher(id,rg,loc) {
  var akce = "wimg.php?id=" + id + "&kat=20&rg=" + rg + "&loc=" + loc;
  window.open(akce,"","toolbar=no,scrollbars=yes,location=no,status=no,left=10,top=10,width=460,height=330,resizable=1");
}

function ImageLauncherLet(id,rg,loc) {
  var akce = "wimg4.php?id=" + id + "&kat=3&rg=" + rg + "&loc=" + loc;
  window.open(akce,"","toolbar=no,scrollbars=yes,location=no,status=no,left=10,top=10,width=460,height=330,resizable=1");
}

function showCamera(listObj) {
  var id_cam=listObj.options[listObj.selectedIndex].value;
  var akce = "kamera.php?lang=1&id_cam=" + id_cam;
  location.replace(akce);
}

function showVideo(rg,loc,cid) {
  var akce = "http://www.holidayinfo.cz/zima/kamera.php?lang=1&ro=1&cntry=1&rg=" + rg + "&loc=" + loc + "&cat=" + cid + "&cam=2014&pic=0&vid=1&gstart=0";
  window.open(akce,"","toolbar=no,scrollbars=no,location=no,status=no,left=40,top=20,width=400,height=500,resizable=1");
}

function checkUbytovani(rg,loc) {
  if (getObj('ubyt_form').mail.value == '') {
    alert('Vyplňte Váš e-mail prosím!');
    return false;
  }

  return true;
}

var bannerLink = 'http://www.rwe.cz';
var bannerLinkArray = new Array;
bannerLinkArray[0]='http://www.rwe.cz';
bannerLinkArray[1]='http://www.rwe.cz';
bannerLinkArray[2]='http://www.rwe-transgas.cz';
bannerLinkArray[3]='http://www.rwe-transgas.cz';
bannerLinkArray[4]='http://www.rwe-transgas.cz';
bannerLinkArray[5]='http://www.rwe-jmp.cz';
bannerLinkArray[6]='http://www.rwe-scp.cz';
bannerLinkArray[7]='http://www.rwe-smp.cz';
bannerLinkArray[8]='http://www.rwe-stp.cz';
bannerLinkArray[9]='http://www.rwe-vcp.cz';
bannerLinkArray[10]='http://www.rwe-zcp.cz';

function setBannerLink(bid) {
  var btt = 2000;

  bannerLink = bannerLinkArray[bid];

  bid = bid + 1;
  if (bid == 11) bid = 0;

  if ((bid == 2) || (bid == 3) || (bid == 4)) btt = 1000;
  setTimeout("setBannerLink(" + bid + ")", btt);
}

function showBannerLink() {
  window.open(bannerLink,"","toolbar=no,scrollbars=yes,location=no,status=no,left=10,top=50,width=800,height=500,resizable=1");
}

function showTVTimes() {
  window.open("showtimes.php?rg=4&loc=3&lang=1","","toolbar=no,scrollbars=yes,location=no,status=no,left=10,top=50,width=200,height=80,resizable=1");
}

//*********************************** GALLERY ***************************************

function ClickEvent(e)
{
	var obj;
	var i=0;
	var title = "Figura";
	var ImgURL="";
	var nDot=0;
	
	if (Br.IE)
		obj = window.event.srcElement;
	else
		obj = e.target;

	while(obj.parentNode.tagName!="TBODY" && obj.parentNode.tagName!="TABLE" && i<20)
	{
		obj = obj.parentNode;
		i++;
	}
	obj = obj.childNodes[0].childNodes[0];

	if (typeof(obj)=='object')
		if (obj.tagName=='IMG')
		{
			if (obj.alt!="") title=obj.alt;

			ImgURL = obj.src;
			if (ImgURL=="" && ImgURL=="undefined") return false;
			nDot = ImgURL.lastIndexOf(".");
			ImgURL = ImgURL.substr(0, nDot) + "big" + ImgURL.substr(nDot, ImgURL.length);

			GaleryView(ImgURL, title);
		}
} 
function GaleryView(ImgURL, title)
{
	var nWidth=10, nHeight=50;
	var _child;
	if (ImgURL=="" && ImgURL=="undefined") return false;

	if (Br.NS)
	{
		nWidth += 14;
		nHeight += 23;
	}

	_child=window.open("about:blank","","height=200,width=200");
	_child.document.write('<html>\n')
	_child.document.write(' <head><title>' + title + '</title></head>\n')
	_child.document.write(' <body leftMargin=0 topMargin=0  onclick="window.close()" style="cursor:pointer; font-family:Verdana; font-size:14px;font-weight:bold;">\n')
	_child.document.write('<script language="javascript">\n');
	_child.document.write('function ResizeWin()');
	_child.document.write('	{window.resizeTo(document.getElementById("foto").width+' + nWidth + ',document.getElementById("foto").height+' + nHeight + ');}\n');
	_child.document.write('function notLoaded()');
	_child.document.write('	{document.getElementById("foto").style.display="none";\n');
	_child.document.write('	document.getElementById("errTxt").style.display="block";');
	_child.document.write('	window.resizeTo(350, 40)}');
	_child.document.write('</script>\n');
	_child.document.write('<div style="display:none;width:100%;padding-top:25px;text-align:center;" id="errTxt">THE PICTURE IS NOT AVAILABLE.</div>\n');
	_child.document.write('<img src="' + ImgURL + '" alt="Click to close this window." id=foto onload="ResizeWin()" onerror="notLoaded()">\n');
	_child.document.write(' </body>\n');
	_child.document.write('</html>\n');
}
