<!--

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

st_active_cat = '_title';

var sme_uid = get_sme_uid();

function get_sme_uid()
{
	var cook_id = "sme_uid";
	var r = new String('');
	if (typeof readCookie == 'function') {
		r = readCookie(cook_id);
		if ( (!r) && (is_cookies_enabled()) ) {
			var a1 = (new Date()).getTime();
			var a2 = Math.floor(100000*Math.random());
			r = ( a1.toString() + a2.toString() ).substr(0, 17);
			createCookie2(cook_id, r, 365*10, "/", "sme.sk");
		}
	}
	if (!r) r = '';
	return r;
}


// swap_div

function tabButtonClicked(t, b) {
  var lis=document.body.getElementsByTagName('li');
  for (var i=0; i<lis.length; i++) {
    if (lis[i].id==t+'_'+b+'_button') {
			lis[i].className='ac';
    } else if (lis[i].id.match('^'+t+'_.*_button$')) {
			lis[i].className='ia';        
    }
  }
  var divs=document.body.getElementsByTagName('div');
  for (var i=0; i<divs.length; i++) {
    if (divs[i].id==t+'_'+b+'_content') {
			divs[i].style.display='block';
    } else if (divs[i].id.match('^'+t+'_.*_content$')) {
			divs[i].style.display='none';
    }
  }
  if (typeof createCookie == 'function')	createCookie('top_box_select_'+ t, b, 365);
}
// swap_div - END


// HELP

var help = false

function changeHelp(pa_s) {
	if (help) {
		help.style.visibility   = 'visible';
		help.innerHTML          = pa_s;
	}
}

function hideHelp() {
	if (help) help.style.visibility='hidden';
}

function getMouseMove(e) {
    if (document.all) e = event;
	if (help)
		if (help.style.visibility == 'visible') {
			doc_pos = getScrollXY();
			help.style.left = doc_pos[0] + e.clientX + 5 + 'px';
			help.style.top  = doc_pos[1] + e.clientY + 20 + 'px';
		}
}

function helpInit() {
	help = document.getElementById('helpbox');
}

document.onmousemove=getMouseMove;
var help=false;

function main_onload() {
	helpInit();
}



function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

// HELP - END



function loadimg(src,par)
{
	src='/zobrazfoto.asp?src=' + src + '&par=' + par;
	window.open(src,'', 'resizable=yes,scrollbars=yes,width=600,height=550');
}

function load_ig(id, idp, i, par)
{
	src='/img_gal/?id=' + id+ '&idp=' + idp + '&i='+ i +'&par=' + par;
	window.open(src,'', 'resizable=yes,scrollbars=yes,width=700,height=600');
}

function hlfrm_submit()
{
	var now, typ;
	now = new Date;
	typ = 2;
	if (document.forms['hlfrm'].hl_kde[1].checked) 
	{
		if (typ==1)
		{
			location.href='http://www.zoohoo.sk?q='+document.forms['hlfrm'].hltext2.value +'&ref=70'; return false; 
		} else {
			location.href='http://www.atlas.sk/search.php?id=sme&phrase='+document.forms['hlfrm'].hltext2.value +'&what=f'; return false; 
		}
	} else {
		return true;
	}
}


function st_openWindow(theURL, winName, features) { 
  window.open(theURL, winName, features);
}
function add_favorit()
{
	if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) 
	{
	  window.external.AddFavorite("http://www.sme.sk", document.title);
	} else {
		st_openWindow('/footer/favorit.htm','Favorit','width=500,height=300');
	}
}

function send_err_info(pa_type, pa_id)
{
	st_openWindow('http://www.sme.sk/chyba/?id='+pa_id, 'chyba_info', 'resizable=no,scrollbars=yes,width=500,height=590');
}

function storm_detect_browser()
{
	var ret = '';
	var agt = navigator.userAgent.toLowerCase();
	var appVer = navigator.appVersion.toLowerCase();
	var iePos  = appVer.indexOf('msie'); 
	if (agt.indexOf('opera') != -1) ret = 'OPERA'; 
	if ((iePos!=-1) && (ret!='OPERA')) ret = 'IE';
	if ((agt.search('firefox') !=-1) == true) ret = 'FF'
	return ret;
}
var storm_browser = storm_detect_browser();

function addEvent(obj, evType, fn){
	if (obj.addEventListener){
		obj.addEventListener(evType, fn, false);
		return true;
	}
	else if (obj.attachEvent){
		var r = obj.attachEvent('on'+evType, fn);
		return r;
	}
		else {
		return false;
	}
}

function read_top_box_select()
{
	if ((typeof readCookie == 'function') && (typeof tabButtonClicked == 'function'))
	{
		var h;
		if (document.getElementById('tab1_1hod_button')) { h = readCookie('top_box_select_tab1'); if (h) tabButtonClicked("tab1", h); }
		if (document.getElementById('tab2_1hod_button')) { h = readCookie('top_box_select_tab2'); if (h) tabButtonClicked("tab2", h); }
		if (document.getElementById('tab3_1hod_button')) { h = readCookie('top_box_select_tab3'); if (h) tabButtonClicked("tab3", h); }
		if (document.getElementById('tab4_1hod_button')) { h = readCookie('top_box_select_tab4'); if (h) tabButtonClicked("tab4", h); }
	}
}

