﻿// Custom functions
function ValidateSendMail()
{
if(!IsNoEmpty(GetElement('Name'),true,3,'Vyplňte prosím políčko Jméno','Pole Jméno musí obsahovat nejméně 3 znaky'))return false;	
if(!IsEmail(GetElement('SenderEmail'),true,'Vložte prosím platnou e-mailovou adresu.',false))return false;	
if(!IsEmail(GetElement('RecipientEmail'),true,'Vložte prosím platnou e-mailovou adresu.',false))return false;	
if(!IsNoEmpty(GetElement('Remark'),true,3,'Vyplňte prosím políčko Titulek.','Pole Titulek  musí obsahovat nejméně 3 znaky'))return false;	
return true;
}
// vyhledavani ve slovniku
function SearchDict()
{
    var elm = document.getElementById("word");
    if (elm != null && elm.value != "hľadaj...")
    {
        var url = cutUrlParams(window.location.href, ["PageId","Letter","Text"]);
        url = setNiceUrlParameter(url, "text", escape(elm.value));
        window.location.href = url;
    }
}

// vyhledavani SK
function fnSearch() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='hľadaj...')  {
                  alert('Uveďte aspoň 4 znaky.');return false;
            } 
            else {
                   SetForm('/hladanie/default.aspx?catId=2516&txbSearch=' + GetElement('EXPS').value,true);} 
            }


// vyhledavani CZ
function fnSearchCz() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='hladaj...')  {
                  alert('Uveďte aspoň 4 znaky.');return false;
            } 
            else {
                   SetForm('/hladanie/default.aspx?catId=5038&txbSearch=' + GetElement('EXPS').value,true);} 
            }
			
// vyhledavani SKEN
function fnSearchSkEn() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='hladaj...')  {
                  alert('Uveďte aspoň 4 znaky.');return false;
            } 
            else {
                   SetForm('/search/default.aspx?catId=7564&txbSearch=' + GetElement('EXPS').value,true);} 
            }

// vyhledavani SKDE
function fnSearchSkDe() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='Suche...')  {
                  alert('Geben Sie mindestens 4 Zeichen an.');return false;
            } 
            else {
                   SetForm('/search/default.aspx?catId=15134&txbSearch=' + GetElement('EXPS').value,true);} 
            }

// vyhledavani CZDE
function fnSearchSkDe2() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='Suche...')  {
                  alert('Geben Sie mindestens 4 Zeichen an.');return false;
            } 
            else {
                   SetForm('/search/default.aspx?catId=20182&txbSearch=' + GetElement('EXPS').value,true);} 
            }



/* ------ Bocni dropdown Menu ------ */
function GetCustomMenuPositionRoot(pos)
{
var el=window.event.srcElement;
while (el.tagName!="LI")
el=el.parentNode;

   pos.x=-20;
   pos.y=el.offsetTop;
   
	if (!Br.IE)
	{
		pos.x+=document.getElementById("RIGHT").offsetLeft;
		pos.y+=document.getElementById("LEFT").offsetTop;
	}
}

function GetCustomMenuPositionChildren(pos)
{
   pos.x=-40;
   pos.y=0;
}

window.onload=wload;

function wload()
{
	if (Br.IE)
		return;

	window.event=new ieEvent();

	var menus=document.getElementsByTagName("menu");
	for (var a=0;a<menus.length;a++)
		for (var b=0;b<menus[a].childNodes.length;b++)
		{
			var item=menus[a].childNodes[b];
			if (item.onmouseover!=null)
			{
				item.puvodni_rutina=item.onmouseover;
				item.onmouseover=ffMouseOver;
			}
		}
}

function ffMouseOver(ev)
{
	window.event.srcElement=ev.target;
	this.puvodni_rutina();//(ev.target.id.substring(1),ev.target.id);
}

function ieEvent()
{
	this.srcElement=null;
}

//*********************************** GALLERY ***************************************

function ClickEvent(e)
{
	var obj;
	var i=0;
	var title = "DISA Group GALLERY";
	
	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;
			GaleryView(obj, title);
		}
} 

function GaleryView(obj, title)
{
	var ImgURL="";
	var nDot=0;
	var nWidth=10, nHeight=30;
	var _child;
	if (typeof(obj)!='object') return false;
	ImgURL = obj.src;
	if (ImgURL=="" && ImgURL=="undefined") return false;
	nDot = ImgURL.lastIndexOf(".");
	ImgURL = ImgURL.substr(0, nDot) + "big" + ImgURL.substr(nDot, ImgURL.length);

	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');
}