
// thanks to suckerfish
// http://www.htmldog.com/articles/suckerfish/example/
function initLiHover( id ) {
//    document.title += " - " + navigator.userAgent;
    var ul = document.getElementById( id );
    if (ul) {
        var lis = ul.getElementsByTagName("li");
        for (i=0; i<lis.length; i++) {
            if (lis[i].nodeName=="LI") {
                lis[i].onmouseover=function() {
                    this.className += " menuover";
                }
                lis[i].onmouseout=function() {
                    this.className = this.className.replace(/ menuover/g, "");
                }
            }
        }
    }
}
function initIE(){
    initLiHover( 'menu' );
    initLiHover( 'listing' );
    initReadMore();
}
var ua = navigator.userAgent;
if (document.all && document.getElementById && ua.match(/msie [4567]/i) && !ua.match(/opera/i)) {
    window.onload = initIE;
}


function initReadMore() {
    addImages( document.getElementById("highlight") );
    addImages( document.getElementById("listing") );
    
    function addImages( o ) {
        if (o) {
            var as = o.getElementsByTagName("a");
            for (var i=0; i<as.length; i++) {
                if (as[i].parentNode && as[i].parentNode.nodeName.toLowerCase() == "p") {
                    as[i].insertAdjacentHTML('beforeend', '<img src="/images/arrow.red.png" class="readmore" alt="read more" border="0"/>');
                }
            }
        }
    }
}

var currentSegment = '';
function segmentSwap( n ) {
    var id = 'teaser2-' + n;
    if (n<0) {
        id = 'teaser2-default';
    }
    var old = document.getElementById( currentSegment );
    var img = document.getElementById( id );
    if (old) old.style.visibility = "hidden";
    if (img) img.style.visibility = "visible";
    currentSegment = id;
}
