

var savedObj;

function highlightRow(obj, row) {
/*	if (row != 0) {*/
		obj.className = obj.className + " highlight";
		savedObj = obj;
/*	}*/
}
function unhighlightRow(obj, row) {
	obj.className = obj.className.replace(/ highlight/, "");
}


function imgPopup(src,width,height,obj) {
	alert('not Implemented');
/*	W1 = window.open(src,"Grafik","width="+(width+20)+", height="+(height+20)+", innerWidth="+(width+10)+", innerHeight="+(height+10)+", left=10, top=10, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no, dependent=yes");
	W1.focus();	*/
}



function _openImage(src,alt_tag,h1)
{
	
	if (h1) {
		if (h1 == 1) { h1 = alt_tag; }
	} else {
		{ var h1 = alt_tag; }
	}
	
	var teile = h1.split("\n");
	var header = (teile.length <= 1) ? 
		"<h1 style=\"padding:0px; margin:0px 0px 20px 0px; font-size:14px; font-family:Arial;\">"+h1+"<\/h1>"
		:
		"<h1 style=\"padding:0px; margin:0px 0px 0px 0px; font-size:14px; font-family:Arial;\">"+teile[0]+"<\/h1>\n<div style=\"padding:0px; margin:0px 0px 10px 0px; font-size:11px; font-family:Arial;\">"+teile[1]+"</span>";
	
	popup = window.open('', '','width=1,height=1,toolbar=no,scrollbars=no,menubnar=no,status=no,directories=no,location=no,left=10,top=10');

	popup.document.open();
	popup.document.write("<html>");
	popup.document.write("<head>");
	popup.document.write("<title>Chart "+alt_tag+"<\/title>");
	popup.document.write("<\/head>");
	
	popup.document.write('<body style=\"margin:5px 10px 10px 10px;\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\" onload=\"opener.resize_popup(this.window,document.images[0].width,document.images[0].height)\">');
	popup.document.write(header);
	//popup.document.write("<h1 style=\"margin:0px; padding:0px 0px 20px 0px; font-size:14px; font-family:Arial;\">"+h1+"<\/h1>");
	popup.document.write("<img src=\'"+src+"\' border=\'0\' alt=\'"+alt_tag+"\'>");
	popup.document.write("<\/body><\/html>");
	popup.document.close();
}


var Ex,Ey,dynPic;

function openImage(e,imageLocation,imageTitle){
	ContentInfo = "<div class='heading' style='width:100%'><div id='closeButton'><a href='javascript:closeImage()'><img src='/daimler/gb2005/pics/design/close.gif' border='0'></a></div>&nbsp;"+imageTitle+"</div><img id='dynamicImage' src='"+imageLocation+"'>";
	document.getElementById("imageContainer").innerHTML = ContentInfo;

	document.getElementById("dynamicImage").src = imageLocation;
	Ex = document.all ? window.event.x : e.pageX;
	Ey = document.all ? window.event.y + dd.getScrollY(): e.pageY;

//	Ey = Ey + dd.getScrollY();

	dynPic=new Image();
	dynPic.src=imageLocation;
	controlFoto();

	return false;
}

function controlFoto(imageLocation,imageTitle){
	if((dynPic.width!=0)&&(dynPic.height!=0)){
		viewFoto(imageLocation,imageTitle);
	}else{
		interval_a="controlFoto()";
		interval_b=setTimeout(interval_a,20);
	}
}

function viewFoto(){
	var w = dynPic.width+2;
	var h = dynPic.height+29;

	if (Ex + dynPic.width+2 > dd.getWndW()){
		Ex = dd.getWndW() - w;
	}

	dd.elements.imageContainer.moveTo(Ex, Ey);
	dd.elements.imageContainer.resizeTo(w,h);

	dd.elements.imageContainer.maxoffr = dd.getWndW() - w;

	dd.elements.imageContainer.show();	
}

function closeImage(){
	dd.elements.imageContainer.hide();
}

