function winopen(src,w,h,titel,descr) {	
		myname="Originalbild";
		PicURL="/app/picture.php?url="+escape(src)+"&width="+w+"&height="+h+"&title="+escape(titel)+"&description="+escape(descr);
		w=window.open(escape(src),myname,"menubar=no,statusbar=no,locationbar=no");
		w.focus();

}
function mailorder(nodeid,Titel){
	url = "http://potsdam-lx2.icomedias.com/app/content/insert.php?mailorder=1&nodeid="+nodeid+"&Titel="+Titel;
	mailorderwindow = window.open(url,"mailorder","width=500,height=500,scrollbars=yes,status=yes,location=no,resizable=no,menubar=no,toolbar=no");
	mailorderwindow.focus();
}
function WinOpen2(url) {
     window.open(url,'PicWindow','resizable=yes,width=370,height=550,toolbar=no,status=no,menubar=no');

 }

function PrintOpen(url) {
     window.open(url,'Printversion','scrollbars=yes, resizable=yes,width=800,height=600,toolbar=yes,status=no,menubar=no');

}
function checkdate() {
	mf=document.forms.zimmersuche;
	day=mf.day.value;
	month=mf.month.value;
	year=mf.year.value;
	mydate=  new Date();
	mydate.setFullYear(year);
	mydate.setMonth(month);
	mydate.setDate(day);
	tempday=String(mydate.getDate());
	tempmonth=String(mydate.getMonth());
	newday = (tempday.length > 1) ? tempday : "0" + tempday;
	newmonth = (tempmonth.length > 1) ? tempmonth : "0" + tempmonth;
	newyear=mydate.getFullYear();
	mf.day.value = newday;
	mf.month.value = newmonth;
	mf.year.value = newyear;
}

/* Container */

var myparent = "test";
var mytd = "";
var maxWidth = 180;

function makepicture(mynode,pic){
	
	var neupic = document.createElement("img");
	neupic.src = pic.src;
	neupic.setAttribute("width",40);
	neupic.setAttribute("height",1);
	// wieder löschen, wegen Skalierung
	neupic.removeAttribute("height");
	// neue TD
	neutd = document.createElement("TD");
	neutd.setAttribute("width",40);
	neutd.setAttribute("align","left");
	// neues Bild in neue TD
	neutd.appendChild(neupic);
	// neue TD vor der besagten TD
	myparent.insertBefore(neutd,mytd);
	mytd.setAttribute("style","");
	// Kosmetik
	mytd.style.paddingLeft = "11px";
	// altes Bild löschen
	mynode.removeChild(pic);
}

function scalePicture(mynode, pic){
	mypic = new Image();
	mypic.src = pic.src;
	if(mypic.width >= maxWidth){
		var neupic = document.createElement("img");
		neupic.src = pic.src;
		neupic.setAttribute("width",maxWidth);
		neupic.setAttribute("height",1);
		neupic.setAttribute("border",0);
		// wieder löschen, wegen Skalierung
		neupic.removeAttribute("height");
		mynode.replaceChild(neupic,pic);
	}
}


function searchnode(mynode,mode){
	for(i=0;i<=mynode.childNodes.length;i++){
		if(mynode.childNodes[i]){
			thisnode = mynode.childNodes[i];
			if(thisnode.nodeName === "IMG"){				
				if(mode == 'vollbild'){
					scalePicture(mynode,thisnode)
				}
				else if (mode == 'neuTD'){
					makepicture(mynode,thisnode);
				}
			}
			if(thisnode.nodeName === "A"){
				searchnode(thisnode,mode);
				break;
			}
		}	
	}
}

function changepicture(id,mode,width){
	maxWidth = width;
	var mynode = document.getElementById(id);
	mytd = mynode;
	myparent = document.getElementById("tr_"+id);
	searchnode(mynode,mode);
}

/* Ende Container */

function changepicture(id,mode){
	var mynode = document.getElementById(id);
	mytd = mynode;
	myparent = document.getElementById("tr_"+id);
	searchnode(mynode,mode);
}

function openArtikelversand (context,beitrag_id){
	url = "/app/verschicken/?context="+context+"&beitrag="+beitrag_id;
	win = window.open(url,"Artikelversand","width=550,height=600");
	win.focus();
}
