// JavaScript Document
function getMovieName(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
		alert("this browser");
        return window[movieName];
   }
   else {
       return document.getElementById(movieName);
   }
}
function onPlayerError(errorCode) {
	alert("FEHLER");
	if (errorCode == 100) {
		adderror("Das Video konnte nicht gefunden werden.");
	}
	else {
		adderror("Das Video darf aus lizenzrechtlichen Gründen nicht eingebunden werden.");
	}
} 

function receiveFromFlash (wert,typflash) {
	if (typflash == "id") {
		function bildaktivieren (bild) {
				for (i = 0; i < (bilderinartikel.length); i = i + 2) {
					idname = "artikellayoutbildanfasser0artikelgrafik" + bilderinartikel[i];
					if (aktivesobjekt == null) {
						idname2 = "artikellayoutbildanfasser0" + bild.id;
					}
					else
						idname2 = "artikellayoutbildanfasser0" + aktivesobjekt.id;
					if (document.getElementById(idname) != null) {
						while (document.getElementById(idname) != null) {
							document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
						} 
					document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
					}
					if (document.getElementById(idname2) != null) {
						while (document.getElementById(idname2) != null) {
							document.getElementById(idname2).parentNode.removeChild(document.getElementById(idname2).parentNode.lastChild);
						} 
					}
				}
				aktivesobjekt = bild;
				bildeinstellungen(aktivesobjekt);
				idname = "artikellayoutbildanfasser0" + bild.id;
				if (document.getElementById(idname) == null) {
					linkerab = parseInt(bild.style.left);
					obererab = parseInt(bild.style.top);
					this.anfasser2 = new Array();
					for (i = 0; i < 8; i++) {
						this.anfasser2[i] = document.createElement("div");
						this.anfasser2[i].id = "artikellayoutbildanfasser" + i + bild.id;
						this.anfasser2[i].style.position = "relative";
						this.anfasser2[i].style.background = "url(http://graphic.co2-filter.com/seite/anfasserresize.png)";
						this.anfasser2[i].style.width = "10px";
						this.anfasser2[i].style.height = "10px";
						this.anfasser2[i].onmousedown = resizeinit; 
						alert(this.anfasser2[i]);
					}
					this.anfasser2[0].style.left = linkerab - 5 + "px";
					this.anfasser2[1].style.left = linkerab - 5 + "px";
					this.anfasser2[2].style.left = linkerab - 5 + "px";
					this.anfasser2[3].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
					this.anfasser2[4].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
					this.anfasser2[5].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[6].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[7].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[0].style.top = obererab - 5 + "px";
					this.anfasser2[1].style.top = (obererab - (parseInt(bild.offsetHeight)) / 2) - 15 + "px";
					this.anfasser2[2].style.top = (obererab - parseInt(bild.offsetHeight) - 25) + "px";
					this.anfasser2[3].style.top = obererab - 35 + "px";
					this.anfasser2[4].style.top = obererab - parseInt(bild.offsetHeight) - 45 + "px";
					this.anfasser2[5].style.top = obererab - 55 + "px"; 
					this.anfasser2[6].style.top = obererab - (parseInt(bild.offsetHeight)) / 2 - 65 + "px";
					this.anfasser2[7].style.top = obererab - parseInt(bild.offsetHeight) - 75 + "px";
					this.anfasser2[0].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
					this.anfasser2[1].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
					this.anfasser2[2].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
					this.anfasser2[3].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
					this.anfasser2[4].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
					this.anfasser2[5].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
					this.anfasser2[6].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
					this.anfasser2[7].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
					for (i = 0; i < 8; i++) {
						alert("schleife2 geht");
						bild.appendChild(this.anfasser2[i]);
					}
				}
			}
			
			function bilddeaktivieren (ereignis) {
				//alert(aktivesobjekt.id);
				if (aktivesobjekt != null) {
				ereignis = ereignis ? ereignis : window.event;
				if (deselekt == 1) {
					idname = "artikellayoutbildanfasser0" + aktivesobjekt.id;
					while (document.getElementById(idname) != null) {
						document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
					} 
					document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
				}
				else {
					deselekt = 1;
					deselektbild = null;
				}
			}
			}
			
			function klicklokal (welches) {
				deselektbild = welches.id;
				deselekt = 0;
				bildaktivieren(welches); 
			}
			
			function bildeinstellungen (bild) {
				
				if (document.getElementById("artikelbefehlbildcontainer") == null) {
					if (typ[bild.id] == "bild") {
						this.bildbreite = document.createElement("input");
						this.bildbreite.name = "artikelbildbreite";
						this.bildbreite.className = "inputs";
						this.bildbreite.size = "5";
						this.bildbreite.style.cssFloat = "left";
						this.bildbreite.value = parseInt(bild.offsetWidth);
						this.bildbreite.style.marginRight = "7px";
						this.bildbreite.onkeyup = breitezuweisen;
						
						this.bildhöhe = document.createElement("input");
						this.bildhöhe.name = "artikelbildhöhe";
						this.bildhöhe.className = "inputs";
						this.bildhöhe.size = "5";
						this.bildhöhe.style.cssFloat = "left";
						this.bildhöhe.value = parseInt(bild.offsetHeight);
						this.bildhöhe.style.marginRight = "7px";
						this.bildhöhe.onkeyup = höhezuweisen;
						
						this.breitename = document.createElement("div");
						this.breitename.id = "artikelbildbreitebesch";
						this.breitename.style.cssFloat = "left";
						this.breitename.style.marginRight = "5px";
						this.breitename.innerHTML = "B:";
						this.breitename.style.paddingTop = "1px";
						
						this.höhename = document.createElement("div");
						this.höhename.id = "artikelbildhöhebesch";
						this.höhename.style.cssFloat = "left";
						this.höhename.style.marginRight = "5px";
						this.höhename.innerHTML = "H:";
						this.höhename.style.paddingTop = "1px";
						
						this.bildproportionname = document.createElement("div");
						this.bildproportionname.id = "artikelbildproportionbesch";
						this.bildproportionname.style.cssFloat = "left";
						this.bildproportionname.style.marginRight = "5px";
						this.bildproportionname.innerHTML = "Propartion beibehalten:";
						this.bildproportionname.style.paddingTop = "1px";
						
						this.bildproportion = document.createElement("input");
						this.bildproportion.name = "artikelbildproportion";
						this.bildproportion.className = "inputs";
						this.bildproportion.type = "checkbox";
						this.bildproportion.style.cssFloat = "left";
						this.bildproportion.style.marginRight = "7px";
						this.bildproportion.style.paddingTop = "1px";
						this.bildproportion.onclick = function () { proportionspeichern(bild.id);};
						this.bildproportion.checked = proportion[bild.id] == "undefined" ? false : proportion[bild.id];
						
						this.trennelement1 = document.createElement("div");
						this.trennelement1.className = "befehlsleistetrenner";
						
						this.deckkraftinput = document.createElement("input");
						this.deckkraftinput.name = "artikelbilddeckkraft";
						this.deckkraftinput.size = "5";
						this.deckkraftinput.className = "inputs";
						this.deckkraftinput.style.cssFloat = "left";
						this.deckkraftinput.value = parseFloat(bild.style.opacity) * 100 + "%";
						this.deckkraftinput.style.marginRight = "7px";
						this.deckkraftinput.onkeyup = deckkraftzuweisen;
						
						this.deckkraft = document.createElement("div");
						this.deckkraft.id = "artikelbilddeckkraftbesch";
						this.deckkraft.style.cssFloat = "left";
						this.deckkraft.style.marginRight = "5px";
						this.deckkraft.innerHTML = "Deckkraft:";
						this.deckkraft.style.paddingTop = "1px"; 
						
						this.schattenwurfcheck = document.createElement("input");
						this.schattenwurfcheck.name = "artikelbildschatten";
						this.schattenwurfcheck.className = "inputs";
						this.schattenwurfcheck.type = "checkbox";
						this.schattenwurfcheck.style.cssFloat = "left";
						this.schattenwurfcheck.style.marginRight = "7px";
						this.schattenwurfcheck.style.paddingTop = "1px";
						
						this.schattenwurf = document.createElement("div");
						this.schattenwurf.id = "artikelbildschattenwurfbesch";
						this.schattenwurf.style.cssFloat = "left";
						this.schattenwurf.style.marginRight = "5px";
						this.schattenwurf.innerHTML = "Schattenwurf:";
						this.schattenwurf.style.paddingTop = "1px";
						
						this.trennelement2 = document.createElement("div");
						this.trennelement2.className = "befehlsleistetrenner";
						
						this.ausrichtunglinks = document.createElement("img");
						this.ausrichtunglinks.src = "http://graphic.co2-filter.com/seite/befehl_linksbuendig_passiv.png";
						this.ausrichtunglinks.style.cssFloat = "left";
						this.ausrichtunglinks.style.border = "0px";
						this.ausrichtunglinks.style.marginRight = "5px";
						
						this.ausrichtungmitte = document.createElement("img");
						this.ausrichtungmitte.src = "http://graphic.co2-filter.com/seite/befehl_mittig_passiv.png";
						this.ausrichtungmitte.style.cssFloat = "left";
						this.ausrichtungmitte.style.border = "0px";
						this.ausrichtungmitte.style.marginRight = "5px";
						
						this.ausrichtungrechts = document.createElement("img");
						this.ausrichtungrechts.src = "http://graphic.co2-filter.com/seite/befehl_rechtsbuendig_passiv.png";
						this.ausrichtungrechts.style.cssFloat = "left";
						this.ausrichtungrechts.style.border = "0px";
						this.ausrichtungrechts.style.marginRight = "5px";
						
						this.umbruch = document.createElement("br");
						this.umbruch.style.clear = "both";
						
						this.befehlcontainer = document.createElement("div");
						this.befehlcontainer.id = "artikelbefehlbildcontainer";
						
						this.befehlcontainer.appendChild(this.breitename);
						this.befehlcontainer.appendChild(this.bildbreite);
						this.befehlcontainer.appendChild(this.höhename);
						this.befehlcontainer.appendChild(this.bildhöhe);
						this.befehlcontainer.appendChild(this.bildproportionname);
						this.befehlcontainer.appendChild(this.bildproportion);
						this.befehlcontainer.appendChild(this.trennelement1);
						this.befehlcontainer.appendChild(this.deckkraft);
						this.befehlcontainer.appendChild(this.deckkraftinput);
						this.befehlcontainer.appendChild(this.schattenwurf);
						this.befehlcontainer.appendChild(this.schattenwurfcheck); 
						this.befehlcontainer.appendChild(this.trennelement2);
						this.befehlcontainer.appendChild(this.ausrichtunglinks);
						this.befehlcontainer.appendChild(this.ausrichtungmitte);
						this.befehlcontainer.appendChild(this.ausrichtungrechts);
						this.befehlcontainer.appendChild(this.umbruch);
						this.befehlsleiste.appendChild(this.befehlcontainer);
					}
					else if (typ[bild.id] == "youtube") {
						
						var status = {
							dragobject: null,
							dragx: 0,
							marginx: 0,
							posx: 0,
							draginit: function (ereignis) {
								ereignis = ereignis ? ereignis : window.event;
								status.dragobject = this;
								status.dragx = ereignis.clientX;
								status.marginx = parseInt(status.dragobject.style.left);
								getMovieName(bild.id).sendDataToFlash("","startnewposition");
								document.onmousemove = status.drag;
								document.onmouseup = status.dragstop;
								return false;
							},
							drag: function (ereignis) {
								ereignis = ereignis ? ereignis : window.event; 
								status.posx = ereignis.clientX;
								status.marginx = parseInt(status.dragobject.style.left);
								if (status.marginx + (status.posx - status.dragx) < 0) {
									status.dragobject.style.left = "0px";
								}
								else if (status.marginx + (status.posx - status.dragx) > 75) {
									status.dragobject.style.left = "75px";
								}
								
								else {
									status.dragobject.style.left = status.marginx + (status.posx - status.dragx) + "px";
								}
								status.dragx = ereignis.clientX;
								return false;
							},
							dragstop: function () {
								status.marginx = parseInt(status.dragobject.style.left);
								getMovieName(bild.id).sendDataToFlash(status.marginx,"newposition");
								document.onmousemove = null;
								document.onmouseup = null;
								status.dragobject = null;
							}
						}
						
						/*function dragstatus (ereignis) {
							ereignis = ereignis ? ereignis : window.event; 
							status.posx = ereignis.clientX;
							status.marginx = parseInt(status.dragobject.style.left);
							if (status.marginx + (status.posx - status.dragx) < 0) {
								status.dragobject.style.left = "0px";
							}
							else if (status.marginx + (status.posx - status.dragx) > 75) {
								status.dragobject.style.left = "75px";
							}
							
							else {
								status.dragobject.style.left = status.marginx + (status.posx - status.dragx) + "px";
							}
							status.dragx = ereignis.clientX;
							return false;
							
						}
								
						function dragstopstatus () {
							status.marginx = parseInt(dragobject.style.left);
							display = 0;
							document.onmousemove = null;
							status.dragobject.onmouseup = null;
							status.dragobject = null;
						}
								
								
						function dragstartinitstatus () {
							ereignis = ereignis ? ereignis : window.event;
							status.dragobject = this;
							status.dragx = ereignis.clientX;
							status.marginx = parseInt(status.dragobject.style.left);
							document.onmousemove = dragstatus;
							status.dragobject.onmouseup = dragstopstatus;
							return false;
						}*/
						
						this.abmessungenname = document.createElement("div");
						this.abmessungenname.id = "artikelyoutubeabmessungbesch";
						this.abmessungenname.style.cssFloat = "left";
						this.abmessungenname.style.marginRight = "5px";
						this.abmessungenname.innerHTML = "Größe:";
						this.abmessungenname.style.paddingTop = "3px";
						
						this.abmessungeninput = document.createElement("select");
						this.abmessungeninput.id = "artikelmedienyoutubeabmessselect";
						this.abmessungeninput.name = "artikelmedienyoutubeabmessselect";
						this.abmessungeninput.style.cssFloat = "left";
						this.abmessungeninput.onchange = function () {  bild.width = this.options[this.selectedIndex].value + "px"; bild.height = ((this.options[this.selectedIndex].value / 16) * 9) + "px"};
						
						this.abmessungenoption1 = document.createElement("option");
						this.abmessungenoption1.innerHTML = "320 x 180";
						this.abmessungenoption1.value = "320";
						
						this.abmessungenoption2 = document.createElement("option");
						this.abmessungenoption2.innerHTML = "480 x 270";
						this.abmessungenoption2.value = "480";
						this.abmessungenoption2.defaultSelected = true;
						
						this.abmessungenoption3 = document.createElement("option");
						this.abmessungenoption3.innerHTML = "640 x 360";
						this.abmessungenoption3.value = "640";
						
						this.abmessungenoption4 = document.createElement("option");
						this.abmessungenoption4.innerHTML = "800 x 450";
						this.abmessungenoption4.value = "800";
						
						this.abmessungenoption5 = document.createElement("option");
						this.abmessungenoption5.innerHTML = "1024 x 576";
						this.abmessungenoption5.value = "1024";
						
						this.abmessungenoption6 = document.createElement("option");
						this.abmessungenoption6.innerHTML = "1280 x 720 (HD)";
						this.abmessungenoption6.value = "1280";
						
						
						this.playerelemente = document.createElement("div");
						this.playerelemente.id = "artikelmedienplayerelemente";
						this.playerelemente.style.paddingTop = "3px";
						
						this.playerelementeplay = document.createElement("img");
						this.playerelementeplay.id = "artikelmedienyoutubeplaypause";
						this.playerelementeplay.src = "http://graphic.co2-filter.com/seite/playbutton.png";
						this.playerelementeplay.style.cssFloat = "left";
						this.playerelementeplay.onclick = function () { changepausetofirstplay(); };
						
						this.playerelementestatus = document.createElement("div");
						this.playerelementestatus.style.background = "url(http://graphic.co2-filter.com/seite/youtubestatus.png)";
						this.playerelementestatus.style.cssFloat = "left";
						this.playerelementestatus.style.width = "100px";
						this.playerelementestatus.style.height = "8px";
						this.playerelementestatus.style.marginTop = "2px";
						this.playerelementestatus.style.marginBottom = "2px";
						this.playerelementestatus.style.marginLeft = "5px";
						this.playerelementestatus.style.marginRight = "5px";
						
						this.playerelementestatusding = document.createElement("div");
						this.playerelementestatusding.id = "dbflexxyoutubestatusshow";
						this.playerelementestatusding.style.background = "url(http://graphic.co2-filter.com/seite/statusding.png)";
						this.playerelementestatusding.style.position = "relative";
						this.playerelementestatusding.style.width = "25px";
						this.playerelementestatusding.style.height = "8px";
						this.playerelementestatusding.style.top = "0px";
						this.playerelementestatusding.style.left = "0px";
						this.playerelementestatusding.onmousedown = status.draginit;
						
						this.playerelementelautstärke = document.createElement("img");
						this.playerelementelautstärke.src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
						this.playerelementelautstärke.id = "artikelmedienyoutubelautstarke";
						this.playerelementelautstärke.onclick = function () { changevolumetomute(); };
						
						this.rahmencheck = document.createElement("input");
						this.rahmencheck.name = "artikelyoutuberahmen";
						this.rahmencheck.className = "inputs";
						this.rahmencheck.type = "checkbox";
						this.rahmencheck.style.cssFloat = "left";
						this.rahmencheck.style.marginRight = "7px";
						this.rahmencheck.style.paddingTop = "1px";
						
						this.rahmen = document.createElement("div");
						this.rahmen.id = "artikelyoutuberahmenbesch";
						this.rahmen.style.cssFloat = "left";
						this.rahmen.style.marginRight = "5px";
						this.rahmen.innerHTML = "Rahmen:";
						this.rahmen.style.paddingTop = "1px";
						
						this.ähnlichcheck = document.createElement("input");
						this.ähnlichcheck.name = "artikelyoutubeahnlich";
						this.ähnlichcheck.className = "inputs";
						this.ähnlichcheck.type = "checkbox";
						this.ähnlichcheck.style.cssFloat = "left";
						this.ähnlichcheck.style.marginRight = "7px";
						this.ähnlichcheck.style.paddingTop = "1px";
						
						this.ähnlich = document.createElement("div");
						this.ähnlich.id = "artikelyoutubeahnlichbesch";
						this.ähnlich.style.cssFloat = "left";
						this.ähnlich.style.marginRight = "5px";
						this.ähnlich.innerHTML = "Ähnliche Videos:";
						this.ähnlich.style.paddingTop = "1px";
						
						this.umbruch = document.createElement("br");
						this.umbruch.style.clear = "both";
						
						this.trennelement1 = document.createElement("div");
						this.trennelement1.className = "befehlsleistetrenner";
						
						this.trennelement2 = document.createElement("div");
						this.trennelement2.className = "befehlsleistetrenner";
						
						this.befehlcontainer = document.createElement("div");
						this.befehlcontainer.id = "artikelbefehlbildcontainer";
						
						this.abmessungeninput.appendChild(this.abmessungenoption1);
						this.abmessungeninput.appendChild(this.abmessungenoption2);
						this.abmessungeninput.appendChild(this.abmessungenoption3);
						this.abmessungeninput.appendChild(this.abmessungenoption4);
						this.abmessungeninput.appendChild(this.abmessungenoption5);
						this.abmessungeninput.appendChild(this.abmessungenoption6);
						this.befehlcontainer.appendChild(this.abmessungenname);
						this.befehlcontainer.appendChild(this.abmessungeninput);
						this.playerelemente.appendChild(this.playerelementeplay);
						this.playerelementestatus.appendChild(this.playerelementestatusding);
						this.playerelemente.appendChild(this.playerelementestatus);
						this.playerelemente.appendChild(this.playerelementelautstärke);
						this.playerelemente.appendChild(this.umbruch);
						this.befehlcontainer.appendChild(this.trennelement1);
						this.befehlcontainer.appendChild(this.rahmen);
						this.befehlcontainer.appendChild(this.rahmencheck);
						this.befehlcontainer.appendChild(this.ähnlich);
						this.befehlcontainer.appendChild(this.ähnlichcheck);
						this.befehlcontainer.appendChild(this.trennelement2);
						this.befehlcontainer.appendChild(this.playerelemente);
						document.getElementById("artikellayoutbefehlsleiste").appendChild(this.befehlcontainer); 
						
						function changepausetofirstplay() {
							getMovieName(bild.id).sendDataToFlash("playfirst","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/pausebutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changeplaytopause(); };
						}
						
						function changepausetoplay() {
							getMovieName(bild.id).sendDataToFlash("play","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/pausebutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changeplaytopause(); };
						}
						
						function changeplaytopause() {
							getMovieName(bild.id).sendDataToFlash("pause","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/playbutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changepausetoplay(); };
						}
						
						function changevolumetomute() {
							getMovieName(bild.id).sendDataToFlash("mute","changestate");
							document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecheraus.png";
							document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changemutetovolume(); };
						}
						
						function changemutetovolume() {
							getMovieName(bild.id).sendDataToFlash("unmute","changestate");
							document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
							document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changevolumetomute(); };
						}
						
					}
				}
				
				else {
					if (typ[bild.id] == "bild") {
					this.bildbreite.value = parseInt(bild.offsetWidth);
					this.bildhöhe.value = parseInt(bild.offsetHeight);
					this.bildproportion.checked = proportion[bild] == null ? false : proportion[bild];
					}
				}
			}
		object = document.getElementById(wert);
		klicklokal(object);
	}
	
	
	else if (typflash == "loading") {
		if (wert == 1) {
			stoploader();
		}
		
		else if (wert == "stop") {
			adderror("Das Video konnte nicht geladen werden.");
			stoploader();
		}
		else {
			addloader("Lade Video ... ("+ (Math.round((wert * 100))) +" %)");
		}
	}
	
	else if (typflash == "duration") {
		document.getElementById("dbflexxyoutubestatusshow").style.left = wert + "px";
	}
}

function startDraggingInJavascript (object,xposition,yposition) {
	gesamtpositiony = parseInt(document.getElementById(object).offsetTop) - parseInt(window.pageYOffset) + yposition;
	gesamtpositionx = parseInt(document.getElementById(object).offsetLeft) - parseInt(window.pageXOffset) + xposition;
	function drag (ereignis) {

		if (display == 0) {
			idname = "artikellayoutbildanfasser0" + dragobject.id;
			while (document.getElementById(idname) != null) {
				document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
			}
			display = 1;
		}
		ereignis = ereignis ? ereignis : window.event; 
		posx = ereignis.clientX;
		posy = ereignis.clientY;
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		if (altesmarginx < 15) {
			dragobject.style.left = "0px";
			altesmarginx = altesmarginx + (posx - dragx); 
		}
		
		else if (altesmarginx > (gesamtebreite - 15 - dragobject.offsetWidth)) {
			dragobject.style.left = gesamtebreite - dragobject.offsetWidth + "px";
			altesmarginx = altesmarginx + (posx - dragx);
		}
		
		else if (altesmarginx > (gesamtebreite - dragobject.offsetWidth) / 2 - 8 && altesmarginx < (gesamtebreite - dragobject.offsetWidth) / 2 + 8) { 
			dragobject.style.left = (gesamtebreite - dragobject.offsetWidth) / 2 + "px";
			altesmarginx = altesmarginx + (posx - dragx);
		}
		
		else {
			dragobject.style.left = altesmarginx + (posx - dragx) + "px";
			altesmarginx = parseInt(dragobject.style.left);
		}
		dragobject.style.top = marginy + (posy - dragy) + "px";
		dragx = ereignis.clientX;
		dragy = ereignis.clientY;
		return false;
		
	}
			
	function dragstop () {
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		display = 0;
		//bildaktivieren(dragobject);
		document.onmousemove = null;
		dragobject.onmouseup = null;
		dragobject = null;
	}
			
			
	function dragstartinit (x,y,objekt) {
		dragobject = objekt;
		dragx = x;
		dragy = y;
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		altesmarginx = parseInt(dragobject.style.left);
		altesmarginy = parseInt(dragobject.style.top);
		document.onmousemove = drag;
		dragobject.onmouseup = dragstop;
		return false;
	}
	
	function bildaktivieren (bild) {
				for (i = 0; i < (bilderinartikel.length); i = i + 2) {
					idname = "artikellayoutbildanfasser0artikelgrafik" + bilderinartikel[i];
					if (aktivesobjekt == null) {
						idname2 = "artikellayoutbildanfasser0" + bild.id;
					}
					else
						idname2 = "artikellayoutbildanfasser0" + aktivesobjekt.id;
					if (document.getElementById(idname) != null) {
						while (document.getElementById(idname) != null) {
							document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
						} 
					document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
					}
					if (document.getElementById(idname2) != null) {
						while (document.getElementById(idname2) != null) {
							document.getElementById(idname2).parentNode.removeChild(document.getElementById(idname2).parentNode.lastChild);
						} 
					}
				}
				aktivesobjekt = bild;
				bildeinstellungen(aktivesobjekt);
				idname = "artikellayoutbildanfasser0" + bild.id;
				if (document.getElementById(idname) == null) {
					linkerab = parseInt(bild.style.left);
					obererab = parseInt(bild.style.top);
					this.anfasser2 = new Array();
					for (i = 0; i < 8; i++) {
						this.anfasser2[i] = document.createElement("div");
						this.anfasser2[i].id = "artikellayoutbildanfasser" + i + bild.id;
						this.anfasser2[i].style.position = "relative";
						this.anfasser2[i].style.background = "url(http://graphic.co2-filter.com/seite/anfasserresize.png)";
						this.anfasser2[i].style.width = "10px";
						this.anfasser2[i].style.height = "10px";
					}
					this.anfasser2[0].style.left = linkerab - 5 + "px";
					this.anfasser2[1].style.left = linkerab - 5 + "px";
					this.anfasser2[2].style.left = linkerab - 5 + "px";
					this.anfasser2[3].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
					this.anfasser2[4].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
					this.anfasser2[5].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[6].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[7].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
					this.anfasser2[0].style.top = obererab - 5 + "px";
					this.anfasser2[1].style.top = (obererab - (parseInt(bild.offsetHeight)) / 2) - 15 + "px";
					this.anfasser2[2].style.top = (obererab - parseInt(bild.offsetHeight) - 25) + "px";
					this.anfasser2[3].style.top = obererab - 35 + "px";
					this.anfasser2[4].style.top = obererab - parseInt(bild.offsetHeight) - 45 + "px";
					this.anfasser2[5].style.top = obererab - 55 + "px"; 
					this.anfasser2[6].style.top = obererab - (parseInt(bild.offsetHeight)) / 2 - 65 + "px";
					this.anfasser2[7].style.top = obererab - parseInt(bild.offsetHeight) - 75 + "px";
					this.anfasser2[0].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
					this.anfasser2[1].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
					this.anfasser2[2].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
					this.anfasser2[3].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
					this.anfasser2[4].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
					this.anfasser2[5].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
					this.anfasser2[6].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
					this.anfasser2[7].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
					
					
					/*for (i = 0; i < 8; i++) {
						bild.appendChild(this.anfasser2[i]);
					}*/
				}
			}
			
			function bilddeaktivieren (ereignis) {
				//alert(aktivesobjekt.id);
				if (aktivesobjekt != null) {
				ereignis = ereignis ? ereignis : window.event;
				if (deselekt == 1) {
					idname = "artikellayoutbildanfasser0" + aktivesobjekt.id;
					while (document.getElementById(idname) != null) {
						document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
					} 
					document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
				}
				else {
					deselekt = 1;
					deselektbild = null;
				}
			}
			}
			
			function klicklokal (welches) {
				deselektbild = welches.id;
				deselekt = 0;
				bildaktivieren(welches); 
			}
			
			function bildeinstellungen (bild) {
				
				if (document.getElementById("artikelbefehlbildcontainer") == null) {
					if (typ[bild.id] == "bild") {
						this.bildbreite = document.createElement("input");
						this.bildbreite.name = "artikelbildbreite";
						this.bildbreite.className = "inputs";
						this.bildbreite.size = "5";
						this.bildbreite.style.cssFloat = "left";
						this.bildbreite.value = parseInt(bild.offsetWidth);
						this.bildbreite.style.marginRight = "7px";
						this.bildbreite.onkeyup = breitezuweisen;
						
						this.bildhöhe = document.createElement("input");
						this.bildhöhe.name = "artikelbildhöhe";
						this.bildhöhe.className = "inputs";
						this.bildhöhe.size = "5";
						this.bildhöhe.style.cssFloat = "left";
						this.bildhöhe.value = parseInt(bild.offsetHeight);
						this.bildhöhe.style.marginRight = "7px";
						this.bildhöhe.onkeyup = höhezuweisen;
						
						this.breitename = document.createElement("div");
						this.breitename.id = "artikelbildbreitebesch";
						this.breitename.style.cssFloat = "left";
						this.breitename.style.marginRight = "5px";
						this.breitename.innerHTML = "B:";
						this.breitename.style.paddingTop = "1px";
						
						this.höhename = document.createElement("div");
						this.höhename.id = "artikelbildhöhebesch";
						this.höhename.style.cssFloat = "left";
						this.höhename.style.marginRight = "5px";
						this.höhename.innerHTML = "H:";
						this.höhename.style.paddingTop = "1px";
						
						this.bildproportionname = document.createElement("div");
						this.bildproportionname.id = "artikelbildproportionbesch";
						this.bildproportionname.style.cssFloat = "left";
						this.bildproportionname.style.marginRight = "5px";
						this.bildproportionname.innerHTML = "Propartion beibehalten:";
						this.bildproportionname.style.paddingTop = "1px";
						
						this.bildproportion = document.createElement("input");
						this.bildproportion.name = "artikelbildproportion";
						this.bildproportion.className = "inputs";
						this.bildproportion.type = "checkbox";
						this.bildproportion.style.cssFloat = "left";
						this.bildproportion.style.marginRight = "7px";
						this.bildproportion.style.paddingTop = "1px";
						this.bildproportion.onclick = function () { proportionspeichern(bild.id);};
						this.bildproportion.checked = proportion[bild.id] == "undefined" ? false : proportion[bild.id];
						
						this.trennelement1 = document.createElement("div");
						this.trennelement1.className = "befehlsleistetrenner";
						
						this.deckkraftinput = document.createElement("input");
						this.deckkraftinput.name = "artikelbilddeckkraft";
						this.deckkraftinput.size = "5";
						this.deckkraftinput.className = "inputs";
						this.deckkraftinput.style.cssFloat = "left";
						this.deckkraftinput.value = parseFloat(bild.style.opacity) * 100 + "%";
						this.deckkraftinput.style.marginRight = "7px";
						this.deckkraftinput.onkeyup = deckkraftzuweisen;
						
						this.deckkraft = document.createElement("div");
						this.deckkraft.id = "artikelbilddeckkraftbesch";
						this.deckkraft.style.cssFloat = "left";
						this.deckkraft.style.marginRight = "5px";
						this.deckkraft.innerHTML = "Deckkraft:";
						this.deckkraft.style.paddingTop = "1px"; 
						
						this.schattenwurfcheck = document.createElement("input");
						this.schattenwurfcheck.name = "artikelbildschatten";
						this.schattenwurfcheck.className = "inputs";
						this.schattenwurfcheck.type = "checkbox";
						this.schattenwurfcheck.style.cssFloat = "left";
						this.schattenwurfcheck.style.marginRight = "7px";
						this.schattenwurfcheck.style.paddingTop = "1px";
						
						this.schattenwurf = document.createElement("div");
						this.schattenwurf.id = "artikelbildschattenwurfbesch";
						this.schattenwurf.style.cssFloat = "left";
						this.schattenwurf.style.marginRight = "5px";
						this.schattenwurf.innerHTML = "Schattenwurf:";
						this.schattenwurf.style.paddingTop = "1px";
						
						this.trennelement2 = document.createElement("div");
						this.trennelement2.className = "befehlsleistetrenner";
						
						this.ausrichtunglinks = document.createElement("img");
						this.ausrichtunglinks.src = "http://graphic.co2-filter.com/seite/befehl_linksbuendig_passiv.png";
						this.ausrichtunglinks.style.cssFloat = "left";
						this.ausrichtunglinks.style.border = "0px";
						this.ausrichtunglinks.style.marginRight = "5px";
						
						this.ausrichtungmitte = document.createElement("img");
						this.ausrichtungmitte.src = "http://graphic.co2-filter.com/seite/befehl_mittig_passiv.png";
						this.ausrichtungmitte.style.cssFloat = "left";
						this.ausrichtungmitte.style.border = "0px";
						this.ausrichtungmitte.style.marginRight = "5px";
						
						this.ausrichtungrechts = document.createElement("img");
						this.ausrichtungrechts.src = "http://graphic.co2-filter.com/seite/befehl_rechtsbuendig_passiv.png";
						this.ausrichtungrechts.style.cssFloat = "left";
						this.ausrichtungrechts.style.border = "0px";
						this.ausrichtungrechts.style.marginRight = "5px";
						
						this.umbruch = document.createElement("br");
						this.umbruch.style.clear = "both";
						
						this.befehlcontainer = document.createElement("div");
						this.befehlcontainer.id = "artikelbefehlbildcontainer";
						
						this.befehlcontainer.appendChild(this.breitename);
						this.befehlcontainer.appendChild(this.bildbreite);
						this.befehlcontainer.appendChild(this.höhename);
						this.befehlcontainer.appendChild(this.bildhöhe);
						this.befehlcontainer.appendChild(this.bildproportionname);
						this.befehlcontainer.appendChild(this.bildproportion);
						this.befehlcontainer.appendChild(this.trennelement1);
						this.befehlcontainer.appendChild(this.deckkraft);
						this.befehlcontainer.appendChild(this.deckkraftinput);
						this.befehlcontainer.appendChild(this.schattenwurf);
						this.befehlcontainer.appendChild(this.schattenwurfcheck); 
						this.befehlcontainer.appendChild(this.trennelement2);
						this.befehlcontainer.appendChild(this.ausrichtunglinks);
						this.befehlcontainer.appendChild(this.ausrichtungmitte);
						this.befehlcontainer.appendChild(this.ausrichtungrechts);
						this.befehlcontainer.appendChild(this.umbruch);
						this.befehlsleiste.appendChild(this.befehlcontainer);
					}
					else if (typ[bild.id] == "youtube") {
						alert("läuft auch");
						this.abmessungenname = document.createElement("div");
						this.abmessungenname.id = "artikelyoutubeabmessungbesch";
						this.abmessungenname.style.cssFloat = "left";
						this.abmessungenname.style.marginRight = "5px";
						this.abmessungenname.innerHTML = "Größe:";
						this.abmessungenname.style.paddingTop = "3px";
						
						this.abmessungeninput = document.createElement("select");
						this.abmessungeninput.id = "artikelmedienyoutubeabmessselect";
						this.abmessungeninput.name = "artikelmedienyoutubeabmessselect";
						this.abmessungeninput.style.cssFloat = "left";
						//this.abmessungeninput.onchange = function () { youtubeabmessungzuweisen(); };
						
						this.playerelemente = document.createElement("div");
						this.playerelemente.id = "artikelmedienplayerelemente";
						this.playerelemente.style.paddingTop = "3px";
						
						this.playerelementeplay = document.createElement("img");
						this.playerelementeplay.id = "artikelmedienyoutubeplaypause";
						this.playerelementeplay.src = "http://graphic.co2-filter.com/seite/playbutton.png";
						this.playerelementeplay.style.cssFloat = "left";
						this.playerelementeplay.onclick = function () { changepausetofirstplay(); };
						
						this.playerelementestatus = document.createElement("div");
						this.playerelementestatus.style.background = "url(http://graphic.co2-filter.com/seite/youtubestatus.png)";
						this.playerelementestatus.style.cssFloat = "left";
						this.playerelementestatus.style.width = "100px";
						this.playerelementestatus.style.height = "8px";
						this.playerelementestatus.style.marginTop = "2px";
						this.playerelementestatus.style.marginBottom = "2px";
						this.playerelementestatus.style.marginLeft = "5px";
						this.playerelementestatus.style.marginRight = "5px";
						
						this.playerelementestatusding = document.createElement("div");
						this.playerelementestatusding.id = "dbflexxyoutubestatusshow";
						this.playerelementestatusding.style.background = "url(http://graphic.co2-filter.com/seite/statusding.png)";
						this.playerelementestatusding.style.position = "relative";
						this.playerelementestatusding.style.width = "25px";
						this.playerelementestatusding.style.height = "8px";
						this.playerelementestatusding.style.top = "0px";
						this.playerelementestatusding.style.left = "0px";
						this.playerelementestatusding.onmousedown = dragstartinitstatus;
						
						this.playerelementelautstärke = document.createElement("img");
						this.playerelementelautstärke.src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
						this.playerelementelautstärke.id = "artikelmedienyoutubelautstarke";
						this.playerelementelautstärke.onclick = function () { changevolumetomute(); };
						
						this.rahmencheck = document.createElement("input");
						this.rahmencheck.name = "artikelyoutuberahmen";
						this.rahmencheck.className = "inputs";
						this.rahmencheck.type = "checkbox";
						this.rahmencheck.style.cssFloat = "left";
						this.rahmencheck.style.marginRight = "7px";
						this.rahmencheck.style.paddingTop = "1px";
						
						this.rahmen = document.createElement("div");
						this.rahmen.id = "artikelyoutuberahmenbesch";
						this.rahmen.style.cssFloat = "left";
						this.rahmen.style.marginRight = "5px";
						this.rahmen.innerHTML = "Rahmen:";
						this.rahmen.style.paddingTop = "1px";
						
						this.ähnlichcheck = document.createElement("input");
						this.ähnlichcheck.name = "artikelyoutubeahnlich";
						this.ähnlichcheck.className = "inputs";
						this.ähnlichcheck.type = "checkbox";
						this.ähnlichcheck.style.cssFloat = "left";
						this.ähnlichcheck.style.marginRight = "7px";
						this.ähnlichcheck.style.paddingTop = "1px";
						
						this.ähnlich = document.createElement("div");
						this.ähnlich.id = "artikelyoutubeahnlichbesch";
						this.ähnlich.style.cssFloat = "left";
						this.ähnlich.style.marginRight = "5px";
						this.ähnlich.innerHTML = "Ähnliche Videos:";
						this.ähnlich.style.paddingTop = "1px";
						
						this.umbruch = document.createElement("br");
						this.umbruch.style.clear = "both";
						
						this.trennelement1 = document.createElement("div");
						this.trennelement1.className = "befehlsleistetrenner";
						
						this.trennelement2 = document.createElement("div");
						this.trennelement2.className = "befehlsleistetrenner";
						
						this.befehlcontainer = document.createElement("div");
						this.befehlcontainer.id = "artikelbefehlbildcontainer";
						
						this.befehlcontainer.appendChild(this.abmessungenname);
						this.befehlcontainer.appendChild(this.abmessungeninput);
						this.playerelemente.appendChild(this.playerelementeplay);
						this.playerelementestatus.appendChild(this.playerelementestatusding);
						this.playerelemente.appendChild(this.playerelementestatus);
						this.playerelemente.appendChild(this.playerelementelautstärke);
						this.playerelemente.appendChild(this.umbruch);
						this.befehlcontainer.appendChild(this.trennelement1);
						this.befehlcontainer.appendChild(this.rahmen);
						this.befehlcontainer.appendChild(this.rahmencheck);
						this.befehlcontainer.appendChild(this.ähnlich);
						this.befehlcontainer.appendChild(this.ähnlichcheck);
						this.befehlcontainer.appendChild(this.trennelement2);
						this.befehlcontainer.appendChild(this.playerelemente);
						this.befehlsleiste.appendChild(this.befehlcontainer); 
						
						function changepausetofirstplay() {
							getMovieName(bild.id).sendDataToFlash("playfirst","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/pausebutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changeplaytopause(); };
						}
						
						function changepausetoplay() {
							getMovieName(bild.id).sendDataToFlash("play","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/pausebutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changeplaytopause(); };
						}
						
						function changeplaytopause() {
							getMovieName(bild.id).sendDataToFlash("pause","changestate");
							document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/playbutton.png";
							document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changepausetoplay(); };
						}
						
						function changevolumetomute() {
							getMovieName(bild.id).sendDataToFlash("mute","changestate");
							document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecheraus.png";
							document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changemutetovolume(); };
						}
						
						function changemutetovolume() {
							getMovieName(bild.id).sendDataToFlash("unmute","changestate");
							document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
							document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changevolumetomute(); };
						}
						
						status.dragobject = null;
						status.dragx = 0;
						status.marginx = 0;
						status.posx = 0;
						
						function dragstatus (ereignis) {
							ereignis = ereignis ? ereignis : window.event; 
							status.posx = ereignis.clientX;
							status.marginx = parseInt(status.dragobject.style.left);
							if (status.marginx + (status.posx - status.dragx) < 0) {
								status.dragobject.style.left = "0px";
							}
							else if (status.marginx + (status.posx - status.dragx) > 75) {
								status.dragobject.style.left = "75px";
							}
							
							else {
								status.dragobject.style.left = status.marginx + (status.posx - status.dragx) + "px";
							}
							status.dragx = ereignis.clientX;
							return false;
							
						}
								
						function dragstopstatus () {
							status.marginx = parseInt(dragobject.style.left);
							display = 0;
							document.onmousemove = null;
							status.dragobject.onmouseup = null;
							status.dragobject = null;
						}
								
								
						function dragstartinitstatus (ereignis) {
							ereignis = ereignis ? ereignis : window.event;
							status.dragobject = this;
							status.dragx = ereignis.clientX;
							status.marginx = parseInt(status.dragobject.style.left);
							document.onmousemove = dragstatus;
							status.dragobject.onmouseup = dragstopstatus;
							return false;
						}
						
					}
				}
				else {
					if (typ[bild.id] == "bild") {
					this.bildbreite.value = parseInt(bild.offsetWidth);
					this.bildhöhe.value = parseInt(bild.offsetHeight);
					this.bildproportion.checked = proportion[bild] == null ? false : proportion[bild];
					}
				}
			}
	
	dragstartinit(gesamtpositionx,gesamtpositiony,document.getElementById(object));
			
}