function openGlossar(e,language,report_id,page){
	// start ajax request
	Ex = document.all ? window.event.x : e.pageX;
	Ey = document.all ? window.event.y + dd.getScrollY(): e.pageY;

	startAjax("/cgi-bin/daimler/show.ssp?fn=ajaxGlossarRequest&language="+language+"&report_id="+report_id+"&page="+page);

	return false;
}

var req;

function startAjax(url) {
	try {
		if( window.XMLHttpRequest ) {
			req = new XMLHttpRequest();
		} else if( window.ActiveXObject ) {
			req = new ActiveXObject( "Microsoft.XMLHTTP" );
		} else {
			alert( "Ihr Webbrowser unterstuetzt leider kein Ajax!" );
		}
		req.open( "GET", url, true );
		req.onreadystatechange = ajaxRequestCallback;
		req.send( null );
	} catch( e ) {
		alert( "Fehler: " + e );
	}
}

function ajaxRequestCallback() {
	if( req && 4 == req.readyState ) {
		if( 200 != req.status ) {
			alert( "Fehler " + req.status + ": " + req.statusText );
		} else {
			var response = req.responseText;
			var temp = response.split("<glossar_sep>");

			ContentInfo = "<div class='heading' style='width:100%'><div id='closeButton'><a href='javascript:closeImage()'><img src='/daimler/gb2005/pics/design/close.gif' border='0'></a></div>&nbsp;"+temp[0]+"</div><div class='text' id='glossarText'>"+temp[1]+"</div>";
			document.getElementById("imageContainer").innerHTML = ContentInfo;
	
			//alert(document.getElementById("testid").offsetHeight);

			var w = 300;
			var h = 1;

			if (Ex + w > dd.getWndW()){
				Ex = dd.getWndW() - w;
			}

			dd.elements.imageContainer.moveTo(Ex, Ey);
			dd.elements.imageContainer.resizeTo(w,h);

			// read the new height of the element (after the width was set) and set to new height
			var newHeight = document.getElementById("glossarText").offsetHeight + 35;
			dd.elements.imageContainer.resizeTo(w,newHeight);

			dd.elements.imageContainer.maxoffr = dd.getWndW() - w;

			dd.elements.imageContainer.show();
		}
	}
}

function resize_popup(win,x,y)
{
	if (x == 0) {
		x = 600;
		y = 400;
	}
	if (navigator.appName == 'Microsoft Internet Explorer') {
		popup.resizeTo(x+10+20,y+120);
	}
	else
	{
		if(navigator.appVersion.substring(0,1) < "5") {
			popup.resizeTo(x+8+20,y+110);

		}	else {
			popup.resizeTo(x+8+20,y+110);
		}
	}
	
	/*shckx=(screen.availWidth/2)-(x/2);
	shcky=(screen.availHeight/2)-(y/2);
	shcknw.moveTo(shckx,shcky);*/
	popup.focus();
}

function _openGlossar(url){
	popup = window.open(url,"Glossar",'width=550,height=600,toolbar=no,scrollbars=yes,menubnar=no,status=no,directories=no,location=no,left=10,top=10');
	popup.focus();
}

function openQuickAnalyzer(url){
	popup = window.open(url,"Quickanalyzer",'width=550,height=600,toolbar=no,scrollbars=yes,menubnar=no,status=no,directories=no,location=no,left=10,top=10');
	popup.focus();
}

function openPrintView(url){
	popup = window.open(url,"Printview",'width=580,height=600,toolbar=no,scrollbars=yes,menubnar=no,status=no,directories=no,location=no,left=10,top=10');
	popup.focus();
}


function tablePopup(src,width,height) {
	w = window.open(src,"Table","width="+(width+20)+", height="+(height+20)+", innerWidth="+(width+10)+", innerHeight="+(height+10)+", left=10, top=10, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no, dependent=yes");
	w.focus();
}

function replaceCurrentPage(report_id,language,fn) {
	window.location.href = "/cgi-bin/daimler/show.ssp?report_id="+report_id+"&language="+language+"&fn="+fn;
}






