function print_window(url) 
{
  var twidth = 670;
  var theight = screen.height - 100;

  if(twidth > screen.width - 40) twidth = screen.width - 40;
  if(theight > screen.height - 40) theight = screen.height - 40;

  var pos_x = (screen.width - twidth - 10)/2;
  var pos_y = (screen.height - theight - 29)/2;
   
  if(typeof(pw) == "undefined" || pw.closed)  
    pw = window.open(url,'pw','menubar=0,toolbar=0,location=0,scrollbars=1,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=1');  
  else pw.location.href = url;
  
  pw.focus();
}

function open_window(url,w,h) 
{
  var twidth = w;
  var theight = h;

  if(twidth > screen.width - 40) twidth = screen.width - 40;
  if(theight > screen.height - 40) theight = screen.height - 40;

  var pos_x = (screen.width - twidth - 10)/2;
  var pos_y = (screen.height - theight - 29)/2;
   
    ow = window.open(url,'ow','menubar=0,toolbar=0,location=0,scrollbars=1,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=1');  
  
  ow.focus();
}

function conv_calc(o)
{
        var parita = 30.126;
        var from = parseFloat ( o.value.replace ( ",", "." ) );

        if ( o.name == "conv_from" )
        {
                var from_valuta = 1;
                var to_valuta = parita;
                var out = o.form.conv_to;
        }else
        {
                var from_valuta = parita;
                var to_valuta = 1;
                var out = o.form.conv_from;
        }

        if ( isNaN ( from ) )
        {
                out.value = '';
        }else
        {
                result = from * from_valuta / to_valuta;
                if ( isNaN ( result ) )
                {
                        out.value = '';
                }else
                {
                        rr = Math.round ( result * 100 ) / 100;
                        srr = String ( rr );
                        srr = srr.replace ( ".", "," );

                        var pos = srr.indexOf ( "," );

                        if ( pos == -1 )
                        {
                                srr += ",00";
                        }else
                        {
                                var len = 4 - srr.length + pos;
                                if ( len > 0 )
                                {
                                        var zeros = new Array( len ).join ( "0" );
                                        srr += zeros;
                                }
                        }
                        out.value = srr;
                }
        }
}

function doBlink()
{
	var blink = document.all.tags("BLINK");
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",1000)
}

function PripravLinky ()
{
	var anchors = document.getElementsByTagName ( "a" );

	for ( var i = 0; i < anchors.length; i++ )
	{
		var anchor = anchors[i];
		var relAttribute = String(anchor.getAttribute("rel"));
		if (anchor.getAttribute("href"))
		{
			if ( relAttribute.match ( /^open_window/ ) )
			{
				eval ( "anchor.onclick = function () { " + relAttribute + "; return false; }" );

				anchor.href = "javascript:void(0)";
			}
		}
	}
}

if (window.addEventListener) {
	window.addEventListener("load",PripravLinky,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",PripravLinky);
} else {
	window.onload = function() {PripravLinky();}
}