function setjavascripttobeready (wert) {
	if (wert == "ready") {
		for (i = 0; i < document.getElementsByName("artikelmedienyoutubeurl").length; i++) {
			urlyoutube2 = urlyoutube[i].split("/");					
			urlyoutube2 = urlyoutube2[4];
			id = "artikelyoutube" + document.getElementsByName("artikelmedienyoutubeurl")[i].name;
			getMovieName(id).sendDataToFlash(id,"id");
			getMovieName(id).sendDataToFlash(urlyoutube2,"url");
			//ytplayerstatus = window.setInterval(function () { checkytplayerload(id); },500);
		}
	}
}

function checkytplayerload (id) {
	percentage = getMovieName(id).sendDataToFlash("load","loading");
	document.getElementById("dbflexxwarningcontent").innerHTML = percentage;
	if (percentage == 1) {
		window.clearInterval("ytplayerstatus");
	}
}

function deaktivieremedienbrowser (where) {
			document.getElementById("artikelmedien").style.display = "none";
			document.getElementById("artikelmedienklapper").src = "http://graphic.co2-filter.com/seite/dbflexxshowmore.png";
			document.getElementById("artikelmedienklapper").onclick = function () { aktivieremedienbrowser(where); };
		}
		
function layoutmodusfunc () {
	
	zeit = new Date();
	date = zeit.getDate() < 10 ? "0" + zeit.getDate() : zeit.getDate();
	monat = zeit.getMonth() < 10 ? "0" + (zeit.getMonth() + 1) : zeit.getMonth() + 1;
	stunde = zeit.getHours() < 10 ? "0" + zeit.getHours() : zeit.getHours();
	minuten = zeit.getMinutes() < 10 ? "0" + zeit.getMinutes() : zeit.getMinutes();
	datum = date + "." + monat + "." + zeit.getFullYear();
	uhrzeit = stunde + ":" + minuten + "Uhr";
	
	if(typeof(marginleft) == "undefined") {
		marginleft = new Array(); 
	}
	
	if(typeof(margintop) == "undefined") {
		margintop = new Array();
	}
	if(typeof(width) == "undefined") {
		width = new Array();
	}
	if(typeof(height) == "undefined") {
		height = new Array();
	}
	if(typeof(deckkraft) == "undefined") {
		deckkraft = new Array();
	}
	if(typeof(schatten) == "undefined") {
		schatten = new Array();
	}
			
	/*marginleft = typeof(marginleft) == "undefined" ? new Array() : marginleft;
	margintop = typeof(margintop) == "undefined" ? new Array() : margintop;
	width = typeof(width) == "undefined" ? new Array() : width;
	height = typeof(height) == "undefined" ? new Array() : height;
	deckkraft = typeof(deckkraft) == "undefined" ? new Array() : deckkraft;
	schatten = new Array();*/
	proportion = typeof(proportion) == "undefined" ? new Array() : proportion;
	schatten2 = new Array();
	
	this.befehlsleiste = document.createElement("div");
	this.befehlsleiste.id = "artikellayoutbefehlsleiste";
	this.befehlsleiste.style.height = "30px";
	this.befehlsleiste.style.width = "100%";
	this.befehlsleiste.style.fontSize = "12px";
	this.befehlsleiste.style.background = "#999999";
	this.befehlsleiste.style.marginTop = "-16px";
	this.befehlsleiste.style.paddingTop = "7px";
	
	function bildaktivieren (bild) {
		for (i = 0; i < (bilderinartikel.length); i = i + 2) {
			idname = "artikellayoutbildanfasser0artikelgrafik" + bilderinartikel[i];
			if (aktivesobjekt == null) {
				idname2 = "artikellayoutbildanfasser0" + bild.id;
			}
			else
				idname2 = "artikellayoutbildanfasser0" + aktivesobjekt.id;
			if (document.getElementById(idname) != null) {
				while (document.getElementById(idname) != null) {
					document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
				} 
			document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
			}
			if (document.getElementById(idname2) != null) {
				while (document.getElementById(idname2) != null) {
					document.getElementById(idname2).parentNode.removeChild(document.getElementById(idname2).parentNode.lastChild);
				} 
			}
		}
		aktivesobjekt = bild;
		bildeinstellungen(aktivesobjekt);
		idname = "artikellayoutbildanfasser0" + bild.id;
		if (document.getElementById(idname) == null) {
			linkerab = parseInt(bild.style.left);
			obererab = parseInt(bild.style.top);
		this.anfasser = new Array();
		for (i = 0; i < 8; i++) {
			this.anfasser[i] = document.createElement("div");
			this.anfasser[i].id = "artikellayoutbildanfasser" + i + bild.id;
			this.anfasser[i].style.position = "relative";
			this.anfasser[i].style.background = "url(http://graphic.co2-filter.com/seite/anfasserresize.png)";
			this.anfasser[i].style.width = "10px";
			this.anfasser[i].style.height = "10px";
			this.anfasser[i].onmousedown = resizeinit; 
		}
		this.anfasser[0].style.left = linkerab - 5 + "px";
		this.anfasser[1].style.left = linkerab - 5 + "px";
		this.anfasser[2].style.left = linkerab - 5 + "px";
		this.anfasser[3].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
		this.anfasser[4].style.left = linkerab + (parseInt(bild.offsetWidth) - 10) / 2 + "px";
		this.anfasser[5].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
		this.anfasser[6].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
		this.anfasser[7].style.left = linkerab + parseInt(bild.offsetWidth) - 5 + "px";
		this.anfasser[0].style.top = obererab - 5 + "px";
		this.anfasser[1].style.top = (obererab - (parseInt(bild.offsetHeight)) / 2) - 15 + "px";
		this.anfasser[2].style.top = (obererab - parseInt(bild.offsetHeight) - 25) + "px";
		this.anfasser[3].style.top = obererab - 35 + "px";
		this.anfasser[4].style.top = obererab - parseInt(bild.offsetHeight) - 45 + "px";
		this.anfasser[5].style.top = obererab - 55 + "px"; 
		this.anfasser[6].style.top = obererab - (parseInt(bild.offsetHeight)) / 2 - 65 + "px";
		this.anfasser[7].style.top = obererab - parseInt(bild.offsetHeight) - 75 + "px";
		this.anfasser[0].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
		this.anfasser[1].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
		this.anfasser[2].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
		this.anfasser[3].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
		this.anfasser[4].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenmitte.gif)";
		this.anfasser[5].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenrechts.gif)";
		this.anfasser[6].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_linksmitte.gif)";
		this.anfasser[7].style.cursor = "url(http://graphic.co2-filter.com/seite/resizepfeil_untenlinks.gif)";
		for (i = 0; i < 8; i++) {
			bild.parentNode.appendChild(this.anfasser[i]);
		}
		}
	}
	
	function bilddeaktivieren (ereignis) {
		//alert(aktivesobjekt.id);
		if (aktivesobjekt != null) {
		ereignis = ereignis ? ereignis : window.event;
		if (deselekt == 1) {
			idname = "artikellayoutbildanfasser0" + aktivesobjekt.id;
			while (document.getElementById(idname) != null) {
				document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
			} 
			document.getElementById("artikelbefehlbildcontainer").parentNode.removeChild(document.getElementById("artikelbefehlbildcontainer"));
		}
		else {
			deselekt = 1;
			deselektbild = null;
		}
	}
	}
	
	function klicklokal (welches) {
		deselektbild = welches.id;
		deselekt = 0;
		bildaktivieren(welches); 
	}
	
	function bildeinstellungen (bild) {
		
		if (document.getElementById("artikelbefehlbildcontainer") == null) {
			if (typ[bild.id] == "bild") {
				this.bildbreite = document.createElement("input");
				this.bildbreite.name = "artikelbildbreite";
				this.bildbreite.className = "inputs";
				this.bildbreite.size = "5";
				this.bildbreite.style.cssFloat = "left";
				this.bildbreite.value = parseInt(bild.offsetWidth);
				this.bildbreite.style.marginRight = "7px";
				this.bildbreite.onkeyup = breitezuweisen;
				
				this.bildhöhe = document.createElement("input");
				this.bildhöhe.name = "artikelbildhöhe";
				this.bildhöhe.className = "inputs";
				this.bildhöhe.size = "5";
				this.bildhöhe.style.cssFloat = "left";
				this.bildhöhe.value = parseInt(bild.offsetHeight);
				this.bildhöhe.style.marginRight = "7px";
				this.bildhöhe.onkeyup = höhezuweisen;
				
				this.breitename = document.createElement("div");
				this.breitename.id = "artikelbildbreitebesch";
				this.breitename.style.cssFloat = "left";
				this.breitename.style.marginRight = "5px";
				this.breitename.innerHTML = "B:";
				this.breitename.style.paddingTop = "1px";
				
				this.höhename = document.createElement("div");
				this.höhename.id = "artikelbildhöhebesch";
				this.höhename.style.cssFloat = "left";
				this.höhename.style.marginRight = "5px";
				this.höhename.innerHTML = "H:";
				this.höhename.style.paddingTop = "1px";
				
				this.bildproportionname = document.createElement("div");
				this.bildproportionname.id = "artikelbildproportionbesch";
				this.bildproportionname.style.cssFloat = "left";
				this.bildproportionname.style.marginRight = "5px";
				this.bildproportionname.innerHTML = "Propartion beibehalten:";
				this.bildproportionname.style.paddingTop = "1px";
				
				this.bildproportion = document.createElement("input");
				this.bildproportion.name = "artikelbildproportion";
				this.bildproportion.className = "inputs";
				this.bildproportion.type = "checkbox";
				this.bildproportion.style.cssFloat = "left";
				this.bildproportion.style.marginRight = "7px";
				this.bildproportion.style.paddingTop = "1px";
				this.bildproportion.onclick = function () { proportionspeichern(bild.id);};
				this.bildproportion.checked = proportion[bild.id] == "undefined" ? false : proportion[bild.id];
				
				this.trennelement1 = document.createElement("div");
				this.trennelement1.className = "befehlsleistetrenner";
				
				this.deckkraftinput = document.createElement("input");
				this.deckkraftinput.name = "artikelbilddeckkraft";
				this.deckkraftinput.size = "5";
				this.deckkraftinput.className = "inputs";
				this.deckkraftinput.style.cssFloat = "left";
				this.deckkraftinput.value = parseFloat(bild.style.opacity) * 100 + "%";
				this.deckkraftinput.style.marginRight = "7px";
				this.deckkraftinput.onkeyup = deckkraftzuweisen;
				
				this.deckkraft = document.createElement("div");
				this.deckkraft.id = "artikelbilddeckkraftbesch";
				this.deckkraft.style.cssFloat = "left";
				this.deckkraft.style.marginRight = "5px";
				this.deckkraft.innerHTML = "Deckkraft:";
				this.deckkraft.style.paddingTop = "1px"; 
				
				this.schattenwurfcheck = document.createElement("input");
				this.schattenwurfcheck.name = "artikelbildschatten";
				this.schattenwurfcheck.className = "inputs";
				this.schattenwurfcheck.type = "checkbox";
				this.schattenwurfcheck.style.cssFloat = "left";
				this.schattenwurfcheck.style.marginRight = "7px";
				this.schattenwurfcheck.style.paddingTop = "1px";
				this.schattenwurfcheck.onclick = function () { addshadow(bild.id); };
				this.schattenwurfcheck.checked = schatten[bild.id] == "undefined" ? false : schatten[bild.id];
				
				this.schattenwurf = document.createElement("div");
				this.schattenwurf.id = "artikelbildschattenwurfbesch";
				this.schattenwurf.style.cssFloat = "left";
				this.schattenwurf.style.marginRight = "5px";
				this.schattenwurf.innerHTML = "Schattenwurf:";
				this.schattenwurf.style.paddingTop = "1px";
				
				this.trennelement2 = document.createElement("div");
				this.trennelement2.className = "befehlsleistetrenner";
				
				this.ausrichtunglinks = document.createElement("img");
				this.ausrichtunglinks.src = "http://graphic.co2-filter.com/seite/befehl_linksbuendig_passiv.png";
				this.ausrichtunglinks.style.cssFloat = "left";
				this.ausrichtunglinks.style.border = "0px";
				this.ausrichtunglinks.style.marginRight = "5px";
				
				this.ausrichtungmitte = document.createElement("img");
				this.ausrichtungmitte.src = "http://graphic.co2-filter.com/seite/befehl_mittig_passiv.png";
				this.ausrichtungmitte.style.cssFloat = "left";
				this.ausrichtungmitte.style.border = "0px";
				this.ausrichtungmitte.style.marginRight = "5px";
				
				this.ausrichtungrechts = document.createElement("img");
				this.ausrichtungrechts.src = "http://graphic.co2-filter.com/seite/befehl_rechtsbuendig_passiv.png";
				this.ausrichtungrechts.style.cssFloat = "left";
				this.ausrichtungrechts.style.border = "0px";
				this.ausrichtungrechts.style.marginRight = "5px";
				
				this.umbruch = document.createElement("br");
				this.umbruch.style.clear = "both";
				
				this.befehlcontainer = document.createElement("div");
				this.befehlcontainer.id = "artikelbefehlbildcontainer";
				
				this.befehlcontainer.appendChild(this.breitename);
				this.befehlcontainer.appendChild(this.bildbreite);
				this.befehlcontainer.appendChild(this.höhename);
				this.befehlcontainer.appendChild(this.bildhöhe);
				this.befehlcontainer.appendChild(this.bildproportionname);
				this.befehlcontainer.appendChild(this.bildproportion);
				this.befehlcontainer.appendChild(this.trennelement1);
				this.befehlcontainer.appendChild(this.deckkraft);
				this.befehlcontainer.appendChild(this.deckkraftinput);
				this.befehlcontainer.appendChild(this.schattenwurf);
				this.befehlcontainer.appendChild(this.schattenwurfcheck); 
				this.befehlcontainer.appendChild(this.trennelement2);
				this.befehlcontainer.appendChild(this.ausrichtunglinks);
				this.befehlcontainer.appendChild(this.ausrichtungmitte);
				this.befehlcontainer.appendChild(this.ausrichtungrechts);
				this.befehlcontainer.appendChild(this.umbruch);
				this.befehlsleiste.appendChild(this.befehlcontainer);
			}
			else if (typ[bild.id] == "youtube") {
				this.abmessungenname = document.createElement("div");
				this.abmessungenname.id = "artikelyoutubeabmessungbesch";
				this.abmessungenname.style.cssFloat = "left";
				this.abmessungenname.style.marginRight = "5px";
				this.abmessungenname.innerHTML = "Größe:";
				this.abmessungenname.style.paddingTop = "3px";
				
				this.abmessungeninput = document.createElement("select");
				this.abmessungeninput.id = "artikelmedienyoutubeabmessselect";
				this.abmessungeninput.name = "artikelmedienyoutubeabmessselect";
				this.abmessungeninput.style.cssFloat = "left";
				//this.abmessungeninput.onchange = function () { youtubeabmessungzuweisen(); };
				
				this.playerelemente = document.createElement("div");
				this.playerelemente.id = "artikelmedienplayerelemente";
				this.playerelemente.style.paddingTop = "3px";
				
				this.playerelementeplay = document.createElement("img");
				this.playerelementeplay.id = "artikelmedienyoutubeplaypause";
				this.playerelementeplay.src = "http://graphic.co2-filter.com/seite/playbutton.png";
				this.playerelementeplay.style.cssFloat = "left";
				this.playerelementeplay.onclick = function () { changepausetoplay(); };
				
				this.playerelementestatus = document.createElement("img");
				this.playerelementestatus.src = "http://graphic.co2-filter.com/seite/youtubestatus.png";
				this.playerelementestatus.style.cssFloat = "left";
				this.playerelementestatus.style.marginTop = "2px";
				this.playerelementestatus.style.marginBottom = "2px";
				this.playerelementestatus.style.marginLeft = "5px";
				this.playerelementestatus.style.marginRight = "5px";
				
				this.playerelementelautstärke = document.createElement("img");
				this.playerelementelautstärke.src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
				this.playerelementelautstärke.id = "artikelmedienyoutubelautstarke";
				this.playerelementelautstärke.onclick = function () { changevolumetomute(); };
				
				this.rahmencheck = document.createElement("input");
				this.rahmencheck.name = "artikelyoutuberahmen";
				this.rahmencheck.className = "inputs";
				this.rahmencheck.type = "checkbox";
				this.rahmencheck.style.cssFloat = "left";
				this.rahmencheck.style.marginRight = "7px";
				this.rahmencheck.style.paddingTop = "1px";
				
				this.rahmen = document.createElement("div");
				this.rahmen.id = "artikelyoutuberahmenbesch";
				this.rahmen.style.cssFloat = "left";
				this.rahmen.style.marginRight = "5px";
				this.rahmen.innerHTML = "Rahmen:";
				this.rahmen.style.paddingTop = "1px";
				
				this.ähnlichcheck = document.createElement("input");
				this.ähnlichcheck.name = "artikelyoutubeahnlich";
				this.ähnlichcheck.className = "inputs";
				this.ähnlichcheck.type = "checkbox";
				this.ähnlichcheck.style.cssFloat = "left";
				this.ähnlichcheck.style.marginRight = "7px";
				this.ähnlichcheck.style.paddingTop = "1px";
				
				this.ähnlich = document.createElement("div");
				this.ähnlich.id = "artikelyoutubeahnlichbesch";
				this.ähnlich.style.cssFloat = "left";
				this.ähnlich.style.marginRight = "5px";
				this.ähnlich.innerHTML = "Ähnliche Videos:";
				this.ähnlich.style.paddingTop = "1px";
				
				this.umbruch = document.createElement("br");
				this.umbruch.style.clear = "both";
				
				this.trennelement1 = document.createElement("div");
				this.trennelement1.className = "befehlsleistetrenner";
				
				this.trennelement2 = document.createElement("div");
				this.trennelement2.className = "befehlsleistetrenner";
				
				this.befehlcontainer = document.createElement("div");
				this.befehlcontainer.id = "artikelbefehlbildcontainer";
				
				this.befehlcontainer.appendChild(this.abmessungenname);
				this.befehlcontainer.appendChild(this.abmessungeninput);
				this.playerelemente.appendChild(this.playerelementeplay);
				this.playerelemente.appendChild(this.playerelementestatus);
				this.playerelemente.appendChild(this.playerelementelautstärke);
				this.playerelemente.appendChild(this.umbruch);
				this.befehlcontainer.appendChild(this.trennelement1);
				this.befehlcontainer.appendChild(this.rahmen);
				this.befehlcontainer.appendChild(this.rahmencheck);
				this.befehlcontainer.appendChild(this.ähnlich);
				this.befehlcontainer.appendChild(this.ähnlichcheck);
				this.befehlcontainer.appendChild(this.trennelement2);
				this.befehlcontainer.appendChild(this.playerelemente);
				this.befehlsleiste.appendChild(this.befehlcontainer); 
				
				function changeplaystatustopause () {
					youtubeplayer[bild.id].pauseVideo();
					document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/playbutton.png";
					document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changepausetoplay(); };
				}
				
				function changepausetoplay () {
					youtubeplayer[bild.id].playVideo();
					document.getElementById("artikelmedienyoutubeplaypause").src = "http://graphic.co2-filter.com/seite/pausebutton.png";
					document.getElementById("artikelmedienyoutubeplaypause").onclick = function () { changeplaystatustopause(); };
				}
				
				function changevolumetomute () {
					youtubeplayer[bild.id].mute();
					document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecheraus.png";
					document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changemutetovolume(); };
				}
				
				function changemutetovolume () {
					youtubeplayer[bild.id].unMute();
					document.getElementById("artikelmedienyoutubelautstarke").src = "http://graphic.co2-filter.com/seite/lautsprecher.png";
					document.getElementById("artikelmedienyoutubelautstarke").onclick = function () { changevolumetomute(); };
				}
			}
		}
		
		else {
			if (typ[bild.id] == "bild") {
			this.bildbreite.value = parseInt(bild.offsetWidth);
			this.bildhöhe.value = parseInt(bild.offsetHeight);
			this.bildproportion.checked = proportion[bild] == null ? false : proportion[bild];
			}
		}
	}
	
	function breitezuweisen (ereignis) {
		ereignis = ereignis ? ereignis : window.event;
		if (ereignis.which) {
			if (ereignis.which == 13) {
				if (document.getElementsByName("artikelbildproportion")[0].checked == true) {
					aktivesobjekt.style.height = (parseInt(aktivesobjekt.offsetHeight) * parseInt(document.getElementsByName("artikelbildbreite")[0].value)) / parseInt(aktivesobjekt.offsetWidth) + "px";
					aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
				}
				else {
					aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
					aktivesobjekt.style.height = parseInt(document.getElementsByName("artikelbildhöhe")[0].value) + "px";
				}
				bilddeaktivieren();
				bildaktivieren(aktivesobjekt);
			}
		}
		else if (ereignis.keyCode) {
			if (ereignis.keyCode == 13) {
				if (document.getElementsByName("artikelbildproportion")[0].checked == true) {
					aktivesobjekt.style.height = (parseInt(aktivesobjekt.offsetHeight) * parseInt(document.getElementsByName("artikelbildbreite")[0].value)) / parseInt(aktivesobjekt.offsetWidth) + "px";
					aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
				}
				else {
					aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
					aktivesobjekt.style.height = parseInt(document.getElementsByName("artikelbildhöhe")[0].value) + "px";
				}
				bilddeaktivieren();
				bildaktivieren(aktivesobjekt);
			}
		}
	}
	
	function höhezuweisen (ereignis) {
		ereignis = ereignis ? ereignis : window.event;
		if (ereignis.which) {
			if (ereignis.which == 13) {
				if (document.getElementsByName("artikelbildproportion")[0].checked == true) {
					aktivesobjekt.style.width = (parseInt(aktivesobjekt.offsetWidth) * parseInt(document.getElementsByName("artikelbildhöhe")[0].value)) / parseInt(aktivesobjekt.offsetHeight) + "px";
					aktivesobjekt.style.height = parseInt(document.getElementsByName("artikelbildhöhe")[0].value) + "px";
				}
				else {
					aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
					aktivesobjekt.style.height = parseInt(document.getElementsByName("artikelbildhöhe")[0].value) + "px";
				}
				bilddeaktivieren();
				bildaktivieren(aktivesobjekt);
			}
		}
		else if (ereignis.keyCode) {
			if (ereignis.keyCode == 13) {
				aktivesobjekt.style.height = parseInt(document.getElementsByName("artikelbildhöhe")[0].value) + "px";
				aktivesobjekt.style.width = parseInt(document.getElementsByName("artikelbildbreite")[0].value) + "px";
				bilddeaktivieren();
				bildaktivierwn(aktivesobjekt);
			}
		}
	}
	
	function deckkraftzuweisen (ereignis) {
		ereignis = ereignis ? ereignis : window.event;
		if (ereignis.which) {
			if (ereignis.which == 13) {
				aktivesobjekt.style.opacity = parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) / 100;
				if (aktivesobjekt.style.filter != "undefined") {
					aktivesobjekt.style.filter = "alpha(opacity=" + parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) + ")";
				}
				document.getElementsByName("artikelbilddeckkraft")[0].value = parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) + "%";
				document.getElementsByName("artikelbilddeckkraft")[0].blur();
			}
		}
		else if (ereignis.keyCode) {
			if (ereignis.keyCode == 13) {
				aktivesobjekt.style.opacity = parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) / 100;
				if (aktivesobjekt.style.filter != "undefined") {
					aktivesobjekt.style.filter = "alpha(opacity=" + parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) + ")";
				}
				document.getElementsByName("artikelbilddeckkraft")[0].value = parseInt(document.getElementsByName("artikelbilddeckkraft")[0].value) + "%";
			}
		}
	}
	
	function proportionspeichern (bild) {
		if (proportion[bild] == false || proportion[bild] == null) {
			proportion[bild] = true;
		}
		else {
			proportion[bild] = false;
		}
	}
	
	function addshadow (bild) {
		if (schatten[bild] == false || schatten[bild] == null) {
			schatten[bild] = true;
			document.getElementById(bild).className = "dbflexxshadow";
		}
		else {
			schatten[bild] = false;
			document.getElementById(bild).className = "dbflexxnoneshadow";
		}
	}
		
	document.getElementById("artikellayoutmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_aktiv.png)";
	document.getElementById("artikeltextmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_passiv.png)";
	document.getElementById("artikelhinzufügenmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_aktiv.png)";
	//Variablen für Drag&Drop
	dragobject = null;
	dragx = 0;
	dragy = 0;
	posx = 0;
	posy = 0;
	marginx = 0;
	marginy = 0;
	altesmarginx = 0;
	altesmarginy = 0;
	//Variable für D&D und Resize
	display = 0;
	//Selektionsvariable
	aktivesobjekt = null;
	deselekt = 1;
	deselektbild = null;
	//Variablen für Resize
	resizeobject = null;
	resizex = 0;
	resizey = 0;
	reposx = 0;
	reposy = 0;
	neuertop = 0;
	neuerleft = 0;
	modus = null;
	faktor = new Array();
	
	
	//Einrastvariablen
	
	gesamtebreite = parseInt(document.getElementById("artikelplus").offsetWidth);
	
	function resize (ereignis) {
		if (display == 0) {
			idname = "artikellayoutbildanfasser0" + resizeobject.id;
			while (document.getElementById(idname) != null) {
				document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
			}
			display = 1;
		}
		ereignis = ereignis ? ereignis : window.event;
		if (modus != null) {
			reposx = ereignis.clientX;
			reposy = ereignis.clientY;
			neuertop = parseInt(resizeobject.style.top);
			neuerleft = parseInt(resizeobject.style.left);
			if (document.getElementsByName("artikelbildproportion")[0].checked == false) {
			switch (parseInt(modus)) {
				case 3: 
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) + (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 6:
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) + (reposx - resizex) + "px";
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 4: 
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) - (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) + "px";
					resizeobject.style.top = neuertop + (reposy - resizey) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 1:
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) - (reposx - resizex) + "px";
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) + "px";
					resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 5:
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) + (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) + (reposx - resizex) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 0:
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) + (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) - (reposx - resizex) + "px";
					resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 2:
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) - (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) - (reposx - resizex) + "px";
					resizeobject.style.top = neuertop + (reposy - resizey) + "px";
					resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
					
				case 7:
					resizeobject.style.height = parseInt(resizeobject.offsetHeight) - (reposy - resizey) + "px";
					resizeobject.style.width = parseInt(resizeobject.offsetWidth) + (reposx - resizex) + "px";
					resizeobject.style.top = neuertop + (reposy - resizey) + "px";
					faktor[resizeobject.id] = parseInt(resizeobject.offsetHeight) / parseInt(resizeobject.offsetWidth);
					break;
			}
			}
			else {
				switch (parseInt(modus)) { 
					case 3: 
						resizeobject.style.height = parseInt(resizeobject.offsetHeight) + (reposy - resizey) + "px";
						resizeobject.style.width = Math.pow(faktor[resizeobject.id],-1) * parseInt(resizeobject.offsetHeight) + "px";
						break;
						
					case 6:
						resizeobject.style.width = parseInt(resizeobject.offsetWidth) + (reposx - resizex) + "px";
						resizeobject.style.height = faktor[resizeobject.id] * parseInt(resizeobject.offsetWidth) + "px";
						break;
						
					case 4: 
						resizeobject.style.height = parseInt(resizeobject.offsetHeight) - (reposy - resizey) + "px";
						resizeobject.style.width = Math.pow(faktor[resizeobject.id],-1) * parseInt(resizeobject.offsetHeight) + "px";
						resizeobject.style.top = neuertop + (reposy - resizey) + "px";
						break;
						
					case 1:
						resizeobject.style.width = parseInt(resizeobject.offsetWidth) - (reposx - resizex) + "px";
						resizeobject.style.height = faktor[resizeobject.id] * parseInt(resizeobject.offsetWidth) + "px";
						resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
						break;
						
					case 5:
						zwischenhöhe = (reposy - resizey);
						zwischenbreite = (reposx - resizex);
						if (Math.abs(zwischenbreite) >= Math.abs(zwischenhöhe)) {
							resizeobject.style.width = zwischenbreite + parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.height = faktor[resizeobject.id] * parseInt(resizeobject.offsetWidth) + "px";
						}
						else {
							resizeobject.style.height = zwischenhöhe + parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.width = Math.pow(faktor[resizeobject.id],-1) * parseInt(resizeobject.offsetHeight) + "px";
						}
						break;
						
					case 0:
						zwischenhöhe = (reposy - resizey);
						zwischenbreite = (reposx - resizex);
						if (Math.abs(zwischenbreite) >= Math.abs(zwischenhöhe)) {
							resizeobject.style.width = zwischenbreite - parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.height = faktor[resizeobject.id] * parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
						}
						else {
							resizeobject.style.height = zwischenhöhe + parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.width = Math.pow(faktor[resizeobject.id],-1) * parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
						}
						break;
						
					case 2:
						zwischenhöhe = (reposy - resizey);
						zwischenbreite = (reposx - resizex);
						if (Math.abs(zwischenbreite) >= Math.abs(zwischenhöhe)) {
							resizeobject.style.width = zwischenbreite - parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.height = faktor[resizeobject.id] * parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.top = neuertop + (reposy - resizey) + "px";
							resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
						}
						else {
							resizeobject.style.height = zwischenhöhe - parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.width = Math.pow(faktor[resizeobject.id],-1) * parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.top = neuertop + (reposy - resizey) + "px";
							resizeobject.style.left = neuerleft + (reposx - resizex) + "px";
						}
						break;
						
					case 7:
						zwischenhöhe = (reposy - resizey);
						zwischenbreite = (reposx - resizex);
						if (Math.abs(zwischenbreite) >= Math.abs(zwischenhöhe)) {
							resizeobject.style.width = zwischenbreite + parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.height = faktor * parseInt(resizeobject.offsetWidth) + "px";
							resizeobject.style.top = neuertop + (reposy - resizey) + "px";
						}
						else {
							resizeobject.style.height = zwischenhöhe - parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.width = Math.pow(faktor,-1) * parseInt(resizeobject.offsetHeight) + "px";
							resizeobject.style.top = neuertop + (reposy - resizey) + "px";
						}
						break;
				}
			}
			resizex = ereignis.clientX;
			resizey = ereignis.clientY;
		}
		return false;
	}
	
	function resizeinit (ereignis) {
		ereignis = ereignis ? ereignis : window.event;
		resizeobject = this.parentNode.firstChild;
		if (typ[resizeobject.id] == "bild") {
			modus = this.id.substr(25,1);
			resizex = ereignis.clientX;
			resizey = ereignis.clientY;
			neuerleft = parseInt(resizeobject.style.left);
			neuertop = parseInt(resizeobject.style.top);
			document.onmousemove = resize;
			document.onmouseup = resizestop;
			return false;
		}
		else
			return false;
	}
	
	function resizestop () {
		neuerleft = parseInt(resizeobject.style.left);
		neuertop = parseInt(resizeobject.style.top);
		display = 0;
		bildaktivieren(resizeobject.parentNode.firstChild);
		document.onmousemove = null;
		document.onmouseup = null;
		resizeobject = null;
	}
	
	function drag (ereignis) {
		if (display == 0) {
			idname = "artikellayoutbildanfasser0" + dragobject.id;
			while (document.getElementById(idname) != null) {
				document.getElementById(idname).parentNode.removeChild(document.getElementById(idname).parentNode.lastChild);
			}
			display = 1;
		}
		ereignis = ereignis ? ereignis : window.event; 
		posx = ereignis.clientX;
		posy = ereignis.clientY;
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		if (altesmarginx < 15) {
			dragobject.style.left = "0px";
			altesmarginx = altesmarginx + (posx - dragx); 
		}
		
		else if (altesmarginx > (gesamtebreite - 15 - dragobject.offsetWidth)) {
			dragobject.style.left = gesamtebreite - dragobject.offsetWidth + "px";
			altesmarginx = altesmarginx + (posx - dragx);
		}
		
		else if (altesmarginx > (gesamtebreite - dragobject.offsetWidth) / 2 - 8 && altesmarginx < (gesamtebreite - dragobject.offsetWidth) / 2 + 8) { 
			dragobject.style.left = (gesamtebreite - dragobject.offsetWidth) / 2 + "px";
			altesmarginx = altesmarginx + (posx - dragx);
		}
		
		else {
			dragobject.style.left = altesmarginx + (posx - dragx) + "px";
			altesmarginx = parseInt(dragobject.style.left);
		}
		dragobject.style.top = marginy + (posy - dragy) + "px";
		dragx = ereignis.clientX;
		dragy = ereignis.clientY;
		return false;
		
	}
	
	function dragstop () {
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		display = 0;
		bildaktivieren(dragobject);
		document.onmousemove = null;
		dragobject.onmouseup = null;
		dragobject = null;
	}
	
	
	function dragstartinit (ereignis) {
		//createTextfluss();
		ereignis = ereignis ? ereignis : window.event;
		dragobject = this;
		dragx = ereignis.clientX;
		dragy = ereignis.clientY;
		marginx = parseInt(dragobject.style.left);
		marginy = parseInt(dragobject.style.top);
		altesmarginx = parseInt(dragobject.style.left);
		altesmarginy = parseInt(dragobject.style.top);
		document.onmousemove = drag;
		dragobject.onmouseup = dragstop;
		return false;
	}
	
	
	function createTextfluss () {
		//console.profile("spans");
		var oldText2 = document.getElementById("artikellayoutinhalt");
		function findChildNodes (oldText,z) {
			for (i = 0; i < oldText.childNodes.length; i++) {
				if (oldText.childNodes[i].nodeType == 3) {
					var cache = oldText.childNodes[i].data;
					oldText.removeChild(oldText.childNodes[i]);
					for (j = 0; j < cache.split(" ").length; j++) {
						var newText = document.createElement("span");
						newText.innerHTML = cache.split(" ")[j] + " ";
						oldText.appendChild(newText);
					}
				}
				else if (oldText.childNodes[i].nodeType == 1 && oldText.childNodes[i].tagName.toLowerCase() != "span") {
					alert("knoteninhalt" + oldText.childNodes[i].innerHTML + ", i: " + i);
					i = findChildNodes(oldText.childNodes[i],i);
				}
				else {
					alert("knoteninhalt" + oldText.childNodes[i].nodeType + ", tagName: " + oldText.childNodes[i].tagName + ", i: " + i);
				}
			}
			return z;
		}
		findChildNodes(oldText2,0);
		//console.profileEnd("spans");
	}
	
	
	
	document.getElementById("textdiv").style.display = "none";
	
	neuertext = document.getElementsByName("artikelplustext")[0].value;
	neuertext = neuertext.replace(/\[b\](.*?)\[\/b\]/ig, "<strong>$1</strong>");
	neuertext = neuertext.replace(/\[i\](.*?)\[\/i\]/ig, "<em>$1</em>");
	neuertext = neuertext.replace(/\[u\](.*?)\[\/u\]/ig, "<u>$1</u>");
	neuertext = neuertext.replace(/\[sub\](.*?)\[\/sub\]/ig, "<sub>$1</sub>");
	neuertext = neuertext.replace(/\[sup\](.*?)\[\/sup\]/ig, "<sup>$1</sup>");
	neuertext = neuertext.replace(/\[h1\](.*?)\[\/h1\]/ig, "<h1>$1</h1>");
	neuertext = neuertext.replace(/\[h2\](.*?)\[\/h2\]/ig, "<h2>$1</h2>");
	neuertext = neuertext.replace(/\[url=([^ ]+).*\](.*)\[\/url\]/ig, "<a href='$1'>$2</a>");
	neuertext = neuertext.replace(/\[color=([A-Fa-f0-9]{6}?).*\](.*?)\[\/color\]/ig, "<span style='color:#$1;'>$2</span>");
	
	
	this.artikellayoutdiv = document.createElement("div");
	this.artikellayoutdiv.id = "artikellayoutdiv";
	this.artikellayoutdiv.style.fontFamily = "Calibri, Georgia, 'Myriad Pro', sans-serif";
	
	this.uberschrift = document.createElement("h1");
	this.uberschrift.innerHTML = document.getElementsByName("uberschrift")[0].value;
	
	this.leiste = document.createElement("p");
	this.leiste.style.fontStyle = "italic";
	this.leiste.style.textAlign = "right";
	this.leiste.innerHTML = document.getElementsByName("autor")[0].value;
	this.leiste.style.marginBottom = "16px";
	
	this.artikelinhalt = document.createElement("p");
	this.artikelinhalt.id = "artikellayoutinhalt";
	this.artikelinhalt.innerHTML = neuertext;
	
	this.bilderdiv = document.createElement("div");
	this.bilderdiv.id = "artikelbilderdivcontainer";
	
	this.youtubeviddiv = document.createElement("div");
	this.youtubeviddiv.id = "artikelyoutubedivcontainer";
	
	this.artikellayoutcontainer = document.createElement("div");
	this.artikellayoutcontainer.id = "artikellayoutcontainer";
	
	this.umbruchdb = document.createElement("br");
	this.umbruchdb.style.clear = "both";
	
	this.submitbutton = document.createElement("button");
	if (yourrights.getElementsByTagName("article")[0].getElementsByTagName("owncategory")[0].getElementsByTagName("publish")[0].firstChild.data != 1) {
		this.submitbutton.innerHTML = "Als Entwurf speichern";
		this.submitbutton.onclick = nonepublisharticle;
	}
	else {
		this.submitbutton.innerHTML = "Veröffentlichen";
		this.submitbutton.onclick = publisharticle;
	}
	
	function publisharticle () {
		alert("veröffentlichn");
	}
	
	function nonepublisharticle () {
		alert("speichern");
	}
		
	
	this.artikellayoutcontainer.appendChild(this.befehlsleiste);
	this.artikellayoutdiv.appendChild(this.uberschrift);
	this.artikellayoutdiv.appendChild(this.artikelinhalt);
	this.artikellayoutdiv.appendChild(this.bilderdiv);
	this.artikellayoutdiv.appendChild(this.youtubeviddiv);
	this.artikellayoutdiv.appendChild(this.leiste);
	this.artikellayoutdiv.appendChild(this.umbruchdb);
	this.artikellayoutdiv.appendChild(this.submitbutton);
	this.artikellayoutcontainer.appendChild(this.artikellayoutdiv);
	document.getElementById("artikelplus").insertBefore(this.artikellayoutcontainer,document.getElementById("dbflexxstatuscontainer"));
	document.getElementById("artikellayoutdiv").onclick = bilddeaktivieren;
	
	//Bilder in Artikel!!
	this.bilder = new Array();
	this.bilderdiv2 = new Array();
	this.bildschatten = new Array();
	j = 0;
	for (i = 0; i < (bilderinartikel.length / 2); i++) {
		id = "artikelgrafik" + bilderinartikel[j];
		bilderhöhe = typeof(height[id]) != "undefined" ? height[id] + "px" : parseInt(bilderinartikel[j + 1]) * 400 / 120 + "px";
		this.bilder[i] = document.createElement("img");
		this.bilder[i].id = "artikelgrafik" + bilderinartikel[j];
		this.bilder[i].src = "http://graphics.dievierte-gewalt.de/editablethumbs/" + bilderinartikel[j];
		this.bilder[i].marginTop = "10px";
		this.bilder[i].style.position = "relative";
		this.bilder[i].style.top = typeof(margintop[id]) != "undefined" ? margintop[id] + "px" : "0px";
		this.bilder[i].style.left = typeof(marginleft[id]) != "undefined" ? marginleft[id] + "px" : "0px";
		this.bilder[i].style.opacity = typeof(deckkraft[id]) != "undefined" ? deckkraft[id] : 1;
		this.bilder[i].style.width = typeof(width[id]) != "undefined" ? width[id] + "px" : "400px";
		this.bilder[i].style.height = bilderhöhe;
		//this.bilder[i].style.filter = typeof(deckkraft) != "undefined" ? "alpha(opacity" + deckkraft[id] * 100 + ")" : "alpha(opacity=100)";
		this.bilder[i].onmousedown = dragstartinit;
		this.bilder[i].onclick = function () { klicklokal(this); };
		typ[id] = "bild";
		this.bilderdiv2[i] = document.createElement("div");
		this.bilderdiv2[i].style.minHeight = parseInt(bilderinartikel[j + 1]) * 400 / 120 + "px";
		this.bilderdiv2[i].style.height = bilderhöhe;
		faktor[id] = parseInt(bilderinartikel[j + 1]) / 120;
		this.bilderdiv2[i].appendChild(this.bilder[i]);
		this.bilderdiv.appendChild(this.bilderdiv2[i]);
		if (schatten[id] == true) {
			schatten[id] = false;
			addshadow(id);
		}
		j = j + 2;
	}
	
	//Youtube in Artikel
	
	this.youtubevid = new Array();
	this.youtubeparam = new Array();
	this.youtubeflash = new Array();
	this.youtubeviddiv2 = new Array();

	for (i = 0; i < document.getElementsByName("artikelmedienyoutubeurl").length; i++) {
		if (document.getElementsByName("artikelmedienyoutubeurl")[i].value != "") {
			id = "artikelyoutube" + document.getElementsByName("artikelmedienyoutubeurl")[i].name;
			urlyoutube[i] = document.getElementsByName("artikelmedienyoutubeurl")[i].value;
			urlyoutube[i] = urlyoutube[i].replace(/watch\?v\=/,"v/") + "&hl=de&fs=1";
			youtubehöhe = typeof(height[id]) != "undefined" ? height[id] + "px" : "270px";
			youtubebreite = typeof(width[id]) != "undefined" ? width[id] + "px" : "480px";
			this.youtubeviddiv2[i] = document.createElement("div");
			this.youtubeviddiv2[i].style.height = youtubehöhe;
			this.youtubeviddiv2[i].id = id;
			this.youtubeviddiv2[i].style.position = "relative";
			this.youtubeviddiv2[i].style.left = typeof(marginleft[id]) != "undefined" ? marginleft[id] + "px" : "0px";
			this.youtubeviddiv2[i].style.top = typeof(margintop[id]) != "undefined" ? margintop[id] + "px" : "0px";
			/*this.youtubeflash[i] = document.createElement("div");
			this.youtubeflash[i].style.position = "relative";
			this.youtubeflash[i].style.width = youtubebreite;
			this.youtubeflash[i].style.height = youtubehöhe;
			this.youtubeflash[i].style.top = typeof(margintop[id]) != "undefined" ? margintop[id] + "px" : "0px";
			this.youtubeflash[i].style.left = typeof(marginleft[id]) != "undefined" ? marginleft[id] + "px" : "0px";
			this.youtubeflash[i].onclick = function () { alert("es geht"); };
			this.youtubeflash[i].appendChild(this.youtubeviddiv2[i]);*/
			this.youtubeviddiv.appendChild(this.youtubeviddiv2[i]);
			typ[id] = "youtube";
			
			/*this.youtubevid[i] = document.createElement("object");
			this.youtubevid[i].width = typeof(width[id]) != "undefined" ? width[id] : "480";
			this.youtubevid[i].height = typeof(height[id]) != "undefined" ? height[id] : "295";
			this.youtubevid[i].type = "application/x-shockwave-flash";
			this.youtubevid[i].data = "http://www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=ytplayer";
			this.youtubevid[i].id = id;
			this.youtubevid[i].style.position = "relative";
			this.youtubevid[i].style.left = typeof(marginleft[id]) != "undefined" ? marginleft[id] + "px" : "0px";
			this.youtubevid[i].style.top = typeof(margintop[id]) != "undefined" ? margintop[id] + "px" : "0px";
			typ[id] = "youtube";
			this.youtubevid[i].onmousedown = dragstartinit;
			this.youtubevid[i].onclick = function () { klicklokal(this); };
			this.youtubeparam[i] = document.createElement("param");
			this.youtubeparam[i].name = "allowscriptaccess";
			this.youtubeparam[i].value = "always";
			this.youtubeviddiv2[i] = document.createElement("div");
			this.youtubeviddiv2[i].style.height = youtubehöhe;
			this.youtubevid[i].appendChild(this.youtubeparam[i]);
			this.youtubeviddiv2[i].appendChild(this.youtubevid[i]);
			this.youtubeviddiv.appendChild(this.youtubeviddiv2[i]);
			function onYouTubePlayerReady(playerId) {
				youtubeplayer = document.getElementById(id);
			}*/
			//youtubeplayer.loadVideoById(url,0);
		}
		
	}
		
	
	
	for (i = 0; i < document.getElementsByName("artikelmedienyoutubeurl").length; i++) {
		if (document.getElementsByName("artikelmedienyoutubeurl")[i].value != "") {
			id = "artikelyoutube" + document.getElementsByName("artikelmedienyoutubeurl")[i].name;		
			var params = { allowScriptAccess: "always" };
			//var atts = { id: "artikelmedienyoutubeplayer" + i };
			swfobject.embedSWF("http://co2-filter.com/de/alpha/skripte/youtubeplayer.swf", id, "480", "270", "8", null, null, params, null); 
			
			document.getElementById(id).style.position = "relative";
			document.getElementById(id).style.left = typeof(marginleft[id]) != "undefined" ? marginleft[id] + "px" : "0px";
			document.getElementById(id).style.top = typeof(margintop[id]) != "undefined" ? margintop[id] + "px" : "0px";
			document.getElementById("dbflexxloader").style.visibility = "visible";
			document.getElementById("dbflexxstatusleiste").innerHTML = "Lade Youtube-Player ...";
			//alert(getMovieName(id));
			//getMovieName(id).sendURLToFlash();
			//document.getElementById(id).onmousedown = dragstartinit;
			//document.getElementById(id).onclick = function () { klicklokal(this); };
			//alert(document.getElementById(id).onclick); 
		}
		
	}
	
	
}
		
