﻿//**************************************************
function GetObject(oName){
	return document.getElementById(oName);
}

//**************************************************
// SEARCH HANDLER
//**************************************************
function StartSearch(){
	var SearchText = GetObject("SearchText").value;
	document.location = "/vyhledavani/sr-1/default.aspx?searchtext=" + encodeURI(SearchText);
}


//**************************************************
// FULL SIZE IMAGE HANDLER
//**************************************************
var ArImage = null;

function ShowFullThumbNail(id_file, width, height, title){
	window.open("/ShowFullThumbNail.aspx?id_file=" + id_file + "&width=" + width + "&height=" + height + "&title=" + title,"fullImage" + id_file, "scrollbars=no,status=yes,width=" + width + ",height=" + height);
	return false;
}
//**************************************************
function ShowArticleImage(id_file, width, height, title, id_article){
	if(arguments.length==4 || !ArImage){
		return ShowFullThumbNail(id_file, width, height, title)
	}else{
		window.open("/ShowArticleImages.aspx?file=" + id_file + "&article=" + (!ArImage ? "" : ArImage), "fullImage" + id_file, "scrollbars=no,status=yes,width=800,height=600");
		return false;
	}
}

function ClickLinkButton(ButtonId, e)
{
	if(!e)
	{
		e = window.event;
	};
	var wkey;
	var wsrc;
	if (e.keyCode) wkey = e.keyCode;
	else if (e.which) wkey = e.which;

	if (e.target) wsrc = e.target;
	else if (e.srcElement) wsrc = e.srcElement;
	if (wsrc.nodeType == 3) // defeat Safari bug
		wsrc = wsrc.parentNode;

	if(wkey!=13)
	{
		return true;
	}

	eval(unescape(GetObject(ButtonId).href).replace("javascript:", ""));
}

function SearchWeb(TextToSearch, e)
{
	if(!e)
	{
		e = window.event;
	};
	var wkey;
	var wsrc;
	if (e.keyCode) wkey = e.keyCode;
	else if (e.which) wkey = e.which;

	if (e.target) wsrc = e.target;
	else if (e.srcElement) wsrc = e.srcElement;
	if (wsrc.nodeType == 3) // defeat Safari bug
		wsrc = wsrc.parentNode;

	if(wkey!=13)
	{
		return true;
	}

	document.location = "/vyhledavani/sr-1/default.aspx?searchtext=" + TextToSearch;
	void(0);
	return false;
}
