a = document.getElementById("news");
a.onclick = doOpenClose;

function wokno(src){
    window.open("pictures/fotosutaz_zima/"+src,null,"height=370,width=440,status=yes,toolbar=no,menubar=no,location=no");
}

function isMSIE()
{
    var detect = navigator.userAgent.toLowerCase();
	place = detect.indexOf("msie") + 1;
	if (place){
	   return true;
	} else {
	   return false;
	}
}

function doOpenClose(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
		
    if (targ.nodeName == 'SPAN' && targ.childNodes[0].nodeValue != 'Novinky'){
        
        if (isMSIE()) {
            nadpis = targ.parentNode.childNodes[2].style;
            text = targ.parentNode.childNodes[4].style;
        } else {
            nadpis = targ.parentNode.childNodes[3].style;
            text = targ.parentNode.childNodes[5].style;
        }
	     
        if (text.display=="block"){
            text.display="none";
            targ.parentNode.style.backgroundColor="";
            nadpis.fontWeight="normal";
        } else {
            text.display="block";
            targ.parentNode.style.backgroundColor="";
            nadpis.fontWeight="bold";
        }
    } else if (targ.nodeName == 'DIV' && targ.childNodes[0].nodeValue != 'Novinky'){
        
        
        if (isMSIE()) {
            nadpis = targ.childNodes[2].style;
            text = targ.childNodes[4].style;
        } else {
            nadpis = targ.childNodes[3].style;
            text = targ.childNodes[5].style;
        }
	    
        if (text.display=="block"){
            text.display="none";
            targ.style.backgroundColor="";
            nadpis.fontWeight="normal";
        } else {
            text.display="block";
            targ.style.backgroundColor="";
            nadpis.fontWeight="bold";
        }
    }
}

a.onmouseover = doHighlight;
a.onmouseout = doUnHighlight;

function doHighlight(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
		
	if (targ.nodeName == 'SPAN' && targ.childNodes[0].nodeValue != 'Novinky'){   
        targ.parentNode.style.backgroundColor="";
    } else if (targ.nodeName == 'DIV' && targ.childNodes[0].nodeValue != 'Novinky'){
        targ.style.backgroundColor="";
    }
}

function doUnHighlight(e)
{
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
		
	if (targ.nodeName == 'SPAN' && targ.childNodes[0].nodeValue != 'Novinky'){
        if (isMSIE()) {
            text = targ.parentNode.childNodes[4].style;
        } else {
            text = targ.parentNode.childNodes[5].style;
        }
        if (text.display!="block"){
            targ.parentNode.style.backgroundColor="";
        }
    } else if (targ.nodeName == 'DIV' && targ.childNodes[0].nodeValue != 'Novinky'){
        if (isMSIE()) {
            text = targ.childNodes[4].style;
        } else {
            text = targ.childNodes[5].style;
        }
        if (text.display!="block"){
            targ.style.backgroundColor="";
        }        
    }	
}
