var hBoxPrefix = 'articleteaser_';  // Bezeichnet den Rahmen
var bottomImgClass = 'content_bottom_image_kommunalwahl';
var hLightColor = '#ffdddd';
var lLightColor = '#FFFFFF';
var hBoxActiveImage = './images/portlet_bottom_blue_big.gif';
var hBoxNormalImage = './images/portlet_bottom_white_big.gif';
var lastTop = 0;

function clickHighligthTeaser(e)
{
	suffix = divName.slice(hBoxPrefix.length, divName.length);
	tLinks = this.getElementsByTagName('A');
	myHREF = tLinks[0].href;
	myTARGET = tLinks[0].target;
	if (myTARGET=="_self") {
		window.location.href=myHREF;
	} else if (myTARGET=="_blank"){
		window.open(myHREF);
	}
    return false;
}


function onMover(e) {
	this.style.backgroundColor=hLightColor;
	tDivs = this.getElementsByTagName('DIV');
	for (i=0; i<tDivs.length; i++) { 
		 if (tDivs[i].className==bottomImgClass) { 
			 tDivs[i].style.background='url('+hBoxActiveImage+')'; 
		}
	}
}

function onMout(e) {
	this.style.backgroundColor=lLightColor;
	tDivs = this.getElementsByTagName('DIV');
	for (i=0; i<tDivs.length; i++) { 
		 if (tDivs[i].className==bottomImgClass) { 
			 tDivs[i].style.background='url('+hBoxNormalImage+')'; 
		}
	}
}

function initHighlightArticleBox() {
	var divs = document.getElementsByTagName('DIV');
	for(var a=0; a<divs.length; a++){
		divName = divs[a].id;
		if(divName.indexOf(hBoxPrefix)==0) {
			tDiv = document.getElementById(divName);
			tMover = document.createElement("DIV");
			tMover.id = "tMover"+a;
			tMover.style.width = tDiv.offsetWidth+'px';
			tMover.style.height = tDiv.offsetHeight+'px';
			tMover.style.position = 'absolute';
			tMover.style.left = '0px';
			tMover.style.top = lastTop+'px';
			lastTop += tDiv.offsetHeight
			tMover.style.backgroundColor = 'transparent';
			tDiv.style.cursor = pointerStyle;
			tDiv.onmouseover = onMover;
			tDiv.onmouseout = onMout;
			tLinks = tDiv.getElementsByTagName('A');
			myHREF = tLinks[0].href;
			myTARGET = tLinks[0].target;
			tDiv.onclick = clickHighligthTeaser;
			tDiv.appendChild(tMover);
		}		
	}	
}
