<!--
/*
	============================================================
	Basic fce
	============================================================
	Copyright: www.eastburger.cz (c) 2009 All rights reserved.
	============================================================
 	Spoluprace:
	------------------------------------------------------------
*/


function ConfirmWindow(sMsg){
	if(sMsg == '') sMsg = lgCheckDeleteItem;
	else if(sMsg == 'del-items') sMsg = lgCheckDeleteItems;
	return confirm(sMsg);
}

function CreateLink(str3, str2, str1){
	atsign = '@';
	document.write('<a href="mailto:' + str1 + atsign + str2 + '.' + str3 + '">' + str1 + atsign + str2 + '.' + str3 + '</a>');
}

function GoToPage(theElement, sUrl, sUrlEnd){
	window.location.href = sUrl+theElement.value+sUrlEnd;
}

beebob_off = new Image();
beebob_off.src = cfgHttpPath + 'images/friendly/beebob-off.gif';
beebob_on = new Image();
beebob_on.src = cfgHttpPath + 'images/friendly/beebob-on.gif';

represent_off = new Image();
represent_off.src = cfgHttpPath + 'images/friendly/represent-off.gif';
represent_on = new Image();
represent_on.src = cfgHttpPath + 'images/friendly/represent-on.gif';

function ChangeImage(idImg, act){
	idElement = 'friendly-' + idImg;
	document.images[idElement].src = cfgHttpPath + 'images/friendly/' + idImg + '-' + act + '.gif';
}

function CharCounter(theElement, maxLength, charInElement, charRemainElement){
	msgLength = theElement.value.length;
	if (msgLength > maxLength){
		theElement.value = theElement.value.substring(0,maxLength);
		msgLength = theElement.value.length;
	}
	else{
		document.getElementById(charInElement).value = msgLength;
		document.getElementById(charRemainElement).value = (maxLength - msgLength);
	}
} 

function InArray(needle, haystack){
	var iLength = haystack.length;
	if(iLength){  // pole
		for(var i = 0; i < iLength; i++){
			if(needle == haystack[i]) return 1;
		}
	}
	else{  // jedna hodnota
		if(needle == haystack) return 1;
	}
	return 0;
}

function NewWindow(theElement){
	var objWnd = window.open(theElement.href);
	objWnd.focus();
}

/*
function SetBlockDsb(theElement, theAction){
	if(theAction == 'over'){
		if(theElement.className != 'item bgc') theElement.className = 'item bgh';
	}
	else if(theAction == 'out'){
		if(theElement.className != 'item bgc') theElement.className = 'item bgd';
	}
	else if(theAction == 'click'){
		if(theElement.className == 'item bgc') theElement.className = 'item bgd';
		else theElement.className = 'item bgc';
	}
}
*/
function SetBookmark(dsbBookmark, bl){
	if(bl == undefined) var oBookmark = document.getElementById('bm');
	else var oBookmark = document.getElementById(bl);
	var aItem = new Array;
	var j = 0;
	for(i = 0; i < oBookmark.childNodes.length; i++){
		if(oBookmark.childNodes[i].id != '' && oBookmark.childNodes[i].id != undefined){
			strlen = oBookmark.childNodes[i].id.length;
			aItem[j] =  oBookmark.childNodes[i].id.substring(7, strlen);
			j++;
		}
	}
	for(i = 0; i < aItem.length; i++){
	    bl = document.getElementById('bm-bl-'+aItem[i]);
	    itm = document.getElementById('bm-itm-'+aItem[i]);
	    if(aItem[i] == dsbBookmark){
/*	    	if(aItem.length == 1){
				if(bl) bl.style.display = (bl.style.display == 'block') ? 'none' : 'block';
				itm.className = (itm.className == 'active') ? '' : 'active';
			}
			else{
				if(bl) bl.style.display = 'block';
				itm.className = 'active';
			}*/
			if(bl) bl.style.display = (bl.style.display == 'block') ? 'none' : 'block';
			itm.className = (itm.className == 'active') ? '' : 'active';
		}
		else{
			if(bl) bl.style.display = 'none';
			itm.className = '';
		}
	}
}

var checkboxChecked = false;
function SetCheckbox(theForm, theSelect){
	var elts = document.forms[theForm].elements[theSelect];
	var eltsCount = elts.length;

	if(checkboxChecked == false){
		var doCheck = true;
		checkboxChecked = true;
	}
	else{
		var doCheck = false;
		checkboxChecked = false;
	}

	if(eltsCount){
		for(var i = 0; i < eltsCount; i++){
			if(elts[i].disabled == false) elts[i].checked = doCheck;
		}
	}
	else{
		if(elts.disabled == false) elts.checked = doCheck;
	}
	return true;
}

function SetTr(theElement, theAction){
	if(theAction == 'over'){
		if(theElement.className != 'tr-click') theElement.className = 'tr-over';
	}
	else if(theAction == 'out'){
		if(theElement.className != 'tr-click') theElement.className = '';
	}
	else if(theAction == 'click'){
		if(theElement.className == 'tr-click') theElement.className = '';
		else theElement.className = 'tr-click';
	}
}
//-->