/**
* @package    ms.js
* @author     Miloslav Špecián <miloslav.specian@webactive.cz>
* @version    0.6.0
*
*/


function el(id)
{
	if (document.getElementById)
	{
	    return document.getElementById(id);
	}
	else if (document.all)
	{
	    return document.all[id];
	}
	return null;
}

function setClass(elementId, className)
{
  el(elementId).className = className;
}

function setStyle(elementId, styleName, value)
{
  eval("el(elementId).style." + styleName + " = '" + value + "'");
}

function wo(url, sirka, vyska, x, y)
{
	var popWindow=window.open(url,"wo1","toolbar=no,scrollbars=yes,location=no,status=no,width="+sirka+",height="+vyska+",left="+x+",top="+y+",resizable=0")
	popWindow.focus();
	popWindow.creator = self;

}

function load_html(element_id, url)
{
		var xmlHttp;

		try
		{
			/* Firefox, Opera 8.0+, Safari */
			xmlHttp = new XMLHttpRequest();
		}
		catch (e)
		{
			/*  Internet Explorer */
			try
			{
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Váš prohlížeč bohužel nepodporuje technologii AJAX.");
					return false;
				}
			}
		}

	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			var r = xmlHttp.responseText;
			if (r)
			{
				if (r.indexOf("Error") > -1)
				{
					alert(r);
					document.getElementById(element_id).innerHTML = "";
				}
				else
				{
					document.getElementById(element_id).innerHTML = r;
				}
			}
			else
			{
		    	alert("Chyba systému: Server odpověděl prázdnou větou.");
			}
		}
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
	return true;
}

function setHtml(elementId, content)
{
	document.getElementById(elementId).innerHTML = content;
}

/**
 *
 * @access public
 * @return void
 **/
function uprav_pro_url(a)
{
	return a.replace(/&/g, "%26");
}