addEvent(window, 'load',	read_top_box_select);

function change_css(id, st)
{
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(id);
	} else if (document.all){
		var elem = document.all[id];
	}
	if (elem) elem.className = st;
}

function check_char_count(id_form, max_char, id_txt)
{
	var f = document.getElementById(id_form);
	if (id_txt) var t = document.getElementById(id_txt);
	if (f) {
		var p = f.value.length;
		if (p>max_char) f.value = f.value.substring(0, max_char);
		if (t) {
			t.innerHTML = ((max_char - p)<0) ? 0 : (max_char - p);
		}
	}
}

function write_mstr(s1, s2) {
	var dmz=new Array('-','*','@','#'); 
	document.write(s1 + dmz[2] + s2);
}

function resizeLogo () {
  var ad01=document.getElementById("ad01");
  var logo=document.getElementById("logoImg");
  if ((ad01) && (logo)) {
	  var heightOfLogo=40;
	  var height;
	  if(ad01.offsetHeight<heightOfLogo){
	    height=heightOfLogo;
	  }else{
	    height=ad01.offsetHeight;
	  }
	  var top=(height-heightOfLogo)/2;
	  logo.style.top=top+"px";
	}
}

function bookmark_site(title, url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function preload_img(s)
{
	new Image(1,1).src=s;
}

function change_html_array(id, id_arr, is_user)
{
	eval("var a = "+ id + "");
	eval("var hod = "+ id + "_act;");
	if (is_user) eval(""+ id + "_timer_off = 1;");
	if (hod!=id_arr) {
		var hid = document.getElementById(id + "_cont");
		if (hid) {
			if (!a[id_arr]) id_arr = 0;
			if (a[id_arr]) {
				hid.innerHTML = a[id_arr];
			}
			var i = 0;
			var but;
			while (but = document.getElementById(id + "_but"+i)) {
				but.className = (i==id_arr) ? 'sel1' : 'sel0';
				//if (i==id_arr) but.innerHTML = but.innerHTML + "!";
				i++;
			}
			eval(""+ id + "_act = "+ id_arr +";");
		}
	}
}
function change_html_array_play(id)
{
	eval(""+ id + "_timer_off = 0;");
}

function change_html_array_timer(id, tm, first_start)
{
	eval("var hod = "+ id + "_act;");
	eval("var t_off = "+ id + "_timer_off;");
	if (!t_off) {
		if (!first_start) change_html_array(id, hod+1, 0);
	}
	setTimeout("change_html_array_timer('"+id+"', "+ tm +", 0);" ,tm);
}

function query_str(ji) 
{
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0; i<gy.length; i++) {
		ft = gy[i].split("=");
		if (ft[0] == ji) {
			return ft[1];
		}
	}
}

function GetXmlHttpObject2()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return xmlHttp;
}

var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();


function show_active_menu_categ(id)
{
	change_css('st_bm_cat_'+ (id ? id : st_active_cat), 'sel');	
}






/* cookies - START */
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function createCookie2(name,value,days,path,domain) {
	var s = name +"="+ value;
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		s = s + "; expires="+date.toGMTString();
	}
	s = s + "; path="+ (path ? path : '/');
	s = s + "; domain="+ (domain ? domain : '');
	document.cookie = s;
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function eraseCookie2(name, path, domain) {
	createCookie2(name,"",-1, path, domain);
}

function is_cookies_enabled()
{
	createCookie('cook_test', 'cook_on', 0);
	return (readCookie('cook_test') == 'cook_on') ? 1 : 0;
}
/* cookies - END */





function storm_pg_stat_hit(t, v, p, add_params) {
	var l = new String('');
	var d = document;
	var href = new String(d.location.href);
	var ref = '';
	
	if (document.location && document.location.protocol && document.location.protocol=='https:') {
		l = l + 'https:';
	} else {
		l = l + 'http:';
	}
	l = l + '//services.sme.sk/pgstat/pgstat.asp?_r='+ (new Date()).getTime() +'&_r2='+ Math.floor(100000*Math.random());
	if (t) l = l + '&t='+ t;
	if (v) l = l + '&v='+ v;
	if (p) l = l + p;
	if (add_params>0) {
		if (d.referrer) ref = new String(d.referrer);
		l = l + '&href='+ escape(href.substring(0,200)) +'&ref='+ escape(ref.substring(0,200));
	}
	var storm_pg_stat_image = new Image();
	storm_pg_stat_image.src = l;
	//alert(l);
}

function goto_page(s)
{
	alert(1);
	location.href = s;
}


//-->
-->
