var IWIDTH=250,ns4,ie4,ie5,kon,x,y,winW,winH,idiv=null,px="px",gal,loaded

function nsfix()	{
	setTimeout("window.onresize = rebrowse", 2000);
}
function rebrowse()	{
	window.location.reload();
}
function hascss()	{
	return gettip('infodiv')?true:false 
}

function infoinit(){
	ns4=(document.layers)?true:false, ie4=(document.all)?true:false;
	ie5=((ie4)&&((navigator.userAgent.indexOf('MSIE 5')>0)||(navigator.userAgent.indexOf('MSIE 6')>0)))?true:false;
	kon=(navigator.userAgent.indexOf('konqueror')>0)?true:false;
	x=0;
	y=0;
	winW=800;
	winH=600;
	idiv=null;
	document.onmousemove=mousemove;
	if(ns4&&document.captureEvents)document.captureEvents(Event.MOUSEMOVE);
	if(ns4||kon)	{
		nsfix()
	}
	if(ns4)	{
		px="";
	}
	loaded=1;
	if(gal==1)goGal();
}
function untip()	{
	if(idiv&&loaded) idiv.visibility=ns4?"hide":"hidden";
	idiv=null;
}
function gettip(name){return (document.layers&&document.layers[name])?document.layers[name]:(document.all&&document.all[name]&&document.all[name].style)?document.all[name].style:document[name]?document[name]:(document.getElementById(name)?document.getElementById(name).style:0);}

function maketip(name,title,text)	{
	if(hascss()) 
		document.write('<div id="'+name+'" name="'+name+'" style="position:absolute; visibility:hidden; z-index:20; top:-200'+px+'; left:0'+px+';">' +
						'<table width='+IWIDTH+' border=0 cellpadding=2 cellspacing=0 bgcolor="#CC6600"><tr><td><table width="100%" border=0 cellpadding=0 cellspacing=0>' + 
						'<tr><td><font color="#ffffff">'+title+'</font></td></tr></table><table width="100%" border=0 cellpadding=2 cellspacing=0 bgcolor="#eeeeee"><tr><td>' + 
						'<font color="#000000">'+text+'</font></td></tr></table></td></tr></table></div>'+"\n"); 
	
}
function tip(name){
if(hascss()&&loaded)	{
	if(idiv) untip();
	idiv=gettip(name);
		if(idiv){
			winW=(window.innerWidth)? window.innerWidth+window.pageXOffset-16:document.body.offsetWidth-20;
			winH=(window.innerHeight)?window.innerHeight+window.pageYOffset :document.body.offsetHeight;

   			if(x<=0||y<=0){
				x=(winW-IWIDTH)/2+(window.pageXOffset?window.pageXOffset:0); 
				y=(winH-50)/2+(window.pageYOffset?window.pageYOffset:0);}
			showtip();
		}
	}
}
function showtip()	{
	idiv.left=(((x+260)<winW)?x+12:x-255)+px; 
	if (document.all) {	idiv.top = theBody.scrollTop+y+px;} else { idiv.top = window.pageYOffset+y+px; }	
    idiv.visibility=ns4?"show":"visible";
}
function mousemove(e){
if(e) {x=e.pageX?e.pageX:e.clientX?e.clientX:0; y=e.pageY?e.pageY:e.clientY?e.clientY:0;}else if(event) {x=event.clientX; y=event.clientY;}else {x=0; y=0;}
if(document.documentElement){x+=document.documentElement.scrollLeft;y+=document.documentElement.scrollTop;}if(idiv)showtip();}


function fenster(theURL,winName,features)
{
	a=window.open(theURL,winName,features);
	a.focus();
}

function displayLookupLarge(url, rowIndex, idTarget1, idTarget2, width, height)//consider all params are already using +objName
	{
	
	var arrInput = new Array(rowIndex, idTarget1, eval(idTarget2).value);
	
	var arrOutput = window.showModalDialog(url,arrInput,"dialogHeight: "+height+"px; dialogWidth: "+width+"px; edge: Raised; center: Yes; help: No; resizable: No; status: Yes;");	
	if(arrOutput!=null)
		{
			eval(idTarget1).value=arrOutput[0];
			}
	}


function displayLookupLarge2(url, rowIndex, idTarget1, idTarget2, width, height)//consider all params are already using +objName
	{

	a=window.open(url,"new",'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=790,height=580');	

	}	
	
function add_gruppen(id, width, height)
{
	width=300;
	heigh=150;
	var arrInput = new Array();
	var arrOutput = window.showModalDialog("gruppen_berichte.asp?id="+id,arrInput,"dialogHeight: "+height+"px; dialogWidth: "+width+"px; edge: Raised; center: Yes; help: No; resizable: No; status: Yes;");	
	
	if(arrOutput!=null)
		{
			window.location.href = "save_gruppen.asp?id="+id+"&id_gruppe="+arrOutput[0]+"&datum_von="+arrOutput[1]+"&datum_bis="+arrOutput[2]
			//form_gruppen.new_datum_von.value = arrOutput[1];
			//form_gruppen.new_datum_bis.value = arrOutput[2];
			
		}

}

function add_bilder(id, width, height)
{
	width=300;
	heigh=150;
	var arrInput = new Array();
	var arrOutput = window.showModalDialog("galerie_berichte.asp?id="+id,arrInput,"dialogHeight: "+height+"px; dialogWidth: "+width+"px; edge: Raised; center: Yes; help: No; resizable: No; status: Yes;");	
	
	if(arrOutput!=null)
		{
			window.location.href = "save_galerie.asp?id="+id+"&id_bildergalerie="+arrOutput[0]
			//form_gruppen.new_datum_von.value = arrOutput[1];
			//form_gruppen.new_datum_bis.value = arrOutput[2];
			
		}

}


function new_bericht()
{
		window.location.href = 'berichte_edit.asp?id=18&typ=edit';
}
	