function showpics () {
	stoploader();
	document.getElementById("artikelmedienunterescontainer").style.display = "block";
	document.getElementById("artikelmedienyoutubecontainer").style.display = "none";
	this.medienleistetab[0].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_aktiv.png)";
	this.medienleistetab[3].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_passiv.png)";
	this.medienleistetab[3].onclick = function () { youtubeeinf(); };
	this.medienleistetab[0].onclick = function () { };
}
		
function youtubeeinf () {
	document.getElementById("artikelmedienunterescontainer").style.display = "none";
	this.medienleistetab[3].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_aktiv.png)";
	this.medienleistetab[0].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_passiv.png)";
	this.medienleistetab[0].onclick = function () { showpics(); };
	this.medienleistetab[3].onclick = function () { };
	if (document.getElementById("artikelmedienyoutubecontainer") != null) {
		document.getElementById("artikelmedienyoutubecontainer").style.display = "block";
	}
	else {
		this.youtubeurlcontainer = document.createElement("div");
		this.youtubeurlcontainer.id = "artikelmedienyoutubecontainer";
		this.youtubeurlcontainer.style.padding = "10px";
		this.youtubeurlcontainer.style.background = "#595959";
		
		this.youtubename = document.createElement("div");
		this.youtubename.id = "artikelmedienyoutubename";
		this.youtubename.style.fontSize = "12px";
		this.youtubename.style.color = "#C2C2C2";
		this.youtubename.style.cssFloat = "left";
		this.youtubename.innerHTML = "URL:";
		this.youtubename.style.width = "10%"; 
		
		this.youtubeurldiv = document.createElement("div");
		this.youtubeurldiv.id = "artikelmedienyoutubeinputcontainer";
		this.youtubeurldiv.style.cssFloat = "left";
		this.youtubeurldiv.style.width = "90%";
		
		this.youtubeurl = document.createElement("input");
		this.youtubeurl.name = "artikelmedienyoutubeurl";
		this.youtubeurl.style.padding = "0px";
		this.youtubeurl.style.margin = "0px"; 
		this.youtubeurl.style.width = "100%"; 
		
		this.umbruch = document.createElement("br");
		this.umbruch.style.clear = "both";
		
		this.youtubeurldiv.appendChild(this.youtubeurl);
		this.youtubeurlcontainer.appendChild(this.youtubename);
		this.youtubeurlcontainer.appendChild(this.youtubeurldiv);
		this.youtubeurlcontainer.appendChild(this.umbruch);
		document.getElementsByName("artikelplusform")[0].insertBefore(this.youtubeurlcontainer,document.getElementsByName("drueckervorschau")[0]);
	}
}
		
		function aktivieremedienbrowser (where) {
			if (document.getElementById("artikelmedien") != null) {
				document.getElementById("artikelmedien").style.display = "block";
				document.getElementById("artikelmedienklapper").src = "http://graphic.co2-filter.com/seite/dbflexxshowless.png";
				document.getElementById("artikelmedienklapper").onclick = function () { deaktivieremedienbrowser(where); };
			}
			else {
				document.getElementById("artikelmedienklapper").onclick = function () { deaktivieremedienbrowser(where); };

        this.medien = document.createElement("div");
		this.medien.id = "artikelmedien";
		this.medien.onmouseup = function () { document.getElementById("artikelmedien").style.MozUserSelect = "element"; document.getElementById("artikelmedien").style.KhtmlUserSelect = "text"; document.getElementById("artikelmedien").style.unselectable = "off"; };
		
		this.medienleiste = document.createElement("div");
		this.medienleiste.id = "artikelmedienleiste";
		
		this.medienleistetab = new Array();
		
		for (i = 0; i < 5; i++) {
			this.medienleistetab[i] = document.createElement("div");
			this.medienleistetab[i].id = "artikelmedienleistetab" + i;
			this.medienleistetab[i].style.width = "20%";
			this.medienleistetab[i].style.height = "17px";
			this.medienleistetab[i].style.fontSize = "11px"; 
			this.medienleistetab[i].style.paddingTop = "3px";
			this.medienleistetab[i].style.textAlign = "center";
			this.medienleistetab[i].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_passiv.png)";
			this.medienleistetab[i].style.cssFloat = "left";
		}
		this.medienleistetab[0].innerHTML = "Bilder";
		this.medienleistetab[1].innerHTML = "Videos";
		this.medienleistetab[2].innerHTML = "Audios";
		this.medienleistetab[3].innerHTML = "Youtube";
		this.medienleistetab[4].innerHTML = "URL";
		this.medienleistetab[0].style.background = "url(http://graphic.co2-filter.com/seite/verlauf_klein_aktiv.png)";
		//this.medienleistetab[3].onclick = function () { youtubeeinf(); };
		
		this.medienunterescontainer = document.createElement("div");
		this.medienunterescontainer.id = "artikelmedienunterescontainer";
		
		this.medienleisteunterestab = document.createElement("div");
		this.medienleisteunterestab.id = "artikelmedienunterestab";
		this.medienleisteunterestab.style.background = "#595959";
		//this.medienleisteunterestab.style.height = "54px"; 
		this.medienleisteunterestab.style.width = "100%";
		this.medienleisteunterestab.style.paddingTop = "6px"; 
		
		this.medienrechteseite = document.createElement("div");
		this.medienrechteseite.id = "artikelmedienunterestabrechtsdiv";
		this.medienrechteseite.style.cssFloat = "right";
		this.medienrechteseite.style.height = "54px";
		
		this.suchleiste = document.createElement("div");
		this.suchleiste.id = "artikelmediensuchleiste";
		this.suchleiste.style.width = "auto";
		this.suchleiste.style.cssFloat = "right";
		this.suchleiste.style.marginTop = "-2px";
		this.suchleiste.style.marginRight = "10px";
		
		this.suchleistelinks = document.createElement("div");
		this.suchleistelinks.style.background = "url(http://images.apple.com/euro/global/nav/images/searchfield_leftcap.png)";
		this.suchleistelinks.style.cssFloat = "left";
		this.suchleistelinks.style.width = "20px";
		this.suchleistelinks.style.height = "19px";
		
		this.suchleisterechts = document.createElement("div");
		this.suchleisterechts.style.background = "url(http://images.apple.com/euro/global/nav/images/searchfield_rightcap.png)";
		this.suchleisterechts.style.cssFloat = "left";
		this.suchleisterechts.style.width = "10px"; 
		this.suchleisterechts.style.height = "19px";
		
		this.suchleiste2 = document.createElement("input");
		this.suchleiste2.type = "text";
		this.suchleiste2.name = "artikelmediensuche";
		this.suchleiste2.style.backgroundImage = "url(http://images.apple.com/euro/global/nav/images/searchfield_repeat.png)";
		this.suchleiste2.style.backgroundPosition = "50% 0%";
		this.suchleiste2.style.backgroundRepeat = "repeat-x";
		this.suchleiste2.style.border = "0";
		this.suchleiste2.style.height = "15px";
		this.suchleiste2.style.marginLeft = "0px";
		this.suchleiste2.style.marginRight = "0px";
		this.suchleiste2.style.paddingTop = "3px"; 
		this.suchleiste2.style.cssFloat = "left";
		this.suchleiste2.style.outline = "none";
		this.suchleiste2.onkeyup = function () { suchfunktion(globaldata,document.forms["artikelplusform"].artikelmediensuche.value); };
		this.suchleiste2.onkeypress = enterverhindern;
		this.suchleiste2.readOnly = true;
		
		this.kategorie = document.createElement("div");
		this.kategorie.id = "artikelmedienkategorie";
		this.kategorie.style.overflowY = "hidden";
		this.kategorie.style.height = "40px";
		this.kategorie.style.marginLeft = "10px";
		
		this.mediensteuerleiste = document.createElement("div");
		this.mediensteuerleiste.id = "artikelmediensteuerleiste";
		this.mediensteuerleiste.onmousedown = function () { document.getElementById("artikelmedien").style.MozUserSelect = "none"; document.getElementById("artikelmedien").style.KhtmlUserSelect = "none"; document.getElementById("artikelmedien").style.unselectable = "on"; };
			
		
		this.umbruch3 = document.createElement("br");
		this.umbruch3.style.clear = "both";
		
		function medienhochladen () {
			
			document.getElementById("artikelmedienhinzufügen").className = "artikelmedienaktivhinzufügen";
			document.getElementById("artikelmedienhinzufügen").onclick = function () { medienfensterschließen(); };
			document.getElementById("artikelmedienlöschen").onclick = function () { medienfensterschließen(); medienlöschen(); };
			
			this.uploadform = document.createElement("form");
			this.uploadform.id = "artikelmedienuploadformularform";
			this.uploadform.action = "http://dievierte-gewalt.de/beta/scripts/medienupload.php";
			this.uploadform.method = "post";
			this.uploadform.enctype = "multipart/form-data";
			this.uploadform.target = "artikelmedienuploadiframe";
			this.uploadform.style.marginBottom = "0px";
			this.uploadform.onsubmit = function () { document.getElementById("dbflexxloader").style.visibility = "visible"; document.getElementById("dbflexxstatusleiste").innerHTML = "Lade Bild hoch ..."; };
			
			this.uploaddiv = document.createElement("div");
			this.uploaddiv.id = "artikelmedienuploadformulardiv";
			this.uploaddiv.style.paddingLeft = "10px";
			
			this.uploadbutton = document.createElement("input");
			this.uploadbutton.type = "submit";
			this.uploadbutton.value = "Hochladen";
			
			this.uploadzusatzform = document.createElement("form");
			this.uploadzusatzform.id = "";
			this.uploadzusatzform.action = "";
			this.uploadzusatzform.method = "post";
			this.uploadzusatzform.enctype = "text/plain";
			this.uploadzusatzform.acceptCharset = "UTF-8";
			this.uploadzusatzform.style.marginBottom = "0px";
			
			this.uploadzusatzformname = document.createElement("input");
			this.uploadzusatzformname.id = "artikelmedienuploadzusatzformularnameinput";
			this.uploadzusatzformname.name = "artikelmedienuploadzusatzformularname";
			this.uploadzusatzformname.className = "artikelmedienuploadzusatzformular2";
			this.uploadzusatzformname.type = "text";
			this.uploadzusatzformname.size = "35";
			
			this.uploadzusatzformstich = document.createElement("input");
			this.uploadzusatzformstich.id = "artikelmedienuploadzusatzformularstichinput";
			this.uploadzusatzformstich.name = "artikelmedienuploadzusatzformularstich";
			this.uploadzusatzformstich.className = "artikelmedienuploadzusatzformular2";
			this.uploadzusatzformstich.type = "text";
			this.uploadzusatzformstich.size = "60";
			
			this.uploadzusatzformalt = document.createElement("input");
			this.uploadzusatzformalt.id = "artikelmedienuploadzusatzformularaltinput";
			this.uploadzusatzformalt.name = "artikelmedienuploadzusatzformularalt";
			this.uploadzusatzformalt.className = "artikelmedienuploadzusatzformular2";
			this.uploadzusatzformalt.type = "text";
			this.uploadzusatzformalt.size = "60";
			
			this.uploadzusatzformcopy = document.createElement("input");
			this.uploadzusatzformcopy.id = "artikelmedienuploadzusatzformularcopyinput";
			this.uploadzusatzformcopy.name = "artikelmedienuploadzusatzformularcopy";
			this.uploadzusatzformcopy.className = "artikelmedienuploadzusatzformular2";
			this.uploadzusatzformcopy.type = "text";
			this.uploadzusatzformcopy.size = "60";
			
			this.uploadzusatzname = document.createElement("div");
			this.uploadzusatzname.id = "artikelmedienuploadzusatzformularnamediv";
			this.uploadzusatzname.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzname.innerHTML = "Bildname";
			
			this.uploadzusatzstich = document.createElement("div");
			this.uploadzusatzstich.id = "artikelmedienuploadzusatzformularstichdiv";
			this.uploadzusatzstich.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzstich.innerHTML = "Stichwörter";
			
			this.uploadzusatzalt = document.createElement("div");
			this.uploadzusatzalt.id = "artikelmedienuploadzusatzformularaltdiv";
			this.uploadzusatzalt.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzalt.innerHTML = "Bildbeschreibung";
			
			this.uploadzusatzcopy = document.createElement("div");
			this.uploadzusatzcopy.id = "artikelmedienuploadzusatzformularcopydiv";
			this.uploadzusatzcopy.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzcopy.innerHTML = "Copyright";
			
			this.uploadzusatzkat = document.createElement("div");
			this.uploadzusatzkat.id = "artikelmedienuploadzusatzformularkatdiv";
			this.uploadzusatzkat.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzkat.innerHTML = "Kategorien";
			
			this.uploadfile = document.createElement("input");
			this.uploadfile.id = "artikelmedienuploadformularfileinput";
			this.uploadfile.name = "artikelmedienuploadformularfile";
			this.uploadfile.type = "file";
			this.uploadfile.className = "artikelmedienuploadzusatzformular2";
			
			this.uploadzusatzfile = document.createElement("div");
			this.uploadzusatzfile.id = "artikelmedienuploadzusatzformularfilediv";
			this.uploadzusatzfile.className = "artikelmedienuploadzusatzformular";
			this.uploadzusatzfile.innerHTML = "Datei";
			
			this.uploaddatei = document.createElement("div");
			this.uploaddatei.id = "artikelmedienuploaddateidiv";
			this.uploaddatei.className = "artikelmedienuploaddiv";
			
			this.uplaodnamediv = document.createElement("div");
			this.uplaodnamediv.id = "artikelmedienuploadnamediv";
			this.uplaodnamediv.className = "artikelmedienuploaddiv"; 
			
			this.uplaodstichdiv = document.createElement("div");
			this.uplaodstichdiv.id = "artikelmedienuploadstichdiv";
			this.uplaodstichdiv.className = "artikelmedienuploaddiv";
			
			this.uplaodaltdiv = document.createElement("div");
			this.uplaodaltdiv.id = "artikelmedienuploadaltdiv";
			this.uplaodaltdiv.className = "artikelmedienuploaddiv";
			
			this.uploadcopydiv = document.createElement("div");
			this.uploadcopydiv.id = "artikelmedienuploadcopydiv";
			this.uploadcopydiv.className = "artikelmedienuploaddiv";
						
			this.uplaodkatdiv = document.createElement("div");
			this.uplaodkatdiv.id = "artikelmedienuploadkatdiv";
			this.uplaodkatdiv.className = "artikelmedienuploaddiv";
			
			this.umbruch = document.createElement("br");
			this.umbruch.style.clear = "both";
			
			this.umbruch1 = document.createElement("br");
			this.umbruch1.className = "umbruchclar";
			
			this.umbruch2 = document.createElement("br");
			this.umbruch2.className = "umbruchclar";
			
			this.umbruch3 = document.createElement("br");
			this.umbruch3.className = "umbruchclar";
			
			this.umbruch4 = document.createElement("br");
			this.umbruch4.className = "umbruchclar";
			
			this.umbruch5 = document.createElement("br");
			this.umbruch5.className = "umbruchclar";
			
			this.iframe = document.createElement("iframe");
			this.iframe.className = "artikelverstecktesiframe";
			this.iframe.id = "artikelmedienuploadiframe";
			this.iframe.name = "artikelmedienuploadiframe";
			this.iframe.src = "about:blank";
			
			this.kategorieselect = new Array();
			this.optionselectstandard = new Array();
			for (i = 0; i< 3; i++) {
				this.kategorieselect[i] = document.createElement("select");
				this.kategorieselect[i].id = "artikelmedienuploadkategorieselect" + i;
				this.kategorieselect[i].name = "artikelmedienuploadkategorieselect" + i;
				this.kategorieselect[i].style.marginRight = "6px"; 
				this.optionselectstandard[i] = document.createElement("option");
				this.optionselectstandard[i].id = "artikelmedienuplodoptionselectstandard";
				this.optionselectstandard[i].value = "none";
				if (i == 0) {
					this.optionselectstandard[i].text = "Bitte Kategorie auswählen.";
				}
				else {
					this.optionselectstandard[i].text = "Keine weitere Kategorie gewählt.";
				}
				this.kategorieselect[i].appendChild(this.optionselectstandard[i]);
			}
			
			this.uploaddatei.appendChild(this.uploadzusatzfile);
			this.uploaddatei.appendChild(this.uploadfile);
			this.uploaddatei.appendChild(this.umbruch1);
			this.uplaodnamediv.appendChild(this.uploadzusatzname);
			this.uplaodnamediv.appendChild(this.uploadzusatzformname);
			this.uplaodnamediv.appendChild(this.umbruch2);
			this.uplaodstichdiv.appendChild(this.uploadzusatzstich);
			this.uplaodstichdiv.appendChild(this.uploadzusatzformstich);
			this.uplaodstichdiv.appendChild(this.umbruch3);
			this.uplaodaltdiv.appendChild(this.uploadzusatzalt);
			this.uplaodaltdiv.appendChild(this.uploadzusatzformalt);
			this.uplaodaltdiv.appendChild(this.umbruch4);
			this.uploadcopydiv.appendChild(this.uploadzusatzcopy);
			this.uploadcopydiv.appendChild(this.uploadzusatzformcopy);
			this.uploadcopydiv.appendChild(this.umbruch5);
			this.uplaodkatdiv.appendChild(this.uploadzusatzkat);
			for (i = 0; i < 3;i++) {
				this.uplaodkatdiv.appendChild(this.kategorieselect[i]);
			}
			this.uploadform.appendChild(this.uploaddatei);
			this.uploadform.appendChild(this.uplaodnamediv);
			this.uploadform.appendChild(this.uplaodstichdiv);
			this.uploadform.appendChild(this.uplaodaltdiv);
			this.uploadform.appendChild(this.uploadcopydiv);
			this.uploadform.appendChild(this.uplaodkatdiv);
			this.uploadform.appendChild(this.umbruch);
			this.uploadform.appendChild(this.uploadbutton);
			this.uploaddiv.appendChild(this.uploadform);
			document.getElementById("artikelmedienunterestab").appendChild(this.uploaddiv);
			document.getElementById("artikelmedienunterestab").appendChild(this.iframe);
			
			selector = testajax();
			var optionselect = new Array();
			selector.open('get', 'http://dievierte-gewalt.de/beta/scripts/grafik.php?action=kategorie', true);
			document.getElementById("dbflexxloader").style.visibility = "visible";
			document.getElementById("dbflexxstatusleiste").innerHTML = "Lade Kategorie ...";
			selector.onreadystatechange = function () {
				if (selector.readyState == 4) {
					var data = selector.responseText;
					data = data.split(";");
					for (j = 0; j < 3; j++) {
						for (i = 0; i < data.length - 1; i++) {
							idname = "artikelmedienuploadkategorieselect" + j;
							optionselect[i] = document.createElement("option");
							optionselect[i].id = "artikelmedienuploadselectoption" + i;
							optionselect[i].value = data[i];
							optionselect[i].text = data[i];
							document.getElementById(idname).appendChild(optionselect[i]);
						}
						idname = "artikelmedienuploadkategorieselect" + j;
						idname2 = "artikelmedienuploadkategorieinput" + j;
						letzteoption = document.createElement("option");
						letzteoption.id = "artikelmedienuploadkategorieinput" + j;
						letzteoption.value = "neu";
						letzteoption.text = "Neue Kategorie hinzufügen";
						document.getElementById(idname).onchange = function () {
							if (this.value == "neu") {
								//alert(document.getElementById(idname2));
								textfeldkat = document.createElement("input");
								textfeldkat.type = "text";
								textfeldkat.name = this.name;
								this.parentNode.replaceChild(textfeldkat,this);
							}
						}
						document.getElementById(idname).appendChild(letzteoption);
					}
					document.getElementById("dbflexxloader").style.visibility = "hidden";
					document.getElementById("dbflexxstatusleiste").innerHTML = "Fertig.";
				}
			}
			selector.send(null);
			
			function FinishUpload (status) {
				if (status == "OK") {
					statusnachricht = document.createElement("div");
					statusnachricht.innerHTML = "Das Bild wurde erfolgreich hochgeladen und steht nun zur Verfügung!";
					document.getElementById("artikelmedienuploadformulardiv").parentNode.replaceChild(statusnachricht,document.getElementById("artikelmedienuploadformulardiv"));
					document.getElementById("dbflexxloader").style.visibility = "hidden";
					document.getElementById("dbflexxstatusleiste").innerHTML = "Fertig.";
					window.setTimeout(function () { document.getElementById("artikelmedienuploadformulardiv").parentNode.removeChild(document.getElementById("artikelmedienuploadformulardiv")); } ,300);
				}
			}
		}
		
		function medienfensterschließen () {
			
			document.getElementById("artikelmedienuploadformulardiv").parentNode.removeChild(document.getElementById("artikelmedienuploadformulardiv")); 
			document.getElementById("artikelmedienuploadiframe").parentNode.removeChild(document.getElementById("artikelmedienuploadiframe"));
			document.getElementById("artikelmedienhinzufügen").className = "artikelmedienhinzufügen";
			document.getElementById("artikelmedienhinzufügen").onclick = function () { medienhochladen(); };
		}
		
		function medienlöschenschließen () {
			document.getElementById("artikelmedienlöschen").onclick = function () { medienlöschen(); };
			document.getElementById("artikelmedienlöschen").className = "artikelmedienlöschen";
			parentnode = document.getElementById("artikelmedieninhaltthumbsdiv");
			for (i = 0; i < parentnode.childNodes.length - 1; i++) {
				parentnode.childNodes[i].removeChild(parentnode.childNodes[i].lastChild);
			}
		}
		
		function medienlöschen () {
			document.getElementById("artikelmedienlöschen").onclick = function () { medienlöschenschließen(); };
			document.getElementById("artikelmedienhinzufügen").onclick = function () { medienlöschenschließen(); medienhochladen(); };
			document.getElementById("artikelmedienlöschen").className = "artikelmedienaktivlöschen";
			löschenabsolut = new Array();
			parentnode = document.getElementById("artikelmedieninhaltthumbsdiv");
			for (i = 0; i < parentnode.childNodes.length; i++) {
				löschenabsolut[i] = document.createElement("div");
				löschenabsolut[i].id = "artikelmedienlöschengrafik" + i;
				löschenabsolut[i].className = "artikelmedienlöschengrafik";
				löschenabsolut[i].style.top = (- 10 - parentnode.childNodes[i].firstChild.offsetHeight) + "px";
				löschenabsolut[i].onclick = function () {
					id = this.parentNode.firstChild.title;
					löschenajax = testajax();
					löschenajax.open("get", "http://co2-filter.com/de/alpha/skripte/grafikloeschen.php?id="+ id +"");
					löschenajax.onreadystatechange = function () {
						if (löschenajax.readyState == 4) {
						}
					}
					löschenajax.send(null);
					this.parentNode.parentNode.removeChild(this.parentNode);
				}
				parentnode.childNodes[i].appendChild(löschenabsolut[i]);
			}
		}
		
		this.medienhinzu = document.createElement("div");
		this.medienhinzu.id = "artikelmedienhinzufügen";
		this.medienhinzu.className = "artikelmedienhinzufügen";
		this.medienhinzu.onclick = function () { medienhochladen(); };
		
		this.medienbearbeiten = document.createElement("div");
		this.medienbearbeiten.id = "artikelmedienbearbeitendiv";
		this.medienbearbeiten.className = "artikelmedienbearbeitendiv";
		/*this.medienbearbeiten.onmousedown = function () { document.getElementById("artikelmedienbearbeitendiv").style.backgroundPosition = "-41px -22px"; };
		this.medienbearbeiten.onmouseout = function () { document.getElementById("artikelmedienbearbeitendiv").style.backgroundPosition = "-41px 0px"; };*/
		
		this.medienlöschen = document.createElement("div");
		this.medienlöschen.id = "artikelmedienlöschen";
		this.medienlöschen.className = "artikelmedienlöschen";
		this.medienlöschen.onclick = function () { medienlöschen(); };	
		/*this.medienlöschen.onmousedown = function () { document.getElementById("artikelmedienlöschen").style.backgroundPosition = "-82px -22px"; };
		this.medienlöschen.onmouseout = function () { document.getElementById("artikelmedienlöschen").style.backgroundPosition = "-82px 0px"; };*/
		
		this.medienpfeillinks = document.createElement("img");
		this.medienpfeillinks.id = "artikelmedienbrowserpfeillinks";
		this.medienpfeillinks.src = "http://graphic.co2-filter.com/seite/galeriepfeil_links.png";
		this.medienpfeillinks.onclick = function () {
			if (browsen == 0 && document.getElementById("artikelmedieninhaltcontainerdiv").style.marginLeft < "0px" || typeof(browsen) == "undefined" && document.getElementById("artikelmedieninhaltcontainerdiv").style.marginLeft < "0px") {
            	i = 0;
                browse('linksbrowsen','','artikelmedieninhaltcontainerdiv',400);
            }
		};
		
		this.medienpfeilrechts = document.createElement("img");
		this.medienpfeilrechts.id = "artikelmedienbrowserpfeilrechts";
		this.medienpfeilrechts.src = "http://graphic.co2-filter.com/seite/galeriepfeil_rechts.png";
		this.medienpfeilrechts.onclick = function () {
			if (browsen == 0 && document.getElementById("artikelmedieninhaltcontainerdiv").style.marginLeft < "5000px" || typeof(browsen) == "undefined" && document.getElementById("artikelmedieninhaltcontainerdiv").style.marginLeft < "5000px") {
            	i = 0;
                browse('rechtsbrowsen','5000','artikelmedieninhaltcontainerdiv',400);
            }
		};
		
		this.medienpfeillinksdiv = document.createElement("div");
		this.medienpfeillinksdiv.id = "";
		this.medienpfeillinksdiv.style.cssFloat = "left";
		this.medienpfeillinksdiv.style.width = "20px";
		this.medienpfeillinksdiv.style.height = "155px";
		this.medienpfeillinksdiv.style.paddingRight = "10px";
		this.medienpfeillinksdiv.style.paddingTop = "75px";
		this.medienpfeillinksdiv.style.background = "url(http://graphic.co2-filter.com/seite/medienbrowser_hintergrund.png)";
		
		this.medienpfeilrechtsdiv = document.createElement("div");
		this.medienpfeilrechtsdiv.id = "";
		this.medienpfeilrechtsdiv.style.cssFloat = "right";
		this.medienpfeilrechtsdiv.style.width = "20px";
		this.medienpfeilrechtsdiv.style.height = "155px";
		this.medienpfeilrechtsdiv.style.paddingTop = "75px";
		this.medienpfeilrechtsdiv.style.paddingLeft = "10px";
		this.medienpfeilrechtsdiv.style.background = "url(http://graphic.co2-filter.com/seite/medienbrowser_hintergrund.png)";
		
		this.medieninhalt = document.createElement("div");
		this.medieninhalt.id = "artikelmedieninhaltdiv";
		this.medieninhalt.style.height = "230px";
		this.medieninhalt.style.overflow = "hidden";
		this.medieninhalt.style.background = "url(http://graphic.co2-filter.com/seite/medienbrowser_hintergrund.png)";
		
		this.medieninhaltcontainer = document.createElement("div");
		this.medieninhaltcontainer.id = "artikelmedieninhaltcontainerdiv";
		this.medieninhaltcontainer.style.width = "5000px";
		this.medieninhaltcontainer.style.marginLeft = "0px";
		
		this.medieninhaltthumbs = document.createElement("div");
		this.medieninhaltthumbs.id = "artikelmedieninhaltthumbsdiv";
		
		this.medieninhaltuntertitel = document.createElement("div");
		this.medieninhaltuntertitel.id = "artikelmedieninhaltuntertiteldiv";
		
		this.bilderinput = document.createElement("input");
		this.bilderinput.type = "hidden";
		this.bilderinput.id = "artikelmedienbildercache";
		this.bilderinput.name = "artikelmedienbildercache";
		
		this.umbruch = document.createElement("br");
		this.umbruch.style.clear = "both";
		
		this.umbruch4 = document.createElement("br");
		this.umbruch4.style.clear = "both";
		
		this.umbruch5 = document.createElement("br");
		this.umbruch5.style.clear = "both";
		
		this.umbruch2 = document.createElement("br");
		this.umbruch2.style.clear = "both";
		
		for (i = 0; i < 5; i++) {
			this.medienleiste.appendChild(this.medienleistetab[i]);
		}
		this.medienleiste.appendChild(this.umbruch);
		this.suchleiste.appendChild(this.suchleistelinks);
		this.suchleiste.appendChild(this.suchleiste2);
		this.suchleiste.appendChild(this.suchleisterechts);
		this.mediensteuerleiste.appendChild(this.medienhinzu);
		this.mediensteuerleiste.appendChild(this.medienbearbeiten);
		this.mediensteuerleiste.appendChild(this.medienlöschen);
		this.mediensteuerleiste.appendChild(this.umbruch3);
		this.medienrechteseite.appendChild(this.suchleiste);
		this.medienrechteseite.appendChild(this.umbruch4);
		this.medienrechteseite.appendChild(this.mediensteuerleiste);
		this.medienleisteunterestab.appendChild(this.medienrechteseite);
		this.medienleisteunterestab.appendChild(this.kategorie);
		this.medienleisteunterestab.appendChild(this.umbruch5);
		this.medienpfeillinksdiv.appendChild(this.medienpfeillinks);
		this.medienpfeilrechtsdiv.appendChild(this.medienpfeilrechts);
		this.medieninhaltcontainer.appendChild(this.medieninhaltthumbs);
		this.medieninhaltcontainer.appendChild(this.umbruch2);
		this.medieninhaltcontainer.appendChild(this.medieninhaltuntertitel);
		this.medieninhalt.appendChild(this.medieninhaltcontainer);
		this.medien.appendChild(this.medienleiste);
		this.medienunterescontainer.appendChild(this.medienleisteunterestab);
		this.medienunterescontainer.appendChild(this.medienpfeillinksdiv);
		this.medienunterescontainer.appendChild(this.medienpfeilrechtsdiv);
		this.medienunterescontainer.appendChild(this.medieninhalt);
		this.medien.appendChild(this.medienunterescontainer);
		if (where == "add") {
			document.getElementsByName("artikelplusform")[0].insertBefore(this.medien,document.getElementsByName("drueckervorschau")[0]);
		}
		else if (where == "edit") {
			document.getElementsByName("artikelplusform")[0].insertBefore(this.medien,document.getElementsByName("druecker")[0]);
		}
		kategoriediv = new Array();

		
		kategorieajax = testajax();
		kategorieajax.open('get', 'http://dievierte-gewalt.de/beta/scripts/grafik.php?action=kategorie');
		kategorieajax.onreadystatechange = function () {
			if (kategorieajax.readyState == 4) {
				var data = kategorieajax.responseText;
				var kategorie = new Array();
				var kategorie2 = new Array();
				var kategorie3 = new Array();
				data = data.split(";");
				var anzahl = data.length;				
				for (i = 0; i < anzahl - 1; i++) {
					kategoriediv[i] = document.createElement("div");
					kategoriediv[i].style.cssFloat = "left";
					kategoriediv[i].style.fontSize = "11px"; 
					kategoriediv[i].style.color = "#F2F2F2";
					kategorie[i] = document.createElement("input");
					kategorie[i].type = "checkbox";
					kategorie[i].name = "artikelmedienkategoriecheckbox";
					kategorie[i].value = data[i];
					kategorie[i].checked = "checked";
					kategorie[i].onchange = function () { bebilderunglöschen(); kategoriechange(); };
					kategorie2[i] = document.createElement("div");
					kategorie2[i].id = "unterestab";
					kategorie2[i].innerHTML = data[i];
					kategorie2[i].style.cssFloat = "left";
					kategorie2[i].style.marginTop = "1px";
					kategorie2[i].style.marginRight = "10px";
					kategorie3[i] = document.createElement("div");
					kategorie3[i].appendChild(kategorie[i]);
					kategorie3[i].style.cssFloat = "left";
					kategoriediv[i].appendChild(kategorie3[i]);
					kategoriediv[i].appendChild(kategorie2[i]);
					document.getElementById("artikelmedienkategorie").appendChild(kategoriediv[i]);
				}
				kategoriechange();
			}
		}
		kategorieajax.send(null);
		
		
		pushajax = testajax();
		xmlpoll = window.setInterval(XHRpoll,1000);
		pushajax.open('get', 'http://co2-filter.com/de/alpha/skripte/pushtest.php', true);
		pushajax.onreadystatechange = parseResponse;
		pushajax.send(null);
		
		/*inhaltsabfrage = testajax();
		inhaltsabfrage.open('get', 'http://co2-filter.com/de/alpha/skripte/grafik.php');
		inhaltsabfrage.onreadystatechange = function () {
			if (inhaltsabfrage.readyState == 4) {
				abfragekat = "";
				inhaltdata = inhaltsabfrage.responseText;
				inhaltdata = inhaltdata.split(";");
				//variableglobalmachen(inhaltdata,0);
				document.getElementsByName("artikelmediensuche")[0].readOnly = false;
				kategoriechange();
			}
		}
		inhaltsabfrage.send(null);*/
		
		function variableglobalmachen (data) {
			globaldata = data;
		}
		
		
		function kategoriearray (mitkategorien) {
			kategoriezuweisung = testajax();
			kategoriezuweisung.open('get', 'http://dievierte-gewalt.de/beta/scripts/grafik.php?mitkategorie='+mitkategorien);
			document.getElementById("dbflexxloader").style.visibility = "visible";
			document.getElementById("dbflexxstatusleiste").innerHTML = "Lade Kategorien ...";
			kategoriezuweisung.onreadystatechange = function () {
				if (kategoriezuweisung.readyState == 4) {
					var data = kategoriezuweisung.responseText;
					//data = data.split(";");
					variableglobalmachen(data);
					document.getElementsByName("artikelmediensuche")[0].readOnly = false;
					bebilderung(data);
				}
			}
			kategoriezuweisung.send(null);
		}
		
		function kategoriechange () {
			abfragekat = "";
			for (i = 0; i < document.getElementsByName("artikelmedienkategoriecheckbox").length; i++) {
				if (document.getElementsByName("artikelmedienkategoriecheckbox")[i].checked == true) {
					abfragekat = abfragekat + document.getElementsByName("artikelmedienkategoriecheckbox")[i].value + ",";
				}
			}
			if (abfragekat == "") 
				abfragekat = "alle";
			kategoriearray (abfragekat);
		}
		
		function bebilderung (bilderarray) {
			bilderarray = bilderarray.split(";");
			bebilderungdiv = new Array();
			bebilderungimg = new Array();
			bebilderunguntertitellinks = new Array();
			bebilderunguntertitelrechts = new Array();
			j = 0;
			document.getElementById("dbflexxstatusleiste").innerHTML = "Lade Bilder ...";
			for (i = 0; i < (bilderarray.length / 7) - 1; i++) {
				idname = "artikelmedieninhaltbebilderungdiv" + i;
				bebilderungdiv[i] = document.createElement("div");
				bebilderungdiv[i].id = "artikelmedieninhaltbebilderungdiv" + i;
				bebilderungdiv[i].className = "artikelmedieninhaltbebilderungdiv";
				bebilderungdiv[i].style.width = "130px";
				bebilderungdiv[i].style.height = "200px";
				bebilderungdiv[i].style.cssFloat = "left";
				bebilderungdiv[i].style.textAlign = "center";
				bebilderungdiv[i].onclick = function () { bildselektieren(this); };
				bebilderungimg[i] = document.createElement("img");
				bebilderungimg[i].id = "artikelmedieninhaltbebilderungimg" + i;
				bebilderungimg[i].src = "http://graphics.dievierte-gewalt.de/smallthumbs/"+bilderarray[j];
				bebilderungimg[i].style.marginTop = (200 - bilderarray[j + 4]) / 2 + "px";
				bebilderungimg[i].title = bilderarray[j];
				bebilderungdiv[i].appendChild(bebilderungimg[i]);
				bebilderunguntertitellinks[i] = document.createElement("div");
				bebilderunguntertitellinks[i].id = "artikelmedienbebilderunguntertitellinksdiv" + i;
				bebilderunguntertitellinks[i].className = "artikelmedienbebilderunguntertitellinksdiv";
				bebilderunguntertitellinks[i].innerHTML = bilderarray[j + 5];
				bebilderunguntertitelrechts[i] = document.createElement("div");
				bebilderunguntertitelrechts[i].id = "artikelmedienbebilderunguntertitelrechtsdiv" + i;
				bebilderunguntertitelrechts[i].className = "artikelmedienbebilderunguntertitelrechtsdiv";
				bebilderunguntertitelrechts[i].innerHTML = bilderarray[j + 1];
				document.getElementById("artikelmedieninhaltthumbsdiv").appendChild(bebilderungdiv[i]);
				document.getElementById(idname).appendChild(bebilderunguntertitellinks[i]);
				document.getElementById(idname).appendChild(bebilderunguntertitelrechts[i]);
				j = j + 7;
			}
			document.getElementById("dbflexxstatusleiste").innerHTML = "Fertig.";
			document.getElementById("dbflexxloader").style.visibility = "hidden";
		}
		
		function bildselektieren (thisvar) {
			thisvar.firstChild.className = "artikelmedieninhaltbebilderungdivaktiv";
			thisvar.firstChild.style.marginTop = parseInt(thisvar.firstChild.style.marginTop) - 3 + "px";
			thisvar.onclick = function () { bilddeselektieren(thisvar); };
			bilderinartikel.push(thisvar.firstChild.title);
			thishöhe = thisvar.firstChild.offsetHeight;
			bilderinartikel.push(thishöhe);
		}
		
		function bilddeselektieren (thisvar) {
			thisvar.className = "artikelmedieninhaltbebilderungdiv";
			thisvar.onclick = function () { bildselektieren(thisvar); };
			for (i = 0; i < bilderinartikel.length; i++) {
				if (bilderinartikel[i] == thisvar.firstChild.title) {
					bilderinartikel.splice(i,2);
					break;
				}
			}
		}
		
		function bebilderunglöschen () {
			länge = document.getElementById("artikelmedieninhaltthumbsdiv").childNodes.length;
			for (i = 0; i < länge; i++) {
				löschchild = document.getElementById("artikelmedieninhaltthumbsdiv").lastChild;
				löschknoten = document.getElementById("artikelmedieninhaltthumbsdiv");
				löschknoten.removeChild(löschchild);
			}
		}
		
		function suchfunktion (data,suchmuster) {
			document.getElementById("artikelmedieninhaltcontainerdiv").style.marginLeft = "0px";
			data = data.split(";");
			//suchmuster = "/" + suchmuster + "/";
			//alert(suchmuster);
			//alert(data.length - 1 / 5);
			//alert(data);
			j = 0;
			for (i = 0; i < (data.length - 1); i = i + 7) {
				idname = "artikelmedieninhaltbebilderungdiv" + j;
				//alert(data[i + 3]);
				if (data[i].toLowerCase().search(suchmuster.toLowerCase()) != -1 && suchmuster != "") {
					//alert(data[i].search(suchmuster));
					//alert(data[i + 3].search(suchmuster != -1));
					document.getElementById(idname).style.display = "block";
				}
				else if (data[i + 6].toLowerCase().search(suchmuster.toLowerCase()) != -1 && suchmuster != "") {
					document.getElementById(idname).style.display = "block";
				}
				else if (suchmuster == "") {
					document.getElementById(idname).style.display = "block";
				}
				else {
					document.getElementById(idname).style.display = "none";
				}
				j++;
			}
		}
		
			}
			
		}
