
function menuOpenClose(menu, submenu) {
	var id1 = document.getElementById(menu);
	var id2 = document.getElementById(submenu);
	
	if (id1 == undefined || id2 == undefined) {
		return;
	}
		
	//id1.className = 'active';
	if (id2.style.display == '')
		id2.style.display = 'none';
	else
		id2.style.display = '';
	return true;
}
/******************* EuroKalkulacka zaciatok ************************/
var kurz = 30.1260;

function clearCalc() {
	var skk = document.getElementById("calc_skk");
	var eur = document.getElementById("calc_eur");
	
	if (skk == undefined || eur == undefined)
		return;
		
	skk.value = '';
	eur.value = '';
}

function euroCalc(mena) {
	var skk = document.getElementById("calc_skk");
	var eur = document.getElementById("calc_eur");
	
	if (skk == undefined || eur == undefined)
		return;
		
	var f = 0;
	if (mena == 'SKK') {			
	  var x = skk.value;
	  if (x == '') {
			clearCalc();
			return;
		}
			  		 
		f = parseFloat(x);
		
		skk.value = x.replace(',', '.');
		eur.value = eval(f / kurz).toFixed(2);
	}
	else {
	  var x = eur.value;
	  if (x == '') {
			clearCalc();
			return;
		}	  
	  
		f = parseFloat(x);

		eur.value = x.replace(',', '.');
		skk.value = eval(f * kurz).toFixed(2);	
	}	
}
/******************* EuroKalkulacka koniec ************************/


function ow(url,w,h,title) 
{
  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;
   
  if(typeof(document_okno) == "undefined" || document_okno.closed)  
    document_okno = window.open('','document_okno','menubar=0,toolbar=0,location=0,scrollbars=0,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=0');
  
  document_okno.resizeTo(w+10,h+29);
  document_okno.moveTo(pos_x,pos_y);
  
  var doc = document_okno.document;
  doc.open('text/html');
  
  tmp = '<html>\n<head>\n<title>' + title + '</title>\n</head>\n<body topmargin="0" leftmargin="0">\n';
  tmp += '<table width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td align="center"><a href="javascript:self.close()"><img src="' + url + '" border="0"></a></td></tr></table>\n';
  tmp += '</body>\n</html>';
  
  doc.write(tmp);
  doc.close();
 	
	document_okno.focus();
}

function open_window2(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;
   
  if(typeof(window2) == "undefined" || window2.closed)  
    window2 = window.open(url,'window2','menubar=0,toolbar=0,location=0,scrollbars=0,screenX='+pos_x+',screenY='+pos_y+',left='+pos_x+',top='+pos_y+',width='+twidth+',height='+theight+',resizable=0');  
  
	window2.focus();
}

function open_window3(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;
   
  if(typeof(window3) == "undefined" || window3.closed)  
    window3 = window.open(url,'window3','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 window3.location.href = url;
  
	window3.focus();
}

function InsertSmile ( code, elem )
{
	var obj = document.getElementById ( elem );
	
	if ( obj != null )
	{
		if ( document.selection )
		{
			obj.focus ();
			var sel = document.selection.createRange ();
			sel.text = code;
		}else if ( obj.selectionStart || obj.selectionStart == '0' )
		{
			var startPos = obj.selectionStart;
			var endPos = obj.selectionEnd;
			obj.value = obj.value.substring ( 0, startPos ) + code + obj.value.substring ( endPos, obj.value.length );
		}else
		{
			obj.value += code;
		}

		obj.focus ();
	}
}