
var projectroot = "";



function overButton(img)
{
	if(img != null)
	{
		img.src = img.src.toLowerCase().replace("_off.gif","_on.gif");
	}
}

function outButton(img)
{
	if(img != null)
	{
		img.src = img.src.toLowerCase().replace("_on.gif","_off.gif");
	}
}

function popup(url, name, x, h){

	if(x == null)
		x = screen.Width - 15;

		
	if(h == null)
		h = screen.Height - 100;
		
	if(name == "") 
		name == "popup";
	
	var fenster = window.open(url, name, "width=" + x + ", height=" + h + ", left=100, top=100, menubar=0, fullscreen=0, toolbar=1, resizable=1, status=1");	
	fenster.focus();
}

function markArrow(linkid,defaultid){

	var link = document.getElementById(linkid);
	
	if(link != null){
		link.firstChild.src = link.firstChild.src.replace("_off","_on");
	
	} else {
		link = document.getElementById(defaultid);
		if(link != null)
			link.firstChild.src = link.firstChild.src.replace("_off","_on");
	}
}

function print(status)
{
	if(status==null)
		status = "";
	var contenttd = document.getElementById('printarea');
	
	var x = screen.Width - 15;
	var h = screen.Height - 100;
		
	var fenster = window.open("", "df", "width=" + x + ", height=" + h + ", left=0, top=0, menubar=1, fullscreen=0, toolbar=1, resizable=1, status=1");
	
	var code = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
	code += "<html><head>";
	code += "<link rel=\"stylesheet\" href=\"css/layout.css\">";
	code += "<link rel=\"stylesheet\" href=\"css/ergebnisse.css\">";
	code += "<link rel=\"stylesheet\" href=\"css/print.css\">";
	code += "</head><body scroll=yes>";
	fenster.document.write(code+"<div id=\"testid\"></div><img src=\"grafik/print/header.gif\" style=\"width:720px\"><div style=\"padding:0px 0px 4px 10px;width:530px;position:relative;top:-23px\"><span class=printstatus>"+status+"</span></div><table class=text style=\"width:800px;margin-left:10px;\"><tr><td>" + contenttd.innerHTML + "</td></tr></table><script>window.print();</script></body></html>");
	fenster.focus();
	fenster.location.reload(true);
}
var errcount1 = 0;

function onHeaderError(img,path)
{
	if(errcount1 > 10)
		return;

	errcount1++;
	
	if(img.src.toLowerCase().indexOf('ergebnisse') >= 0){
		img.src = "grafik/header/ergebnisse.jpg";
	} else{
		img.src = "grafik/header/standard.jpg";
	}
}


/* for image navigation in news */

var addlink = ""; // set by newsmodul.ascx.cs or contentmodul.ascx
var bigimagepath = "";

// class for image preview
function newsimage(url,legend,linkname,linkurl)
{
	this.url = url;
	this.legend = legend;
	this.linkurl = linkurl;
	this.linkname = linkname;
}

function loadImage(imgarr,aktindex,nid)
{

	var img = document.getElementById("newsimg" + nid);
	
	if(img != null)
	{
	
		if(aktindex != null){

			// get data
			var aktimg = imgarr[aktindex.index];
			
			// set image
			img.src = aktimg.url;
			img.alt = "";// aktimg.legend;
			
			// set navigation status
			var nav = document.getElementById("navstatus" + nid);
			if(nav != null)
				nav.innerHTML = (aktindex.index+1) + " / " + imgarr.length;	
				
			// set link of image to big image
			var link = document.getElementById("imagelink" + nid);
			if(link != null){
				link.href = bigimagepath + "newsimagebig.aspx?newsid=" + nid + "&aktindex=" + aktindex.index + addlink;
			}
			
			// hide imagenavigation if only one image		
			if(imgarr.length <= 1){
				var imagenav = document.getElementById("imagenavigation" + nid);
			
				if(imagenav != null)
					imagenav.style.display = "none";

			}
		}
	}
	
}

function start2(imgarr,aktindex,nid)
{

	aktindex.index = 0;
	
	loadImage(imgarr,aktindex,nid);
}

function end(imgarr,aktindex,nid)
{
	aktindex.index = imgarr.length-1;
	
	loadImage(imgarr,aktindex,nid);
}

function next(imgarr,aktindex,nid)
{
	
	aktindex.index++;

	if(aktindex.index >= imgarr.length){
		aktindex.index = 0;
	}
	
	loadImage(imgarr,aktindex,nid);

}

function previous(imgarr,aktindex,nid)
{
	
	aktindex.index--;
	
	if(aktindex.index < 0){
		aktindex.index = imgarr.length-1;
		}
	
	loadImage(imgarr,aktindex,nid);
}



/* highlighting of rows on results */

var vorlagearr = new Array();

function highlightRow(ukid)
{
	
	
	$('row_stb_' + ukid).className = 'rowhighlighted';
		
		for(var i=0;i<vorlagearr.length;i++){
			var row = $('row_' + vorlagearr[i] + '_' + ukid);
			
			if(row != null)
			{
				$('row_' + vorlagearr[i] + '_' + ukid).className = 'rowhighlighted';
			}
		}
	
}

function unhighlightRow(ukid)
{
	if(ukid != null)
	{
		$('row_stb_' + ukid).className = 'rownormal';
		
		for(var i=0;i<vorlagearr.length;i++){
			var row = $('row_' + vorlagearr[i] + '_' + ukid);
			
			if(row != null)
			{
				$('row_' + vorlagearr[i] + '_' + ukid).className = 'rownormal';
			}
		}
	}
}