window.onload = function (){
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("menu");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        node.onmouseover=function() {
          this.className+=" over";
        }
        node.onmouseout=function() {
          this.className=this.className.replace(" over", "");
        }
      }
    }
  }
}	

function CheckSearch(form){
	if(form.code.value=='' && form.name.value=='' && form.vrata.value==''){
		alert('Zadejte, prosím, minimálně jednu podmínku.');
		return false;
	}
}

function OpenImg(obj){
  var src = obj.src
  src = src.replace(".jpg", "_2.jpg")
  wnd = window.open( src, "image", "status=0,toolbar=0,menubar=0,location=0,resizable=0,scrollbars=0" );
  if( typeof(wnd.focus) == "object" )
  	wnd.focus();
}

function checkForm(form){
  var ErrList = '';
  if(form.comname) if(form.comname.value == '') ErrList = ErrList + '   Firma / Jméno příjmení\n';
  if(form.comstreet) if(form.comstreet.value == '') ErrList = ErrList + '   Ulice\n';
  if(form.comcity) if(form.comcity.value == '') ErrList = ErrList + '   Město\n';
  if(form.compsc) if(form.compsc.value == '') ErrList = ErrList + '   PSČ\n';
  if(form.comtel) if(form.comtel.value == '') ErrList = ErrList + '   Telefon\n';
  if(form.comemail) if(form.comemail.value == '') ErrList = ErrList + '   E-mail\n';
  if(ErrList != ''){
    ErrList = 'Nebyly vyplněny tyto položky dodací adresy:\n\n'  + ErrList;
    alert(ErrList);
    return false;
  }
}


function SeoEncode(strS){
	var strRepChar = '-';
	var strC, strCL, lngI
	SeoEncode = '';
	strS = strS.toLowerCase();
	for(lngI = 0; lngI < strS.length; lngI++){
		strC = strS.substr(lngI, 1)
		if(!((strC >= 'a' && strC <= 'z') || (strC >= '0' && strC <= '9') || strC == strRepChar)){
			strC = strRepChar
		}
		if(!(strC == strRepChar) || !(strCL ==  strRepChar)){
			strCL = strC
	    SeoEncode = SeoEncode + strC 
		}
	}
}
