function swap_top(title, section, dat, img, url, sectionurl, elm) {
	var preview = document.getElementById('top_article_preview');
	if (!preview) return false;

	var titleElm = preview.getElementsByTagName('h2');
	var sectionElm = preview.getElementsByTagName('p');
	var imgElm = preview.getElementsByTagName('img');

	var items = preview.getElementsByTagName('a');
	for (var i = 0, each = null; null != (each = items[i]); i++) {
		each.href = url;
	}


	if (titleElm) titleElm[0].innerHTML = '<a href="' + url + '">' +title + '</a>';
	if (sectionElm) sectionElm[0].innerHTML = dat + ' <span> | </span>' + '<a href="' + sectionurl + '">' + section + '</a>';
	if (imgElm) {
		imgElm[0].src = img;
		imgElm[0].alt = title;
	}

	var list = document.getElementById('top_article_list');
	if (!list) return false;
	var items = list.getElementsByTagName('li');
	for (var i = 0, each = null; null != (each = items[i]); i++) {
		each.className = '';
	}

	elm.className = 'sel';

	return true;
}




function swap_top2(title, elm) 
{
	var preview = document.getElementById('top_article_preview2');
	if (!preview) return false;

	var titleElm = preview.getElementsByTagName('div');

	
	var tab1 = '<div class="map"><ul class="cesta">	<li class="sel"><a class="link_cesta" onmouseover="swap_top2('+1+', this);" href="#">Naplánovať cestu</a></li><li><a class="link_mapa" onmouseover="swap_top2('+2+', this);" href="#">Nájsť na mape</a></li></ul>	<form target="_blank" id="map_route" action="http://mapy.atlas.sk/" method = "post">	<fieldset>	<label>Od:</label><input type="text" class="input_text" style="margin-bottom:2px" name="start"/><label>Do:</label><input type="text" class="input_text" name="finish"/>				<input type="hidden" name="whatsearch" value="route"/>		<input type="submit" value="vyhladat" class="input_submit"/></fieldset></form></div>';
	var tab2 = '<div class="map">			<ul class="mapa"> 		<li>			<a class="link_cesta" onmouseover="swap_top2('+1+', this);" href="#">Naplánovať cestu</a></li>			<li  class="sel">		 <a class="link_mapa" onmouseover="swap_top2('+2+', this);" href="#">Nájsť na mape</a></li>		</ul> 		 <form target="_blank" id="map_route" action="http://mapy.atlas.sk/" method = "get">			 <input type="hidden" name="whatdisp" value="search"/>				 		 <fieldset>			   <input style="margin-bottom:2px"  type="text" class="input_text map_box" name="phrase"/>			<strong> <div class="map_box" style="font-size:10px;">Zadajte meno mesta, obce, ulice alebo názov hľadanej firmy.</div> </strong>  <div class="search_submit"><input type="submit" value="vyhladat" class="input_submit"/></div>		 </fieldset> </form>		 </div>';	
	
  titleElm[0].innerHTML = tab1;
	if (title == '1') titleElm[0].innerHTML = tab1;
	if (title == '2') titleElm[0].innerHTML = tab2;

	
	return false;
}



function newWindow2(url, width, height, windowName) {
	var left = (screen.availWidth / 2) - (width / 2);
	var top = (screen.availHeight / 2) - (height / 2);
	var newWindow;

	if(!windowName) {
		var windowName = 'newWindow' + Math.floor(Math.random() * 100);
	}

	newWindow = window.open( url, windowName, 'top=' + top + 'px,left=' + left + 'px,screenX=' + left + 'px,screenY=' + top + 'px,width=' + width + 'px,height=' + height + 'px,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
  if(!document.all)
		newWindow.focus();
	return false;
}



