
// stlacenie enter-u urobi klik na tlacidlo
function EnterKeyDown(oEvent, buttonId)
{
	if ( oEvent.keyCode && 13 == oEvent.keyCode || oEvent.which && 13 == oEvent.which )	// IE || FF
	{
		if ( document.getElementById && null != document.getElementById(buttonId) )
		{
			document.getElementById(buttonId).click();
			
			/* if ( navigator.appName.toLowerCase() == "opera" )
			{
				// opera vraj vie zrusit event, ale enter spusta aj nezavisly submit :(
				// uz je neskoro?:
				window.opera.addEventListener('AfterEvent.submit', function (e) { // return false;
					if( e.eventCancelled ) {
						//the script has tried to stop the form submission
						if( confirm( 'Submission was prevented. Submit anyway?' ) ) {
						//prevent the script from preventing the form submission
						e.preventDefault();
						}
					}
					return false;
					},
					false
				);
				document.form[0].attachEvent("onsubmit", "return false");
				
				oEvent.stopPropagation();
				if ( oEvent.cancelable )
					oEvent.preventDefault();
			}*/
			return false;	// zachytim ho
		}
	}
	
	return true;
}

// vypnutie vyberu z listboxu
function UnselectListBox(listboxId)
{
	if ( null == listboxId )
		return;
	
	var oListbox = document.getElementById(listboxId);
	if ( null == oListbox )
		return;
	
	oListbox.selectedIndex = -1;
}

// ukazanie prvku
function ShowElement(elemId)
{
	if ( null == elemId )
		return;


	var oElem = document.getElementById(elemId);
	if ( null == oElem )
		return;
	
	oElem.style.visibility = "visible";
	if ( "none" == oElem.style.display )
		oElem.style.display = "";
}

// otazka na nastavenie ulozenia zmien wizarda
function WizardSaveNow(placId)
{
	var oWizardSaveNow = document.getElementById("WizardSaveNow" + placId);
	if ( null == oWizardSaveNow || !eval("_ShowChangedLabels" + placId) || "1" == oWizardSaveNow.value )
		return;
	
	if ( confirm(unescape("Vykonali ste zmeny. Maj%FA sa pred pokra%u010Dovan%EDm ulo%u017Ei%u0165?")) )
		oWizardSaveNow.value = "1";
}


// zistenie cookie
function CookieGet(sName)
{
	if ( null == document.cookie )
		return null;
	
	var aCookie = document.cookie.split("; ");
	for ( var i = 0; i < aCookie.length; i++ )
	{
		var aPair = aCookie[i].split("=");
		if ( sName == aPair[0] )
			return unescape(aPair[1]);
	}
	
	return null;
}

// nastavenie cookie
function CookieSet(sName, sValue, dExpires, sPath)
{
	document.cookie = sName + "=" + escape(sValue) +
		((dExpires) ? "; expires=" + dExpires.toGMTString() : "") +
		((sPath) ? "; path=" + escape(sPath) : "");
}

// zmazanie cookie
function CookieDelete(sName)
{
	document.cookie = sName + "=; expires=Fri, 31 Dec 1999 23:59:59 GMT;";
}
if(typeof(Sys)!=="undefined")Sys.Application.notifyScriptLoaded();