﻿// Custom functions

// Search

function fnSearch() {
             if (GetElement('EXPS').value.length<4 && GetElement('EXPS').value!='hledej...')  {
                  alert('Uveďte minimálně 4 znaky.');return false;
            } 
            else {
                   SetForm('/vyhledavani/default.aspx?catId=3145&txbSearch=' + GetElement('EXPS').value,true);} 
            }

function fnLogIN()
{debugger;
if (typeof(Page_ClientValidate) == 'function') 
{Page_ClientValidate();}

SetInternal('LogInClicked');

document.forms[0].submit();
}
		
// Newsletter - Validate Subscriber

function ValidateSubscriber()
{
if(!IsEmail(GetElement('SubMail'),true,'Neplatná emailová adresa !',false)) return false;
SetInternal('ActivateSubscriber');
document.forms[0].submit();
}

// Newsletter - Remove Subscriber

function RemoveSubscriber()
{
SetInternal('RemoveDailySubscriber');
document.forms[0].submit();
}

/* ------ DropDown Menu Position ------ */
function GetCustomMenuPositionRoot(pos)
{
   pos.x=-5;
   pos.y=35;
}

function GetCustomMenuPositionChildren(pos)
{
   pos.x=-6;
   pos.y=2;
}

//*********************************** 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');
}
