// JavaScript Document

//SHOW TABS (V.2)
function changeTab(tab) {
  aTab = new Array("descr", "multimedia", "specs", "gallery", "info", "similar");
  for (i = 0; i < aTab.length; i++) {
    if (obj = document.getElementById("detail-"+aTab[i])) {
      if (tab == aTab[i]) {
        obj.style.display = "block";
        if (obj2 = document.getElementById("tab-"+aTab[i])) {
          obj2.className = "tab-selected";
        }
      } else {
        obj.style.display = "none";
        if (obj2 = document.getElementById("tab-"+aTab[i])) {
          obj2.className = "tab-unselected";
        }
      }
    }
  }
  if (obj = document.getElementById("ref-"+tab)) obj.focus();
  return false;
}
//------------------------------------------------------------------------------


//Náhled obrázku na stránce s podrobnostmi
function nahled(cesta) {
  mywin=window.open(
    '','náhled',
    'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,'+
    'width=480,height=500'
  );
  with(mywin.document){
    open('text/html');
    write(
      '<html>\n'+
      '<head>\n'+
      ' <meta http-equiv="content-type" content="text/html; charset=utf-8">\n'+
	  ' <title>Astra spol. s r.o. - Náhled obrázku</title>\n'+
      '</head>\n'+
      '<body>\n'+
      ' <center>\n'+
      '   <a href="javascript:close()"><img src="' + cesta + '" border="0" alt="Kliknutím na obrázek zavřete okno"></a><br>\n'+
      '   <font style="font-family: arial; font-size: 10pt; color: #505050">Kliknutím na obrázek zavřete okno.</font>\n'+
      ' </center>\n'+
      '</body>' +
      '</html>'
    );
    close();
  }
}

//otevření okna fotogalerie
function otevri_fotogalerii(cesta) {
  window.open(cesta, 'Náhled', 'toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=550,height=575');
}

function CheckEmail(S) {
  //pozice posledního znaku
  var LastChar = S.length - 1;

  //pozice zavináče
  var CharPos = S.indexOf("@");
  if ((CharPos < 1) || (CharPos == LastChar)) return false;

  //pozice první tečky
  var CharPos = S.indexOf(".");
  if (CharPos < 1) return false;

  //pozice pslední tečky
  var CharPos = S.lastIndexOf(".");
  if (CharPos == LastChar) return false;

  return true;
}

/*
function check_rules(_id) {
         //zruseni varovnych hlaseni
   alert_messages='';
   for (rule in list_rules) {

      // nacteni objektu
      obj=getObj(list_rules[rule][0]);

      // porovnani dvou polozek (delano pro hesla)
      if (list_rules[rule][3]) {
         if (obj.value != getObj(list_rules[rule][3]).value) alert_messages=alert_messages+'\t'+list_rules[rule][2]+'\n';

      // porovnani obsahu formularoveho prvku s regularnim vyrazem
      } else {
         if (!obj.value.match(list_rules[rule][1])) alert_messages=alert_messages+'\t'+list_rules[rule][2]+'\n';
      }
   }
   if (alert_messages) {
      alert ('Následující položky nejsou zadány dobře:\n\n'+alert_messages)
      return false;
   } else {
      return true;
   }
}

   list_rules = new Array();


   list_rules[1] = new Array();
   list_rules[1][0] = 'email';
   list_rules[1][1] = /^[A-Za-z0-9_\.\-]+@[A-Za-z0-9_\.\-]+\.[A-Za-z0-9]+$/;
   list_rules[1][2] ='Email';
*/


//OBJEDNÁVKA
function objednat() {
  self.location = "objednat.php";
}
//------------------------------------------------------------------------------


//FLASH OPEN
function flashOpen(src) {
  if (win = window.open(src, "", "toolbar=0,menubar=0,location=no,directories=no,scrollbars=no,resizable=no,status=no,width=800,height=550,top=0,left=0")) {
    return false;
  } else {
    return true;
  }
}
//------------------------------------------------------------------------------