function textmodusextern () {
	if (document.getElementById("artikellayoutcontainer") != null) {
		bildercontainer = document.getElementById("artikelbilderdivcontainer");
		marginleft = new Array();
		margintop = new Array();
		width = new Array();
		height = new Array();
		deckkraft = new Array();
		for (i = 0; i < document.getElementById("artikelbilderdivcontainer").childNodes.length; i++) {
			array = bildercontainer.childNodes[i].firstChild;
			arrayname = bildercontainer.childNodes[i].firstChild.id;
			marginleft[arrayname] = parseInt(array.style.left);
			margintop[arrayname] = parseInt(array.style.top);
			width[arrayname] = parseInt(array.offsetWidth);
			height[arrayname] = parseInt(array.offsetHeight);
			deckkraft[arrayname] = parseFloat(array.style.opacity);
		}
		
		for (i = 0; i < document.getElementById("artikelyoutubedivcontainer").childNodes.length; i++) {
			array = document.getElementById("artikelyoutubedivcontainer").childNodes[i];
			arrayname = document.getElementById("artikelyoutubedivcontainer").childNodes[i].id;
			marginleft[arrayname] = parseInt(array.style.left);
			margintop[arrayname] = parseInt(array.style.top);
			width[arrayname] = parseInt(array.offsetWidth);
			height[arrayname] = parseInt(array.offsetHeight);
		}
		
		document.getElementById("artikellayoutcontainer").parentNode.removeChild(document.getElementById("artikellayoutcontainer"));
		document.getElementById("textdiv").style.display = "block";
		document.getElementById("artikellayoutmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_passiv.png)";
		document.getElementById("artikeltextmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_aktiv.png)";
		document.getElementById("artikelhinzufügenmodus").style.background = "url(http://graphic.co2-filter.com/seite/verlauf_passiv.png)";
	}
	else {
		return false;
	}
}
		
		
