﻿/*
  Projekt: BazenyMachov.cz
  Copyright: kvicerov.net
  Vytvoril: Martin Majoros
  Datum 21.08.2006
  Soubor: overmenu.js
  Funkce v projektu: Javascriptovy kod pro dynamicke menu
*/


<!--

// Funkce zjisti verzi a vlastnosti prohlizece
function getAppVersion() {
  appname= navigator.appName;
  appversion = navigator.appVersion;
  majorver = appversion.substring(0, 1);
  if ( (appname == "Netscape") && ( majorver >= 3 ) ) return 1;
  if ( (appname == "Microsoft Internet Explorer") && (majorver >= 4) ) return 1;
   return 0;
}


// Funkce ktera prohodi obrazky, jejim vstupem je cislo obrazku v poli source_img a jmeno obrazku ve strukture html
function change_img(num, imgname) {
  if (getAppVersion()) {
    var i = document.getElementById(imgname);
    i.src = img[num].src;
  }
}

function translation(lang) {

  var currentUrl = window.location.href;
  var currentLang = "";
  var isHomePage = 0;

  if (currentUrl.search("/cz/") > 0) {     
     currentLang = "cz";
     isHomePage = -1;
  }  
  else if (currentUrl.search("/en/") > 0) {
    currentLang = "en";
    isHomePage = -1;
  }
  else if (currentUrl.search("/de/") > 0) {
    currentLang = "de";
    isHomePage = -1;
  }
  else if (currentUrl.search("/pl/") > 0) {
    currentLang = "pl";
    isHomePage = -1;
  } else 
  {
    currentLang = "cz";
    isHomePage = 1;
  }     
  if (isHomePage == -1){
    var newUrl = currentUrl.replace("/" + currentLang + "/", "/" + lang + "/");
    window.location = newUrl;
  }
  else if (isHomePage == 1) {
    var newUrl = currentUrl.replace(".cz/", ".cz/" + lang + "/");
    window.location = newUrl;    
  }  
}



// Pole ktere obsahuje cesty k potrebnym souborum v menu
source_img = new Array();

// Obrazky pri umisteni mysi mimo obrazek
source_img[1] = "img/mn_about_company.gif";
source_img[2] = "img/mn_products.gif";
source_img[3] = "img/mn_photos.gif";
source_img[4] = "img/mn_contact.gif";


// Obrazky pri umisteni mysi na obrazkem
source_img[5] = "img/mn_about_company_selected.gif";
source_img[6] = "img/mn_products_selected.gif";
source_img[7] = "img/mn_photos_selected.gif";
source_img[8] = "img/mn_contact_selected.gif";



// Vytvori obrazky podle pole source_img a pripravi pro budouci pouziti
if (getAppVersion()) {
  img = new Array();
  for (i = 0; i < source_img.length; i++) {
    img[i] = new Image();
    img[i].src = source_img[i];
  }
}

//-->
