var dom= new Object();
dom.removeAllChildNodes=function(e){
	for(var i=e.childNodes.length-1;i>=0;i--){
		e.removeChild(e.childNodes[i]);
	}
};

dom.remove=function(node){
	node.parentNode.removeChild(node);
};

function CreateImageCaptions(){
	var images=document.getElementsByTagName('img');
	for(var i=0;i<images.length;i++){
		if(images[i].className!='static'){
		 	if(document.body.className!='Index'){
				var imageWithCaption=document.createElement('DIV');
				imageWithCaption.className='imageWithCaption';
				var image=document.createElement('IMG');
				imageWithCaption.style.width=images[i].width+'px';
				image.alt=images[i].alt;
				image.src=images[i].src;	
				imageWithCaption.appendChild(image);
				imageWithCaption.appendChild(document.createElement('BR'));			
				caption=document.createElement('SPAN');
				caption.appendChild(document.createTextNode(image.alt));			
				imageWithCaption.appendChild(caption);
				images[i].parentNode.replaceChild(imageWithCaption,images[i]);
			}
		}
	}
}

window.onload=function(){
	CreateImageCaptions();
	if(window.name=='print'){
		document.body.className='Print';
	}
	var as = document.getElementsByTagName('a');
	var docDomain = document.location.href.split('/')[2];
	for(var i=0;i<as.length;i++){
		var a = as[i];
		var aDomain = a.href.split('/')[2];
		if(aDomain != docDomain && aDomain != 'einfallsreich' && a.href.substr(0, 4) == 'http'){
			a.target = '_blank';
		}
	}
};


function ToggleDisplay(id){
	var htmlElement=document.getElementById(id);
	htmlElement.style.display=(htmlElement.style.display=='block')?'none':'block';
}

function OpenPrintViewWindow(){	
	var printView=window.open(window.location.href,'print','');
}

function OpenNewWindow(url,winName,width,height,posX,posY) {
	var location="no";
	var resizable="yes";
	var toolbar="no";
	var status="no";
	if (!posX) posX=40;
	if (!posY) posY=40;
	window.open(url,winName,"width="+width+",height="+height+",top="+posY+",screenY="+posY+",left="+posX+"screenX="+posX+",location="+location+",resizable="+resizable+",toolbar="+toolbar+",status="+status);
}

function OpenCalendar(url){
	OpenNewWindow(url,'calendar',800,600);
}
