// (C) 2011 Bitpalast GmbH, Berlin, Germany. All rights reserved.

	btn_kleinbilddia_1 = new Image();
	btn_kleinbilddia_1.src = $base+'i/o/btn_kleinbilddia_1.jpg';
	btn_kleinbilddia_0 = new Image();
	btn_kleinbilddia_0.src = $base+'i/o/btn_kleinbilddia_0.jpg';
	btn_grossbilddia_1 = new Image();
	btn_grossbilddia_1.src = $base+'i/o/btn_grossbilddia_1.jpg';
	btn_grossbilddia_0 = new Image();
	btn_grossbilddia_0.src = $base+'i/o/btn_grossbilddia_0.jpg';

	$dcformtest = '';
	// test up to 30 output DVDs
	$maxnoofdvds = 30;
	// test up to 100 scenes per output DVD
	$maxnoofscenes = 0;

// Allgemein

	chk_gr = new Image();
	chk_gr.src = $base+'i/o/chk_gr.gif';
	chk_or = new Image();
	chk_or.src = $base+'i/o/chk_or.gif';
	rimg_0 = new Image();
	rimg_0.src = $base+'i/o/r_dia_kleinbild.gif';
	rimg_1 = new Image();
	rimg_1.src = $base+'i/o/r_dia_mittelformat.gif';
	rimg_2 = new Image();
	rimg_2.src = $base+'i/o/r_dia_negativ.gif';
	rimg_3 = new Image();
	rimg_3.src = $base+'i/o/r_dia_aps.gif';

	btn_formular_drucken_2 = new Image();
	btn_formular_drucken_2.src = $base+'i/o/btn_formular_drucken_2.gif';
	btn_formular_drucken_1 = new Image();
	btn_formular_drucken_1.src = $base+'i/o/btn_formular_drucken_1.gif';
	btn_formular_drucken_0 = new Image();
	btn_formular_drucken_0.src = $base+'i/o/btn_formular_drucken_0.gif';

	$maxtontraegerperorder = 200;
	$maxvideosperorder = 200;
	$maxspoolsperorder = 100;
	$maxmemorycardsperorder = 200;
	$maxphotosperorder = 10000;
	$maxslidesperorder = 50000;

	function clhg() {
		document.getElementById('hourglass').className='off';
		document.getElementById('content').className='on';
	}

	function hg() {
		document.getElementById('hourglass').className='on';
		document.getElementById('content').className='off';
	}

	function setcheckedstatefromcheckbox($chkname) {
		$tmp = eval("document.forms['ord']."+$chkname+"checked");
		if (typeof (eval("document.forms['ord']."+$chkname)) != 'undefined') {
			if (eval("document.forms['ord']."+$chkname+".checked")) {
				$tmp.value = '1';
			} else {
				$tmp.value = '0';
			}
		}
	}

	function noquotes(e){
		var unicode=e.charCode? e.charCode : e.keyCode;
		if ((unicode!=8) && (unicode!=9) && (unicode!=46) && (unicode!=33) && (unicode!=32) && (unicode<160 || unicode>255)) { 
			if (unicode<35 || (unicode>126 && unicode<127) || unicode==39) {
				return false;
			} else {
				return true;
			}
		} else {
			return true;
		}
	}

	function setordershortversiondisplay($mediatypeid, $transaction) {
		if ($transaction == 0) {
			document.getElementById('intro').style.display = '';
			document.getElementById('mediatype'+$mediatypeid+'subtotal').style.display = 'none';
			document.getElementById('invoiceaddresssection').style.display = 'none';
		} else {
			document.getElementById('intro').style.display = 'none';
			document.getElementById('mediatype'+$mediatypeid+'subtotal').style.display = '';
			document.getElementById('invoiceaddresssection').style.display = '';
		}
	}

	function getplural($qty) {
		if ($qty > 1) {
			$result = new Array('n','en','s');
		} else {
			$result = new Array('','','');
		}
		return $result;
	}

	function getCheckedValue(radioObj) {
		if(!radioObj)
			return '';
		var radioLength = radioObj.length;
		if(radioLength == undefined)
			if(radioObj.checked)
				return radioObj.value;
			else
				return '';
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				return radioObj[i].value;
			}
		}
		return '';
	}

	function testordform2() {
		$sysmsg = '';
	
		if ((typeof $ordseparateoutput != 'undefined') && ($ordseparateoutput == 0)) {

/* #1373
			if ($ordonvideodvd) {
				$test = document.forms['ord'].videodvdtitle.value.replace(/[\s]+/, '');
				if ($test.length < 1) {
					$sysmsg += '<li class=error>Bitte geben Sie den Titel der Video-DVD ein.</li>';
				}
			}
*/

			if ($ordonblurayvideo) {
				$test = document.forms['ord'].blurayvideotitle.value.replace(/[\s]+/, '');
				if ($test.length < 1) {
					$sysmsg += '<li class=error>Bitte geben Sie den Titel der Blu-ray Video Disk ein.</li>';
				}
			}

			if ($ordonvideodvd) {
				// scan all videodvdtitlecassette fields if they contain at least 1 character
				var inputDiv = document.getElementsByTagName('input');
				$allfieldsoccupied = true;
				for (var i = 0; i < inputDiv.length; i++) {
					if (inputDiv[i].name.indexOf('videodvdtitlecassette') == 0) {
						$tmp = inputDiv[i];
						if ($tmp.value == '') {
							$allfieldsoccupied = false;
						}
					}
				}
				if ($allfieldsoccupied == false) {
					$sysmsg += '<li class=error>Bitte geben Sie jeder Video-DVD einen Titel.</li>';
				}
			}
		} else {

			// scan all title fields if they contain at least 1 character
			var inputDiv = document.getElementsByTagName('input');
			$allfieldsoccupied = true;
			for (var i = 0; i < inputDiv.length; i++) {
				if ((inputDiv[i].name.indexOf('videodvdtitle8mmspool') == 0) || (inputDiv[i].name.indexOf('videodvdtitle16mmspool') == 0) || (inputDiv[i].name.indexOf('blurayvideotitle8mmspool') == 0) || (inputDiv[i].name.indexOf('videodvdtitlecassette') == 0)) {
					$tmp = inputDiv[i];
					if ($tmp.value == '') {
						$allfieldsoccupied = false;
					}
				}
			}
			if ($allfieldsoccupied == false) {
				$sysmsg += '<li class=error>Bitte geben Sie jedem Datentr&auml;ger einen Titel.</li>';
			}
		}

		if (($ordonaudiocd) && (document.forms['ord'].outputformatchecked.value == '0')) {
			// scan all audio cd title fields if they contain at least 1 character
			var inputDiv = document.getElementsByTagName('input');
			$allfieldsoccupied = true;
			for (var i = 0; i < inputDiv.length; i++) {
				if (inputDiv[i].name.indexOf('audiocds') == 0) {
					$tmp = inputDiv[i];
					if ($tmp.value == '') {
						$allfieldsoccupied = false;
					}
				}
			}
			if ($allfieldsoccupied == false) {
				$sysmsg += '<li class=error>Bitte geben Sie jeder Audio-CD einen Titel.</li>';
			}
		}
		$sysmsg = menusfilled($sysmsg);

		ufwdbtn();	
	}

	function testordform2showlength($input, $id) {
		$lengthofinput = $input.length;
		if ($lengthofinput == 0) {
			document.getElementById($id).innerHTML = '';
		} else {
			document.getElementById($id).innerHTML = $lengthofinput+' von '+$maxtitlelength+' Zeichen';
		}
		testordform2();
	}

	function testordform2showdvdtitlelength($input, $id) {
		$lengthofinput = $input.length;
		if ($lengthofinput == 0) {
			document.getElementById($id).innerHTML = '';
		} else {
			document.getElementById($id).innerHTML = $lengthofinput+' von '+$maxdvdtitlelength+' Zeichen';
		}
	}

	function testordform2maxdvdtitlelength(e, $input, $id) {
		if (noquotes(e)) {
			$lengthofinput = $input.length;
			var unicode=e.charCode? e.charCode : e.keyCode
			if ((unicode!=8) && (unicode!=9)) {
				if ($lengthofinput == $maxdvdtitlelength) {
					document.getElementById($id).innerHTML = $lengthofinput+' von '+$maxdvdtitlelength+' Zeichen';
					return false;
				}
			}
		} else {
			return false;
		}
	}

	function testordform2maxlength(e, $input, $id) {
		if (noquotes(e)) {
			$lengthofinput = $input.length;
			var unicode=e.charCode? e.charCode : e.keyCode
			if ((unicode!=8) && (unicode!=9)) {
				if ($lengthofinput == $maxtitlelength) {
					document.getElementById($id).innerHTML = $lengthofinput+' von '+$maxtitlelength+' Zeichen';
					return false;
				}
			}
		} else {
			return false;
		}
	}


	function sub_menusfilled($fieldname) {
		$furtherspoolexists = true;
		$i = 0;
		$atleastoneempty = false;
		$atleastonefilled = false;
		while ($furtherspoolexists) {
			if (typeof document.getElementById($fieldname+$i) != 'undefined') {
				$tmp = eval("document.forms['ord']."+$fieldname+$i);
				if (typeof $tmp != 'undefined') {
					if ($tmp.value.replace(' ','') == '') {
						$atleastoneempty = true;
					} else {
						$atleastonefilled = true;
					}
				} else {
					$furtherspoolexists = false;
				}
				$i++;
			} else {
				$furtherspoolexists = false;
			}
		}
		if ((!($atleastoneempty)) && (!($atleastonefilled))) {
			return false;
		} else {
			return (!($atleastoneempty ^ $atleastonefilled));
		}
	}

	function menusfilled($sysmsg) {
		if ((typeof $ordseparateoutput != 'undefined') && ($ordseparateoutput == 0)) {
			$atleastoneempty = sub_menusfilled('videodvdtitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('videodvdtitle16mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('blurayvideotitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('bluraytitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('mpeg2filetitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('mpeg2filetitle16mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('hddtitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('hddtitle16mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('hddsdtitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('hddsdtitle16mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('avifiletitle8mmspool');
			if (!($atleastoneempty))
				$atleastoneempty = sub_menusfilled('avifiletitle16mmspool');
			if ($atleastoneempty)
				$sysmsg += '<li class=error>Wenn Sie einen Men&uuml;eintrag individuell benennen, m&uuml;ssen Sie auch individuelle Titel f&uuml;r alle anderen Men&uuml;s eintragen.</li>';
		}
		return $sysmsg;
	}

	function formatnumber($subtotal, dec) {
		var x = Math.round($subtotal * Math.pow(10,dec));
		if (x >= 0) n1=n2='';
		var y = (''+Math.abs(x)).split('');
		var z = y.length - dec;
		if (z<0) z--;
		for(var i = z; i < 0; i++) 
			y.unshift('0');
		y.splice(z, 0, $decimalpoint);
		if(y[0] == $decimalpoint) y.unshift('0');

		while (z > 3) {
			z-=3;
			y.splice(z,0,$thousandsseparator);
		} 
		var r = y.join('');
		if (r.substr(r.length-1, 1) == $decimalpoint) {
			r = r.substr(0, r.length-1);
		}
		return r;
	}

	function ucusbtn() {
		if (($sysmsg != '') && (!($alloworder))) {
			$sysmsg2 = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul><p class=nb>Geben Sie bitte einfach die fehlenden Informationen ein. '+$localizedbusinessname+' zeigt Ihnen automatisch den &quot;Weiter &gt;&quot; Schalter, sobald alle n&ouml;tigen Infos eingetragen wurden.</p></td></tr></table>';
			document.getElementById('bs').innerHTML = $sysmsg2;
		} else {
			if (($alloworder) && ($sysmsg != '')) {
				$additionaladvice = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul></td></tr></table><p>&nbsp;</p>';
			} else {
				$additionaladvice = '';
			}
			document.getElementById('bs').innerHTML = '<p><img src="i/o/btn_weiter_0.gif" id=bsm width=79 height=36 onmouseover="uimg(\'bsm\',\'btn_weiter_1\')" onmouseout="uimg(\'bsm\',\'btn_weiter_0\')" onclick="uimg(\'bsm\',\'btn_weiter_2\');$hover=false;document.forms[\'ord\'].submit()">';
		}
	}

	function ufinbtn() {
		if ($sysmsg != '') {
			$visiblesysmsg = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul><p class=nb>'+unescape('Geben Sie bitte einfach die fehlenden Informationen ein. '+$localizedbusinessname+' zeigt Ihnen automatisch den &quot;Absenden!&quot; Schalter, sobald alle n&ouml;tigen Infos eingetragen wurden.')+'</p></td></tr></table>';
			document.getElementById('bs').innerHTML = $visiblesysmsg;
		} else {
			document.getElementById('bs').innerHTML = '<p><img src="i/o/btn_absenden_0.gif" id=bsm width=102 height=36 onmouseover="uimg(\'bsm\',\'btn_absenden_1\')" onmouseout="uimg(\'bsm\',\'btn_absenden_0\')" onclick="uimg(\'bsm\',\'btn_absenden_2\');$hover=false;document.forms[\'ord\'].submit()">';
		}
	}

	function ufwdbtn($isproforma) {
		if ((typeof ($isproforma) == 'undefined') || ($isproforma == '') || ($isproforma == false)) {
			if ($sysmsg != '') {
				document.getElementById('bs').innerHTML = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul><p class=nb>'+unescape('Geben Sie bitte einfach die fehlenden Informationen ein. '+$localizedbusinessname+' zeigt Ihnen automatisch den &quot;Weiter!&quot; Schalter, sobald alle n&ouml;tigen Infos eingetragen wurden.')+'</p></td></tr></table>';
			} else {
				document.getElementById('bs').innerHTML = '<p><img src="i/o/btn_weiter_0.gif" id=bsm width=79 height=36 onmouseover="uimg(\'bsm\',\'btn_weiter_1\')" onmouseout="uimg(\'bsm\',\'btn_weiter_0\')" onclick="uimg(\'bsm\',\'btn_weiter_2\');$hover=false;document.forms[\'ord\'].submit()">';
			}
		} else {
			if ($sysmsg != '') {
				document.getElementById('bs').innerHTML = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul><p class=nb>'+unescape('Geben Sie bitte einfach die fehlenden Informationen ein. '+$localizedbusinessname+' zeigt Ihnen automatisch den Gesamtpreis, sobald alle n&ouml;tigen Infos eingetragen wurden.')+'</p></td></tr></table>';
				document.forms['ord'].step.value = '0';
				document.forms['ord'].transaction.value = '';
				document.getElementById('orderbtn2').className = 'off';
			} else {
				document.getElementById('bs').innerHTML = '';
				document.forms['ord'].step.value = '2';
				document.forms['ord'].transaction.value = 'step3';
				document.getElementById('orderbtn2').className = 'on';
			}
		}
	}

	function ufwdbtnfilm() {
		if ($sysmsg != '') {
			document.getElementById('bs').innerHTML = '<table class=sysmsg><tr><td><ul>'+$sysmsg+'</ul><p class=nb>'+unescape('Geben Sie bitte einfach die fehlenden Informationen ein. '+$localizedbusinessname+' zeigt Ihnen automatisch den &quot;Weiter!&quot; Schalter, sobald alle n&ouml;tigen Infos eingetragen wurden.')+'</p></td></tr></table>';
		} else {
			document.getElementById('bs').innerHTML = '<p><img src="i/o/btn_weiter_0.gif" id=bsm width=79 height=36 onmouseover="uimg(\'bsm\',\'btn_weiter_1\')" onmouseout="uimg(\'bsm\',\'btn_weiter_0\')" onclick="uimg(\'bsm\',\'btn_weiter_2\');$hover=false;removeinvisibleoutputformats();document.forms[\'ord\'].submit()">';
		}
	}

	function printorder($clear) {
		if (!($contentwritten)) {
			parent.frames[0].document.open();
			parent.frames[0].document.write(unescape(document.forms['of'].of.value));
			parent.frames[0].document.close();
			$contentwritten = true;
		}
	}

	function setbusinessview() {
		if (document.forms['ord'].business.checked) {
			document.getElementById('businessfield').style.display = 'none';
		} else {
			document.getElementById('businessfield').style.display = '';
		}
	}

	function updatevat() {
		if (typeof document.forms['ord'].invoiceisocode == 'undefined') {
			$invoiceisocodeselectedindex = 0;
		} else {
			$invoiceisocodeselectedindex = document.forms['ord'].invoiceisocode.selectedIndex;
		}
		if ($invoiceisocodeselectedindex > -1) {
			$isocodeinvoice = document.forms['ord'].invoiceisocode[document.forms['ord'].invoiceisocode.selectedIndex].value;
			$invoicetoeucountry = 0;
			for (i=0;i<=$eucountries.length;i++) {
				if ($isocodeinvoice == $eucountries[i]) {
					$invoicetoeucountry = 1;
				}
			}
			if (typeof document.getElementById('business') != 'undefined') {
				if (($invoicetoeucountry == 1) && ($isocodeinvoice != 'DE') && (document.forms['ord'].business.checked == false)) {
					document.getElementById('vatid').style.display = '';
					document.getElementById('vatcountrycode').innerHTML = $isocodeinvoice+' &ndash; ';
				} else {
					document.getElementById('vatid').style.display = 'none';
					document.getElementById('vatcountrycode').innerHTML = '';
				}
			}
		}
	}

	function testordform3() {
		$sysmsg = '';
		if (document.getElementById('businessfield').style.display != 'none') {
			$test = document.forms['ord'].invoiceorganization.value.replace(/[\s]+/, '');
			if ($test.length < 3) {
				$sysmsg += '<li class=error>Bitte geben Sie den Namen Ihrer Firma oder Organisation ein. Falls Sie nicht f&uuml;r eine Firma oder Organisation bestellen, haken Sie bitte das K&auml;stchen &quot;Ich bestelle privat&quot; an.</li>';
			}
		}

		$test = document.forms['ord'].invoicefirstname.value.replace(/[\s]+/, '');
		if ($test.length < 2) {
			$sysmsg += '<li class=error>Bitte geben Sie Ihren Vornamen ein.</li>';
		}
		$test = document.forms['ord'].invoicelastname.value.replace(/[\s]+/, '');
		if ($test.length < 2) {
			$sysmsg += '<li class=error>Bitte geben Sie Ihren Nachnamen ein.</li>';
		}
		$test = document.forms['ord'].invoicestreet1.value.replace(/[\s0-9]+/, '');
		if ($test.length < 3) {
			$sysmsg += '<li class=error>Bitte geben Sie Ihre Stra&szlig;e &amp; Hausnummer ein.</li>';
		} else {
			$test = document.forms['ord'].invoicestreet1.value.replace(/[^0-9]+/, '');
			if ($test.length == 0) {
				$sysmsg += '<li class=error>Bitte erg&auml;nzen Sie Ihre Hausnummer.</li>';
			}
		}

		if (document.forms['ord'].invoiceisocode.selectedIndex > -1) {
			$minimumzipcodelength = getminimumzipcodelength(document.forms['ord'].invoiceisocode.options[document.forms['ord'].invoiceisocode.selectedIndex].value);
			if ($minimumzipcodelength != false) {
				$test = document.forms['ord'].invoicezipcode.value.replace(/[\s]+/, '');
				if ($test.length < $minimumzipcodelength) {
					$sysmsg += '<li class=error>Bitte geben Sie Ihre Postleitzahl ein (mindestens '+$minimumzipcodelength+'-stellig).</li>';
				}
			}
			$maximumzipcodelength = getmaximumzipcodelength(document.forms['ord'].invoiceisocode.options[document.forms['ord'].invoiceisocode.selectedIndex].value);
			if ($maximumzipcodelength != false) {
				$test = document.forms['ord'].invoicezipcode.value.replace(/[\s]+/, '');
				if ($test.length > $minimumzipcodelength) {
					$sysmsg += '<li class=error>Bitte geben Sie Ihre Postleitzahl ein (h&ouml;chstens '+$minimumzipcodelength+'-stellig).</li>';
				}
			}
		}

		$test = document.forms['ord'].invoicecity.value.replace(/[\s]+/, '');
		if ($test.length < 3) {
			$sysmsg += '<li class=error>Bitte geben Sie Ihren Ort ein.</li>';
		}
		$test = document.forms['ord'].invoicevatid.value.replace(/[\s]+/, '');
		$alloworder = false;
		if ((document.getElementById('vatid').style.display != 'none') && (document.getElementById('businessfield').style.display != 'none')) {
			if ($sysmsg == '') {
				$alloworder = true;
			}
			if ($test.length > 12) {
				$sysmsg += '<li class=error>Die EU USt-ID darf h&ouml;chstens 12 Zeichen lang sein. Sie k&ouml;nnen diese Bestellung auch ohne g&uuml;tige EU-USt ID absenden, aber falls Sie diese Bestellung ohne g&uuml;ltige EU-USt ID absenden, wird die deutsche Mehrwertsteuer berechnet.</li>';
			} else if ($test.length < 8) {
				$sysmsg += '<li class=error>Die EU USt-ID muss mindestens 8 Zeichen lang sein. Sie k&ouml;nnen diese Bestellung auch ohne g&uuml;tige EU-USt ID absenden, aber falls Sie diese Bestellung ohne g&uuml;ltige EU-USt ID absenden, wird die deutsche Mehrwertsteuer berechnet.</li>';
			}
		}
		if (validatemailserver(document.forms['ord'].invoiceemail.value, 'ucusbtn') == false) {
			$sysmsg += unescape('<li class="error">Bitte geben Sie eine g%FCltige e-Mail Adresse ein.</li>');
		}
		if (validatemailserver(document.forms['ord'].invoiceemail2.value, 'ucusbtn') == false) {
			$sysmsg += unescape('<li class="error">Bitte wiederholen Sie zur Sicherheit Ihre e-Mail Adresse.</li>');
		} else {
			if (document.forms['ord'].invoiceemail2.value != document.forms['ord'].invoiceemail.value) {
				$sysmsg += unescape('<li class="error">Die Wiederholung der e-Mail Adresse stimmt nicht mit dem Original &uuml;berein. Bitte schauen Sie nochmal ganz genau hin.</li>');
			}
		}
/*
		if (document.forms['ord'].invoicephone.value.length < 10) {
			$sysmsg += '<li class="error">'+unescape('Vorwahl+Telefonnummer m%FCssen zusammen mindestens 10 Stellen lang sein.')+'</li>';
		}
*/
		ucusbtn();	
	}

	function testordform3maxziplength(e) {
		var unicode=e.charCode? e.charCode : e.keyCode
		if ((unicode!=8) && (unicode!=9)) {
			if (document.forms['ord'].invoicezipcode.value.length >= getmaximumzipcodelength(document.forms['ord'].invoiceisocode.options[document.forms['ord'].invoiceisocode.selectedIndex].value)) {
				return false;
			}
		}
	}

	function testordform4() {
		$sysmsg = '';
		if (getCheckedValue(document.forms['ord'].logisticstype) == '2') {
			if (document.forms['ord'].pickupdate.value == '') {
				$sysmsg += '<li class=error>Bitte w&auml;hlen Sie ein Abholdatum.</li>';
			}
			$tmp = getnumericvalue(document.forms['ord'].noofpackages.value);
			if ($tmp == 0) {
				$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele Pakete bei Ihnen abholt werden sollen.</li>';
			}
		}

		if (getCheckedValue(document.forms['ord'].logisticstype) == '3') {
			document.forms['ord'].paymenttype[2].checked = true;
		} else if ((getCheckedValue(document.forms['ord'].logisticstype) != '3') && (getCheckedValue(document.forms['ord'].paymenttype) == '3')) {
			document.forms['ord'].paymenttype[0].checked = true;
		}
		
		if (getCheckedValue(document.forms['ord'].paymenttype) == '3') {
			document.forms['ord'].logisticstype[2].checked = true;
		}
	
		if (document.forms['ord'].agbakzeptiert.checked == false) {
			$sysmsg += '<li class=error>Sie m&uuml;ssen den AGB zustimmen, um den Auftrag absenden zu k&ouml;nnen. Um zuzustimmen, haken Sie bitte das K&auml;stchen vor dem AGB-Hinweis an.</li>';
		}
/*
		if (($human == '0') && (validatecaptcha(document.forms['ord'].captchacode.value, 'ufinbtn') == false)) {
			$sysmsg += '<li class=error>'+unescape('Der Spam-Schutz-Code muss genau vier Zeichen lang sein.')+'</li>';
		}
*/
		// #1891
		$specialproductmastername = eval("document.forms['ord'].specialproductmastername"+document.forms['ord'].productmastername.value);
		if (typeof $specialproductmastername != 'undefined') {
			document.forms['ord'].vouchercode.setAttribute('readonly', false, false);
			document.getElementById('stdcodenote').className = 'off';
			document.getElementById('spccodenote').className = 'on';
		} else {
			document.forms['ord'].vouchercode.removeAttribute('readonly', false);
		}

		ufinbtn();
	}

// Slides

	function setslidepage($mediatype, $isproforma) {
		document.getElementById('intro').style.display = 'none';
		var i=0;
		for (i=0;i<=3;i++) {
			document.getElementById('mediatype'+i).style.display = 'none';
			document.getElementById('mediatype'+i+'subtotal').style.display = 'none';
		}
		document.getElementById('invoiceaddresssection').style.display = 'none';
		document.getElementById('mediatype'+$mediatype).style.display = '';
		document.getElementById('mediatype'+$mediatype+'subtotal').style.display = '';
		document.getElementById('invoiceaddresssection').style.display = '';
		if (((typeof ($isproforma) == 'undefined') || ($isproforma == '') || ($isproforma == false)) && ($mediatype != '---')) {
			uimg('rimg', 'rimg_'+$mediatype);
		}
	}

	function testorddiaform1($isproforma) {
		$sysmsg = '';

		if ((typeof (document.forms['ord'].mediatype) != 'undefined') || ((!($isproforma)) && (document.forms['ord'].mediatype.options[document.forms['ord'].mediatype.selectedIndex].value != '---'))) {
			$tmp = 0;
			if (document.forms['ord'].mediatype.value != '---') {
				if (document.forms['ord'].mediatype.value == '0') {
					$tmp += getnumericvalue(document.forms['ord'].noofkleinbilddiamagaziniert.value);
					$tmp += getnumericvalue(document.forms['ord'].noofkleinbilddialose.value);
					$tmp += getnumericvalue(document.forms['ord'].noofkleinbilddiaungerahmt.value);
				} else if (document.forms['ord'].mediatype.value == '1') {
					$tmp += getnumericvalue(document.forms['ord'].noof6x6dia.value);
					$tmp += getnumericvalue(document.forms['ord'].noof6x7dia.value);
					$tmp += getnumericvalue(document.forms['ord'].noof6x9dia.value);
					$tmp += getnumericvalue(document.forms['ord'].noof9x12dia.value);
				} else if (document.forms['ord'].mediatype.value == '2') {
					$tmp += getnumericvalue(document.forms['ord'].noofnegativ.value);
				} else if (document.forms['ord'].mediatype.value == '3') {
					$tmp += getnumericvalue(document.forms['ord'].noofaps15.value);
					$tmp += getnumericvalue(document.forms['ord'].noofaps25.value);
					$tmp += getnumericvalue(document.forms['ord'].noofaps40.value);
				}
				if (($tmp == 0) && (document.forms['ord'].mediatype.value != '3')) {
					$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele Dias/Negative Sie digitalisiert haben m&ouml;chten.</li>';
				} else if (($tmp == 0) && (document.forms['ord'].mediatype.value == '3')) {
					$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele APS-Filme Sie digitalisiert haben m&ouml;chten.</li>';
				} else if ($tmp > $maxslidesperorder) {
					$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxslidesperorder, 0)+' Dias digitalisiert werden. Sie haben '+formatnumber($tmp, 0)+' Dias eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
				}

				if (document.forms['ord'].outputformat2[0].checked == true) {
					document.getElementById('slidecdbackup').className = 'on';
					if (document.forms['ord'].addslidecdbackups.checked == true) {
						$tmp = getnumericvalue(document.forms['ord'].noofbackups.value);
						if ($tmp == 0) 
							$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele DVD Kopien Sie m&ouml;chten.</li>';
					}
				} else
					document.getElementById('slidecdbackup').className = 'off';

				updatepricedia($isproforma);
				document.getElementById('output').className = 'on';
			} else {
				document.getElementById('output').className = 'off';
				$sysmsg += '<li class=error>Bitte w&auml;hlen Sie die Art der Dias, die Sie digitalisiert haben m&ouml;chten.</li>';
			}
		} else {
			$sysmsg += '<li class=error>Bitte w&auml;hlen Sie die Art der Dias, die Sie digitalisiert haben m&ouml;chten.</li>';
			document.getElementById('intro').style.display = '';
			document.getElementById('copies').className = 'off';
		}
		ufwdbtn($isproforma);
	}

	function testorddiaform2($isproforma) {
		if (typeof(document.forms['ord'].mediatype.options) != 'undefined') {
			$mediatype = document.forms['ord'].mediatype.options[document.forms['ord'].mediatype.selectedIndex].value;
		} else {
			$mediatype = document.forms['ord'].mediatype.value;
		}

		if ((($mediatype == '0') || ($mediatype == '1')) && (((document.forms['ord'].roc.checked) && ($mediatype == 0)) || ((document.forms['ord'].roc1.checked) && ($mediatype == '1')))) {
			document.forms['ord'].rocchecked.value = '1';
		} else {
			document.forms['ord'].rocchecked.value = '0';
		}

		if (($mediatype == '2') && (document.forms['ord'].singlenegative.checked) && ($mediatype == 2)) {
			document.forms['ord'].singlenegativechecked.value = '1';
		} else {
			document.forms['ord'].singlenegativechecked.value = '0';
		}

		if (($mediatype == '2') && (document.forms['ord'].negativesort.checked) && ($mediatype == 2)) {
			document.forms['ord'].negativesortchecked.value = '1';
		} else {
			document.forms['ord'].negativesortchecked.value = '0';
		}

		if ($mediatype == '0') {
			setcheckedstatefromcheckbox('fotoshow');
			setcheckedstatefromcheckbox('fotoshowxxl');
			setcheckedstatefromcheckbox('rahmung');
			setcheckedstatefromcheckbox('umrahmung');
			setcheckedstatefromcheckbox('dynamikplus');
			setcheckedstatefromcheckbox('tiff');
		} else if ($mediatype == '2') {
			document.forms['ord'].fotoshow.checked = document.forms['ord'].fotoshow2.checked;
			document.forms['ord'].fotoshowxxl.checked = document.forms['ord'].fotoshowxxl2.checked;
			document.forms['ord'].tiff.checked = document.forms['ord'].tiff2.checked;
			setcheckedstatefromcheckbox('fotoshow');
			setcheckedstatefromcheckbox('fotoshowxxl');
			setcheckedstatefromcheckbox('tiff');
		} else if ($mediatype == '3') {
			document.forms['ord'].fotoshow.checked = document.forms['ord'].fotoshow3.checked;
			document.forms['ord'].fotoshowxxl.checked = document.forms['ord'].fotoshowxxl3.checked;
			document.forms['ord'].tiff.checked = document.forms['ord'].tiff3.checked;
			setcheckedstatefromcheckbox('fotoshow');
			setcheckedstatefromcheckbox('fotoshowxxl');
			setcheckedstatefromcheckbox('tiff');
		}

		updatepricedia($isproforma);
		if ((typeof ($isproforma) == 'undefined') || ($isproforma == '') || ($isproforma == false)) {
			ufwdbtn();
		}
	}

	function updatepricedia($isproforma) {
		$qty = 0;
		$addon = '';
		$subtotal = 0;
		$maxslidesperfotoshow = 100;
		$maxslidesperfotoshowxxl = 500;
		$maxslidesperdvdeco = 2500;
		$maxslidesperdvdstandard = 750;
		$maxslidesperdvdtop = 350;

		if (typeof(document.forms['ord'].addslidecdbackups) != 'undefined') {
			if (document.forms['ord'].addslidecdbackups.checked) {
				$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
			} else {
				$noofbackups = 0;
			}
		} else {
			$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
		}

		if ((document.forms['ord'].step.value == '1') || ((typeof(document.forms['ord'].local) != 'undefined') && (document.forms['ord'].local.value == '1')) ) {
			if (document.forms['ord'].outputformat2[0].checked) {
				$outputformat2 = '0';
			} else {
				$outputformat2 = '1';
			}
		} else {
			$outputformat2 = document.forms['ord'].outputformat2.value;
		}

		if (document.forms['ord'].mediatype.value == '0') {
			$qty += getnumericvalue(document.forms['ord'].noofkleinbilddiamagaziniert.value);
			$qty += getnumericvalue(document.forms['ord'].noofkleinbilddialose.value);
			$qty += getnumericvalue(document.forms['ord'].noofkleinbilddiaungerahmt.value);

			if (($qty > 0) && ($qty <= $maxslidesperorder)) {
				setordershortversiondisplay('0', 1)

				if (typeof(document.forms['ord'].outputformat.options) != 'undefined') {
					$outputformat = document.forms['ord'].outputformat.options[document.forms['ord'].outputformat.selectedIndex].value;
				} else {
					$outputformat = document.forms['ord'].outputformat.value;
				}

				if ($qty < $minimumquantity) {
					$qty = $minimumquantity;
					$minimumqtynote = ' (Mindestmenge) ';
				} else {
					$minimumqtynote = ' ';
				}

				if (typeof(document.forms['ord'].quality.options) != 'undefined') {
					$qualityvalue = document.forms['ord'].quality.options[document.forms['ord'].quality.selectedIndex].value;
				} else {
					$qualityvalue = document.forms['ord'].quality.value;
				}
				if ($qualityvalue == '0') {
					$quality = 'standard';
					$qualityverbose = 'Standard';
				} else if ($qualityvalue == '2') {
					$quality = 'top';
					$qualityverbose = 'Top';
				} else {
					$quality = 'eco';
					$qualityverbose = 'Eco';
				}

				if ($qty >= eval('$minqtydiakleinbild' + $quality + 'stufe5')) {
					$unitprice = eval('$diakleinbild' + $quality + 'stufe5');
				} else if ($qty >= eval('$minqtydiakleinbild' + $quality + 'stufe4')) {
					$unitprice = eval('$diakleinbild' + $quality + 'stufe4');
				} else if ($qty >= eval('$minqtydiakleinbild' + $quality + 'stufe3')) {
					$unitprice = eval('$diakleinbild' + $quality + 'stufe3');
				} else if ($qty >= eval('$minqtydiakleinbild' + $quality + 'stufe2')) {
					$unitprice = eval('$diakleinbild' + $quality + 'stufe2');
				} else {
					$unitprice = eval('$diakleinbild' + $quality + 'stufe1');
				}
				$lowestprice = $unitprice;
				$mediatype = 'Dia';
				$nur = 'Nur';

				if (document.forms['ord'].rocchecked.value == '1') {
					$unitprice += $diakleinbildroc;
					$addon += '<br><br>Inklusive ROC ('+formatnumber($diakleinbildroc, 2)+'&nbsp;'+$currencysymbol+' je Dia)';
				}

				$subtotal = $unitprice * $qty;

				if (document.forms['ord'].fotoshowchecked.value == '1') {
					if ($qty > 0) {
						$fotoshowsubtotal = $fotoshow * Math.ceil($qty/$maxslidesperfotoshow);
						$addon += '<br><br>zzgl. Fotoshow-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}
				if (document.forms['ord'].fotoshowxxlchecked.value == '1') {
					if ($qty > 0) {
						$fotoshowsubtotal = $fotoshowxxl * Math.ceil($qty/$maxslidesperfotoshowxxl);
						$addon += '<br><br>zzgl. Fotoshow-XXL-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}

				$tmp = getnumericvalue(document.forms['ord'].noofkleinbilddiaungerahmt.value);
				if ($tmp > 0) {
					if (document.forms['ord'].step.value == '1') {
						document.getElementById('rahmungnote').style.display = '';
					}
					$rahmungsubtotal = $diakleinbildrahmung * $tmp;
					$addon += '<br><br>zzgl. Rahmung '+document.forms['ord'].noofkleinbilddiaungerahmt.value+' ungerahmter Dias, nur '+formatnumber($rahmungsubtotal, 2)+'&nbsp;'+$currencysymbol;
					$subtotal += $rahmungsubtotal;
				} else if (document.forms['ord'].step.value == '1') {
					document.getElementById('rahmungnote').style.display = 'none';
				}

				if (document.forms['ord'].umrahmungchecked.value == '1') {
					$tmp = 0;
					$tmp += getnumericvalue(document.forms['ord'].noofkleinbilddialose.value);
					$tmp += getnumericvalue(document.forms['ord'].noofkleinbilddiamagaziniert.value);
					if ($tmp > 0) {
						$umrahmungsubtotal = $diakleinbildumrahmung * $tmp;
						$addon += '<br><br>zzgl. Entglasung, Reinigung und Neurahmung '+$tmp+' gerahmter Dias, nur '+formatnumber($umrahmungsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $umrahmungsubtotal;
					}
				}

				if ((($quality == 'standard') || ($quality == 'top')) && (document.forms['ord'].dynamikpluschecked.value == '1')) {
					if ($qty > 0) {
						$dynamikplussubtotal = $diakleinbilddynamikplus * $qty;
						$addon += '<br><br>zzgl. &quot;Dynamik+&quot;, nur '+formatnumber($dynamikplussubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $dynamikplussubtotal;
					}
				}

				if ((($quality == 'standard') || ($quality == 'top')) && (document.forms['ord'].tiffchecked.value == '1')) {
					if ($qty > 0) {
						$tiffsubtotal = $diakleinbildtiff * $qty;
						$addon += '<br><br>zzgl. TIFF Ausgabe statt JPEG, nur '+formatnumber($tiffsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $tiffsubtotal;
					}
					$addon += '<br><br>Da TIFF-Dateien bis zu ca. 20 MB gro&szlig; werden k&ouml;nnen, k&ouml;nnen die Dia-Scans nur auf einer externen Festplatte gespeichert werden, die ich mit einsende. Ich spare dadurch die Datentr&auml;ger-Kosten f&uuml;r DVDs.';
				} else {
					if ($outputformat2 == '0') {
						if ($quality == 'standard') {
							$maxslidesperdvd = $maxslidesperdvdstandard;
						} else if ($quality == 'top') {
							$maxslidesperdvd = $maxslidesperdvdtop;
						} else {
							$maxslidesperdvd = $maxslidesperdvdeco;
						}
						$noofdvds = Math.ceil($qty/$maxslidesperdvd);
						$dvdsubtotal = $dvd * $noofdvds;
						$subtotal += $dvdsubtotal;
						if ($noofdvds == 1) {
							$addon += '<br><br>zzgl. voraussichtlich 1 DVD f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
						} else {
							$addon += '<br><br>zzgl. voraussichtlich '+formatnumber($noofdvds, 0)+' DVDs f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
						}
						$addon += '.';

						if ($noofbackups > 0) {
							if (typeof $noofdvds == 'undefined') {
								$noofdvds = 1;
							}
							$pricecopies = $dvd * $noofdvds * $noofbackups;
							$subtotal += $pricecopies;
							if ($noofbackups == 1) {
								$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							} else {
								$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							}
						}						
					} else {
						$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
					}	
				}

				document.getElementById('qualityverbose').innerHTML = $qualityverbose;
				document.getElementById('noofslides').innerHTML = formatnumber($qty, 0) + $minimumqtynote;
				document.getElementById('priceperslide').innerHTML = formatnumber($unitprice, 2);
				document.getElementById('addon').innerHTML = $addon;
				document.getElementById('subtotal').innerHTML = formatnumber($subtotal, 2);
			} else {
				setordershortversiondisplay('0', 0)
				if (document.forms['ord'].step.value == '1') {
					document.getElementById('rahmungnote').style.display = 'none';
				}
			}
		} else if (document.forms['ord'].mediatype.value == '1') {
			$qty6x6 = getnumericvalue(document.forms['ord'].noof6x6dia.value);
			$qty += $qty6x6;
			$qty6x7 = getnumericvalue(document.forms['ord'].noof6x7dia.value);
			$qty += $qty6x7;
			$qty6x9 = getnumericvalue(document.forms['ord'].noof6x9dia.value);
			$qty += $qty6x9;
			$qty9x12 = getnumericvalue(document.forms['ord'].noof9x12dia.value);
			$qty += $qty9x12;
			if (($qty > 0) && ($qty <= $maxslidesperorder)) {
				setordershortversiondisplay('1', 1)

				if (typeof(document.forms['ord'].outputformat.options) != 'undefined') {
					$outputformat = document.forms['ord'].outputformat.options[document.forms['ord'].outputformat.selectedIndex].value;
				} else {
					$outputformat = document.forms['ord'].outputformat.value;
				}
				if ($outputformat == '0') {
					$outputformatverbose = 'TIFF';
					$outputtmp = 'tiff';
					if ($qty > 1) {
						$addon = 'Es sollen insgesamt '+formatnumber($qty, 0)+' Mittel- bzw. Gro&szlig;formatdias gescannt und als '+$outputformatverbose+' gespeichert werden.';
					} else {
						$addon = 'Es soll ein Mittel- bzw. Gro&szlig;formatdias gescannt und als '+$outputformatverbose+' gespeichert werden.';
					}
					$addon += ' Da '+$outputformatverbose+' Dateien sehr gro&szlig; sind, k&ouml;nnen die Dia-Scans nur auf einer externen Festplatte gespeichert werden, die ich mit einsende. Ich spare dadurch die Datentr&auml;ger-Kosten f&uuml;r DVDs.';
				} else {
					$outputformatverbose = 'JPEG';
					$outputtmp = 'jpg';
					if ($qty > 1) {
						$addon = 'Es sollen insgesamt '+formatnumber($qty, 0)+' Mittel- bzw. Gro&szlig;formatdias gescannt und als '+$outputformatverbose+' auf DVD gespeichert werden:';
					} else {
						$addon = 'Es soll ein Mittel- bzw. Gro&szlig;formatdias gescannt und als '+$outputformatverbose+' auf DVD gespeichert werden:';
					}
				}

				$lowestprice = 99999999;
				$noofdifferentsizes = 0;
				if ($qty6x6 > 0) {
					$noofdifferentsizes++;
					$tmp = eval('$diamittelformat6x6'+$outputtmp);
					$mf6x6subtotal = $qty6x6 * $tmp;
					$subtotal += $mf6x6subtotal;
					$plural = getplural($qty6x6);
					$addon += '<br><br>'+formatnumber($qty6x6, 0)+' Dia'+$plural[2]+' bis 6x6 cm<br>&agrave; nur '+formatnumber($tmp, 2)+'&nbsp;'+$currencysymbol+'/Dia = '+formatnumber($mf6x6subtotal, 2)+'&nbsp;'+$currencysymbol;
					if ($tmp < $lowestprice) {
						$lowestprice = $tmp;
					}
				}
				if ($qty6x7 > 0) {
					$noofdifferentsizes++;
					$tmp = eval('$diamittelformat6x7'+$outputtmp);
					$mf6x7subtotal = $qty6x7 * $tmp;
					$subtotal += $mf6x7subtotal;
					$plural = getplural($qty6x7);
					$addon += '<br><br>'+formatnumber($qty6x7, 0)+' Dia'+$plural[2]+' bis 6x7 cm<br>&agrave; nur '+formatnumber($tmp, 2)+'&nbsp;'+$currencysymbol+'/Dia = '+formatnumber($mf6x7subtotal, 2)+'&nbsp;'+$currencysymbol;
					if ($tmp < $lowestprice) {
						$lowestprice = $tmp;
					}
				}
				if ($qty6x9 > 0) {
					$noofdifferentsizes++;
					$tmp = eval('$diamittelformat6x9'+$outputtmp)
					$mf6x9subtotal = $qty6x9 * $tmp;
					$subtotal += $mf6x9subtotal;
					$plural = getplural($qty6x9);
					$addon += '<br><br>'+formatnumber($qty6x9, 0)+' Dia'+$plural[2]+' bis 6x9 cm<br>&agrave; nur '+formatnumber($tmp, 2)+'&nbsp;'+$currencysymbol+'/Dia = '+formatnumber($mf6x9subtotal, 2)+'&nbsp;'+$currencysymbol;
					if ($tmp < $lowestprice) {
						$lowestprice = $tmp;
					}
				}
				if ($qty9x12 > 0) {
					$noofdifferentsizes++;
					$tmp = eval('$diamittelformat9x12'+$outputtmp);
					$mf9x12subtotal = $qty9x12 * $tmp;
					$subtotal += $mf9x12subtotal;
					$plural = getplural($qty9x12);
					$addon += '<br><br>'+formatnumber($qty9x12, 0)+' Dia'+$plural[2]+' bis 9x12 cm<br>&agrave; nur '+formatnumber($tmp, 2)+'&nbsp;'+$currencysymbol+'/Dia = '+formatnumber($mf9x12subtotal, 2)+'&nbsp;'+$currencysymbol;
					if ($tmp < $lowestprice) {
						$lowestprice = $tmp;
					}
				}
				$mediatype = 'Dia';

				if ($noofdifferentsizes > 1) {
					$nur = 'Ab nur';
				} else {
					$nur = 'Nur';
				}


				if ($subtotal < $diamittelformatmindestpreis) {
					$subtotal = $diamittelformatmindestpreis;
					document.getElementById('minimumprice').innerHTML = '&nbsp;(basiert auf dem Mindestpreis f&uuml;r Mittel- und Gro&szlig;format-Dia-Scans in H&ouml;he von '+formatnumber($diamittelformatmindestpreis, 2)+'&nbsp;'+$currencysymbol+')';
				} else {
					document.getElementById('minimumprice').innerHTML = '';
				}

				if (document.forms['ord'].rocchecked.value == '1') {
					$rocsubtotal = $qty * $diamittelformatroc;
					$subtotal += $rocsubtotal;
					$addon += '<br><br>zzgl. ROC ('+formatnumber($diamittelformatroc, 2)+'&nbsp;'+$currencysymbol+'/Dia)<br>= '+formatnumber($rocsubtotal, 2)+'&nbsp;'+$currencysymbol;;
				}

				if ($outputformat2 == '0') {
					$maxslidesperdvd = $maxslidesperdvdtop;
					$noofdvds = Math.ceil($qty/$maxslidesperdvd);
					$dvdsubtotal = $dvd * $noofdvds;
					$subtotal += $dvdsubtotal;

					$plural = getplural($noofdvds);
					$addon += '<br><br>zzgl. voraussichtlich '+formatnumber($noofdvds, 0)+' DVD'+$plural[2]+' f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
					$addon += '.';
					
					if ($noofbackups > 0) {
						if (typeof $noofdvds == 'undefined') {
							$noofdvds = 1;
						}
						$pricecopies = $dvd * $noofdvds * $noofbackups;
						$subtotal += $pricecopies;
						if ($noofbackups == 1) {
							$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
						} else {
							$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
						}
					}					
				} else {
					$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
					$noofdvds = 0;
				}
				
				document.getElementById('subtotal1').innerHTML = formatnumber($subtotal, 2);
				document.getElementById('addon1').innerHTML = $addon;
			} else {
				setordershortversiondisplay('1', 0)
			}
		} else if (document.forms['ord'].mediatype.value == '2') {
			$qty += getnumericvalue(document.forms['ord'].noofnegativ.value);
			if (($qty > 0) && ($qty <= $maxslidesperorder)) {
				setordershortversiondisplay('2', 1);

				if (typeof(document.forms['ord'].outputformat.options) != 'undefined') {
					$outputformat = document.forms['ord'].outputformat.options[document.forms['ord'].outputformat.selectedIndex].value;
				} else {
					$outputformat = document.forms['ord'].outputformat.value;
				}

				if ($qty < $minimumquantity) {
					$qty = $minimumquantity;
					$minimumqtynote = ' (Mindestmenge) ';
				} else {
					$minimumqtynote = ' ';
				}

				if (typeof(document.forms['ord'].quality2.options) != 'undefined') {
					$qualityvalue = document.forms['ord'].quality2.options[document.forms['ord'].quality2.selectedIndex].value;
				} else {
					$qualityvalue = document.forms['ord'].quality2.value;
				}
				if ($qualityvalue == '0') {
					$quality = 'standard';
					$qualityverbose = 'Standard';
				} else if ($qualityvalue == '2') {
					$quality = 'top';
					$qualityverbose = 'Top';
				} else {
					$quality = 'eco';
					$qualityverbose = 'Eco';
				}

				if ($qty >= eval('$minqtynegativkleinbild' + $quality + 'stufe5')) {
					$unitprice = eval('$negativkleinbild' + $quality + 'stufe5');
				} else if ($qty >= eval('$minqtynegativkleinbild' + $quality + 'stufe4')) {
					$unitprice = eval('$negativkleinbild' + $quality + 'stufe4');
				} else if ($qty >= eval('$minqtynegativkleinbild' + $quality + 'stufe3')) {
					$unitprice = eval('$negativkleinbild' + $quality + 'stufe3');
				} else if ($qty >= eval('$minqtynegativkleinbild' + $quality + 'stufe2')) {
					$unitprice = eval('$negativkleinbild' + $quality + 'stufe2');
				} else {
					$unitprice = eval('$negativkleinbild' + $quality + 'stufe1');
				}
				$lowestprice = $unitprice;
				$mediatype = 'Negativ oder Dia';
				$nur = 'Nur';

				$doubleunitprice = 2*$unitprice;
				if (document.forms['ord'].step.value == '2') {
					document.getElementById('doublepricenegative').innerHTML = formatnumber($doubleunitprice, 2)+'&nbsp;'+$currencysymbol;
				}

				if (document.forms['ord'].singlenegativechecked.value == '1') {
					$addon += '<br><br>Der Auftrag enth&auml;t u.a. Filmstreifen mit weniger als drei Bildern. Diese sollen ebenfalls gescannt werden zum Preis von '+formatnumber($doubleunitprice, 2)+'&nbsp;'+$currencysymbol+' je Negativ. Jener Aufpreis ist im unten angegebenen Gesamtpreis noch nicht enthalten.';
				}				

				if (document.forms['ord'].negativesortchecked.value == '1') {
					$addon += '<br><br>Ich akzeptiere, dass '+$localizedbusinessname+' aufgrund erh&ouml;hten Bearbeitungsaufwands bei Einsendung der Negative in A4-Archivbl&auml;ttern oder &auml;hnlichen Einzelaufbewahrungen einen Aufpreis von '+formatnumber($negativesortprice, 2)+'&nbsp;'+$currencysymbol+' je Blatt/Tasche erhebt. Mir ist bekannt, dass die gescannten Negative nicht in diese Bl&auml;tter/Taschen zur&uuml;cksortiert werden. (Tipp: Senden Sie die Negative in den originalen Fototaschen ein oder sortieren Sie diese zum Beispiel in Briefumschl&auml;ge, um eine leichte Entnahme zu erm&ouml;glichen.)';
				}

				$subtotal = $unitprice * $qty;

				if (document.forms['ord'].fotoshowchecked.value == '1') {
					if ($qty > 0) {
						$fotoshowsubtotal = $fotoshow * Math.ceil($qty/$maxslidesperfotoshow);
						$addon += '<br><br>zzgl. Fotoshow-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}
				if (document.forms['ord'].fotoshowxxlchecked.value == '1') {
					if ($qty > 0) {
						$fotoshowsubtotal = $fotoshowxxl * Math.ceil($qty/$maxslidesperfotoshowxxl);
						$addon += '<br><br>zzgl. Fotoshow-XXL-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}

				if ((($quality == 'standard') || ($quality == 'top')) && (document.forms['ord'].tiffchecked.value == '1')) {
					if ($qty > 0) {
						$tiffsubtotal = $diakleinbildtiff * $qty;
						$addon += '<br><br>zzgl. TIFF Ausgabe statt JPEG, nur '+formatnumber($tiffsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $tiffsubtotal;
					}
					$addon += '<br><br>Da TIFF-Dateien bis zu ca. 20 MB gro&szlig; werden k&ouml;nnen, k&ouml;nnen die Filmstreifen-Scans nur auf einer externen Festplatte gespeichert werden, die ich mit einsende. Ich spare dadurch die Datentr&auml;ger-Kosten f&uuml;r DVDs.';
				} else {
					if ($quality == 'standard') {
						$maxslidesperdvd = $maxslidesperdvdstandard;
					} else if ($quality == 'top') {
						$maxslidesperdvd = $maxslidesperdvdtop;
					} else {
						$maxslidesperdvd = $maxslidesperdvdeco;
					}

					if ($outputformat2 == '0') {
						$noofdvds = Math.ceil($qty/$maxslidesperdvd);
						$dvdsubtotal = $dvd * $noofdvds;
						$subtotal += $dvdsubtotal;

						$plural = getplural($noofdvds);
						$addon += '<br><br>zzgl. voraussichtlich '+formatnumber($noofdvds, 0)+' DVD'+$plural[2]+' f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$addon += '.';

						if ($noofbackups > 0) {
							if (typeof $noofdvds == 'undefined') {
								$noofdvds = 1;
							}
							$pricecopies = $dvd * $noofdvds * $noofbackups;
							$subtotal += $pricecopies;
							if ($noofbackups == 1) {
								$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							} else {
								$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							}
						}
					} else {
						$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
					}
				}

				document.getElementById('qualityverbose2').innerHTML = $qualityverbose;
				document.getElementById('noofslides2').innerHTML = formatnumber($qty, 0) + $minimumqtynote;
				document.getElementById('priceperslide2').innerHTML = formatnumber($unitprice, 2);
				document.getElementById('subtotal2').innerHTML = formatnumber($subtotal, 2);
				document.getElementById('addon2').innerHTML = $addon;

			} else {
				setordershortversiondisplay('2', 0)
			}
		} else if (document.forms['ord'].mediatype.value == '3') {

			$qty15 = getnumericvalue(document.forms['ord'].noofaps15.value);
			$qty25 = getnumericvalue(document.forms['ord'].noofaps25.value);
			$qty40 = getnumericvalue(document.forms['ord'].noofaps40.value);
			$qty += $qty15+$qty25+$qty40;

			if (($qty > 0) && ($qty <= $maxslidesperorder)) {
				setordershortversiondisplay('3', 1);

				if (typeof(document.forms['ord'].outputformat.options) != 'undefined') {
					$outputformat = document.forms['ord'].outputformat.options[document.forms['ord'].outputformat.selectedIndex].value;
				} else {
					$outputformat = document.forms['ord'].outputformat.value;
				}

				if (typeof(document.forms['ord'].quality3.options) != 'undefined') {
					$qualityvalue = document.forms['ord'].quality3.options[document.forms['ord'].quality3.selectedIndex].value;
				} else {
					$qualityvalue = document.forms['ord'].quality3.value;
				}
				$lowestprice = 999999999;
				$noofdifferentsizes = 0;
				if ($qualityvalue == '0') {
					$quality = 'standard';
					$qualityverbose = 'Standard';
					$subtotal = $diaaps15standard * $qty15 + $diaaps25standard * $qty25 + $diaaps40standard * $qty40;
					$qtytmp = (15*$qty15	+ 25*$qty25 + 40*$qty40)*2;

					if (($qty15 > 0) && ($diaaps15standard < $lowestprice)) {
						$lowestprice = $diaaps15standard;
					}
					if (($qty25 > 0) && ($diaaps25standard < $lowestprice)) {
						$lowestprice = $diaaps25standard;
					}
					if (($qty40 > 0) && ($diaaps40standard < $lowestprice)) {
						$lowestprice = $diaaps40standard;
					}

				} else if ($qualityvalue == '2') {
					$quality = 'top';
					$qualityverbose = 'Top';
					$subtotal = $diaaps15top * $qty15 + $diaaps25top * $qty25 + $diaaps40top * $qty40;
					$qtytmp = (15*$qty15	+ 25*$qty25 + 40*$qty40)*3;
					if (($qty15 > 0) && ($diaaps15top < $lowestprice)) {
						$lowestprice = $diaaps15top;
					}
					if (($qty25 > 0) && ($diaaps25top < $lowestprice)) {
						$lowestprice = $diaaps25top;
					}
					if (($qty40 > 0) && ($diaaps40top < $lowestprice)) {
						$lowestprice = $diaaps40top;
					}

				} else {
					$quality = 'eco';
					$qualityverbose = 'Eco';
					$subtotal = $diaaps15eco * $qty15 + $diaaps25eco * $qty25 + $diaaps40eco * $qty40;
					$qualityfactor = '1';
					$qtytmp = 15*$qty15	+ 25*$qty25 + 40*$qty40;
					if (($qty15 > 0) && ($diaaps15eco < $lowestprice)) {
						$lowestprice = $diaaps15eco;
					}
					if (($qty25 > 0) && ($diaaps25eco < $lowestprice)) {
						$lowestprice = $diaaps25eco;
					}
					if (($qty40 > 0) && ($diaaps40eco < $lowestprice)) {
						$lowestprice = $diaaps40eco;
					}
				}
				if ($qty15 > 0) {
					$noofdifferentsizes++;
				}
				if ($qty25 > 0) {
					$noofdifferentsizes++;
				}
				if ($qty40 > 0) {
					$noofdifferentsizes++;
				}

				$mediatype = 'Film';
				if ($noofdifferentsizes > 1) {
					$nur = 'Ab nur';
				} else {
					$nur = 'Nur';
				}

				if (document.forms['ord'].fotoshowchecked.value == '1') {
					if (($qty15 > 0) || ($qty25 > 0) || ($qty40 > 0)) {
						$fotoshowsubtotal = $fotoshow * Math.ceil($qty/$maxslidesperfotoshow);
						$addon += '<br><br>zzgl. Fotoshow-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}
				if (document.forms['ord'].fotoshowxxlchecked.value == '1') {
					if (($qty15 > 0) || ($qty25 > 0) || ($qty40 > 0)) {
						$fotoshowsubtotal = $fotoshowxxl * Math.ceil($qty/$maxslidesperfotoshowxxl);
						$addon += '<br><br>zzgl. Fotoshow-XXL-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $fotoshowsubtotal;
					}
				}

				if ((($quality == 'standard') || ($quality == 'top')) && (document.forms['ord'].tiffchecked.value == '1')) {
					if (($qty15 > 0) || ($qty25 > 0) || ($qty40 > 0)) {
						$tiffsubtotal = $diakleinbildtiff * (15*$qty15+25*$qty25+40*$qty40);
						$addon += '<br><br>zzgl. TIFF Ausgabe statt JPEG, nur '+formatnumber($tiffsubtotal, 2)+'&nbsp;'+$currencysymbol;
						$subtotal += $tiffsubtotal;
					}
					$addon += '<br><br>Da TIFF-Dateien bis zu ca. 20 MB gro&szlig; werden k&ouml;nnen, k&ouml;nnen die APS-Scans nur auf einer externen Festplatte gespeichert werden, die ich mit einsende. Ich spare dadurch die Datentr&auml;ger-Kosten f&uuml;r DVDs.';
				} else {
					if ($outputformat2 == '0') {

						if ($quality == 'standard') {
							$maxslidesperdvd = $maxslidesperdvdstandard;
						} else if ($quality == 'top') {
							$maxslidesperdvd = $maxslidesperdvdtop;
						} else {
							$maxslidesperdvd = $maxslidesperdvdeco;
						}
						$noofdvds = Math.ceil($qtytmp/$maxslidesperdvd);

						$dvdsubtotal = $dvd * $noofdvds;
						$subtotal += $dvdsubtotal;
						if ($noofdvds == 1) {
							$addon += '<br><br>zzgl. voraussichtlich 1 DVD f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
						} else {
							$addon += '<br><br>zzgl. voraussichtlich '+formatnumber($noofdvds, 0)+' DVDs f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
						}
						$addon += '.';
						if ($noofbackups > 0) {
							if (typeof $noofdvds == 'undefined') {
								$noofdvds = 1;
							}
							$pricecopies = $dvd * $noofdvds * $noofbackups;
							$subtotal += $pricecopies;
							if ($noofbackups == 1) {
								$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							} else {
								$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
							}
						}
					} else {
						$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
					}
				}

				document.getElementById('qualityverbose3').innerHTML = $qualityverbose;
				document.getElementById('nooffilms').innerHTML = formatnumber($qty, 0);
				document.getElementById('addon3').innerHTML = $addon;
				document.getElementById('subtotal3').innerHTML = formatnumber($subtotal, 2);
			} else 
				setordershortversiondisplay('3', 0)
		}
		if ($isproforma) {
			document.getElementById('invoiceaddresssection').innerHTML = '<p>&nbsp;</p><h2>Ihr individueller Preis: '+$nur+' '+formatnumber($lowestprice, 2)+' '+$currencysymbol+' je '+$mediatype+'!<br><span class=second>= alles zusammen nur '+formatnumber($subtotal, 2)+' '+$currencysymbol+' zzgl. Verpackung &amp; Versand</span></h2>';
		}
	}


// Photo

	function testordfotoboxform1() {
		$sysmsg = '';
		$tmp = 0;
		$tmp += getnumericvalue(document.forms['ord'].nooffotobox10x15.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele Einheiten zu je 100 Fotos Sie digitalisiert haben m&ouml;chten (wenn Sie z.B. &quot;2&quot; eintragen, k&ouml;nnen Sie damit bis zu 200 Fotos digitalisieren lassen).</li>';
		} else if ($tmp > ($maxphotosperorder/100)) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxphotosperorder, 0)+' Fotos digitalisiert werden. Sie haben '+formatnumber($tmp*100, 0)+' Fotos eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}
		
		if (document.forms['ord'].outputformat2[0].checked == true) {
			document.getElementById('fotocdbackup').className = 'on';
			if (document.forms['ord'].addfotocdbackups.checked == true) {
				$tmp = getnumericvalue(document.forms['ord'].noofbackups.value);
				if ($tmp == 0) 
					$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele DVD Kopien Sie m&ouml;chten.</li>';
			}
		} else
			document.getElementById('fotocdbackup').className = 'off';
		
		updatepricefotobox();
		ufwdbtn();
	}


	function testordfotoform1() {
		$sysmsg = '';
		$tmp = 0;
		$tmp += getnumericvalue(document.forms['ord'].nooffoto10x15.value);
		$tmp += getnumericvalue(document.forms['ord'].nooffoto20x30.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele Fotos Sie digitalisiert haben m&ouml;chten.</li>';
		} else if ($tmp > $maxphotosperorder) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxphotosperorder, 0)+' Fotos digitalisiert werden. Sie haben '+formatnumber($tmp, 0)+' Fotos eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}
		
		if (document.forms['ord'].outputformat2[0].checked == true) {
			document.getElementById('fotocdbackup').className = 'on';
			if (document.forms['ord'].addfotocdbackups.checked == true) {
				$tmp = getnumericvalue(document.forms['ord'].noofbackups.value);
				if ($tmp == 0) 
					$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele DVD Kopien Sie m&ouml;chten.</li>';
			}
		} else
			document.getElementById('fotocdbackup').className = 'off';
		
		updatepricefoto();
		ufwdbtn();
	}

	function testordfotoboxform2() {
		setcheckedstatefromcheckbox('fotoshow');
		setcheckedstatefromcheckbox('fotoshowxxl');
		updatepricefotobox();
		ufwdbtn();
	}

	function testordfotoform2() {
		setcheckedstatefromcheckbox('fotoshow');
		setcheckedstatefromcheckbox('fotoshowxxl');
		updatepricefoto();
		ufwdbtn();
	}

	function ucfirst(str) {
		var f = str.charAt(0).toUpperCase();
		return f + str.substr(1);
	}

	function updatepricefoto() {
		$qty = 0;
		$addon = '';
		$subtotal = 0;
		$maxphotosperfotoshow = 100;
		$maxphotosperfotoshowxxl = 500;
		$maxphotosperdvd = 750;

		if (typeof(document.forms['ord'].addfotocdbackups) != 'undefined') {
			if (document.forms['ord'].addfotocdbackups.checked) {
				$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
			} else {
				$noofbackups = 0;
			}
		} else {
			$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
		}

		if ((document.forms['ord'].step.value == '1') || ((typeof(document.forms['ord'].local) != 'undefined') && (document.forms['ord'].local.value == '1')) ) {
			if (document.forms['ord'].outputformat2[0].checked) {
				$outputformat2 = '0';
			} else {
				$outputformat2 = '1';
			}
		} else {
			$outputformat2 = document.forms['ord'].outputformat2.value;
		}

		if (document.forms['ord'].step.value == '1') {
			$quality = document.forms['ord'].quality.options[document.forms['ord'].quality.selectedIndex].value;
		} else {
			$quality = document.forms['ord'].quality.value;
		}

		$qty10x15 = getnumericvalue(document.forms['ord'].nooffoto10x15.value);
		$qty += $qty10x15;	
		$qty20x30 = getnumericvalue(document.forms['ord'].nooffoto20x30.value);
		$qty += $qty20x30;

		if (($qty > 0) && ($qty <= $maxphotosperorder)) {
			setordershortversiondisplay('0', 1)
			if ($qty10x15 > 0) {
				if ($qty10x15 >= eval("$minqtyfoto"+$quality+"10x15stufe4")) {
					$unitprice10x15 = eval("$foto"+$quality+"10x15stufe4");
				} else if ($qty10x15 >= eval("$minqtyfoto"+$quality+"10x15stufe3")) {
					$unitprice10x15 = eval("$foto"+$quality+"10x15stufe3");
				} else if ($qty10x15 >= eval("$minqtyfoto"+$quality+"10x15stufe2")) {
					$unitprice10x15 = eval("$foto"+$quality+"10x15stufe2");
				} else {
					$unitprice10x15 = eval("$foto"+$quality+"10x15stufe1");
				}
				$subtotal10x15 = $qty10x15 * $unitprice10x15;
				$plural = getplural($qty10x15);
				$addon += '<br><br>'+formatnumber($qty10x15, 0)+' Foto'+$plural[2]+' bis zu 10x15 cm in '+ucfirst($quality)+'-Qualit&auml;t &agrave;&nbsp;'+formatnumber($unitprice10x15, 2)+'&nbsp;'+$currencysymbol+' = '+formatnumber($subtotal10x15, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $subtotal10x15;
			}
			if ($qty20x30 > 0) {
				if ($qty20x30 >= eval("$minqtyfoto"+$quality+"20x30stufe4")) {
					$unitprice20x30 = eval("$foto"+$quality+"20x30stufe4");
				} else if ($qty20x30 >= eval("$minqtyfoto"+$quality+"20x30stufe3")) {
					$unitprice20x30 = eval("$foto"+$quality+"20x30stufe3");
				} else if ($qty20x30 >= eval("$minqtyfoto"+$quality+"20x30stufe2")) {
					$unitprice20x30 = eval("$foto"+$quality+"20x30stufe2");
				} else {
					$unitprice20x30 = eval("$foto"+$quality+"20x30stufe1");
				}
				$subtotal20x30 = $qty20x30 * $unitprice20x30;
				$plural = getplural($qty20x30);
				$addon += '<br><br>'+formatnumber($qty20x30, 0)+' Foto'+$plural[2]+' bis zu DIN A4 in '+ucfirst($quality)+'-Qualit&auml;t &agrave;&nbsp;'+formatnumber($unitprice20x30, 2)+'&nbsp;'+$currencysymbol+' = '+formatnumber($subtotal20x30, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $subtotal20x30;
			}

			if ($subtotal < $mindestpreis) {
				$subtotal = $mindestpreis;
				$minimumpricenote = '&nbsp;(basiert auf dem Mindestpreis f&uuml;r Foto-Scans in H&ouml;he von '+formatnumber($mindestpreis, 2)+'&nbsp;'+$currencysymbol+')';
			} else {
				$minimumpricenote = '';
			}

			if (document.forms['ord'].fotoshowchecked.value == '1') {
				$fotoshowsubtotal = $fotoshow * Math.ceil($qty/$maxphotosperfotoshow);
				$addon += '<br><br>zzgl. Fotoshow-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $fotoshowsubtotal;
			}
			if (document.forms['ord'].fotoshowxxlchecked.value == '1') {
				$fotoshowsubtotal = $fotoshowxxl * Math.ceil($qty/$maxphotosperfotoshowxxl);
				$addon += '<br><br>zzgl. Fotoshow-XXL-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $fotoshowsubtotal;
			}

			if ($outputformat2 == '0') {
				$noofdvds = Math.ceil($qty/$maxphotosperdvd);
				$dvdsubtotal = $dvd * $noofdvds;
				$subtotal += $dvdsubtotal;
				$plural = getplural($noofdvds);
				$addon += '<br><br>zzgl. voraussichtlich '+formatnumber($noofdvds, 0)+' DVD'+$plural[2]+' f&uuml;r die Datenausgabe inklusive Cover, nur '+formatnumber($dvdsubtotal, 2)+'&nbsp;'+$currencysymbol;
				$addon += '. Die genaue Anzahl ben&ouml;tigter DVDs h&auml;ngt von der tats&auml;chlichen Dateigr&ouml;&szlig;e der fertigen Scans ab. Diese kann in Abh&auml;ngigkeit vom Bildinhalt und der Kompressionsrate schwanken.';

				if ($noofbackups > 0) {
					$pricecopies = $dvd * $noofdvds * $noofbackups;
					$subtotal += $pricecopies;
					if ($noofbackups == 1) {
						$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
					} else {
						$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
					}
				}
			} else {
				$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
			}

			$plural = getplural($qty);
			document.getElementById('plurals').innerHTML = $plural[2];
			document.getElementById('noofphotos').innerHTML = formatnumber($qty, 0);
			document.getElementById('subtotal').innerHTML = formatnumber($subtotal, 2);
			document.getElementById('addon').innerHTML = $addon;
			document.getElementById('minimumpricenote').innerHTML = $minimumpricenote;

		} else {
			setordershortversiondisplay('0', 0)
		}
	}

	function updatepricefotobox() {
		$qty = 0;
		$addon = '';
		$subtotal = 0;
		$maxphotosperfotoshow = 100;
		$maxphotosperfotoshowxxl = 500;
		$maxphotosperdvd = 750;

		if (typeof(document.forms['ord'].addfotocdbackups) != 'undefined') {
			if (document.forms['ord'].addfotocdbackups.checked) {
				$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
			} else {
				$noofbackups = 0;
			}
		} else {
			$noofbackups = getnumericvalue(document.forms['ord'].noofbackups.value);
		}

		if ((document.forms['ord'].step.value == '1') || ((typeof(document.forms['ord'].local) != 'undefined') && (document.forms['ord'].local.value == '1')) ) {
			if (document.forms['ord'].outputformat2[0].checked) {
				$outputformat2 = '0';
			} else {
				$outputformat2 = '1';
			}
		} else {
			$outputformat2 = document.forms['ord'].outputformat2.value;
		}

		if (document.forms['ord'].step.value == '1') {
			$quality = document.forms['ord'].quality.options[document.forms['ord'].quality.selectedIndex].value;
		} else {
			$quality = document.forms['ord'].quality.value;
		}

		$qty10x15 = getnumericvalue(document.forms['ord'].nooffotobox10x15.value);
		$qty += $qty10x15;	

		if (($qty > 0) && ($qty <= ($maxphotosperorder/100))) {
			setordershortversiondisplay('0', 1)

			if ($qty10x15 >= eval("$minqtyfotobox"+$quality+"10x15stufe4")) {
				$unitprice10x15 = eval("$fotobox"+$quality+"10x15stufe4");
			} else if ($qty10x15 >= eval("$minqtyfotobox"+$quality+"10x15stufe3")) {
				$unitprice10x15 = eval("$fotobox"+$quality+"10x15stufe3");
			} else if ($qty10x15 >= eval("$minqtyfotobox"+$quality+"10x15stufe2")) {
				$unitprice10x15 = eval("$fotobox"+$quality+"10x15stufe2");
			} else {
				$unitprice10x15 = eval("$fotobox"+$quality+"10x15stufe1");
			}
			$subtotal10x15 = $qty10x15 * $unitprice10x15;
			$addon += '<br><br>'+formatnumber($qty10x15*100, 0)+' Fotos vom Format 6x6 cm bis zu 10x15 cm in '+ucfirst($quality)+'-Qualit&auml;t &agrave;&nbsp;'+formatnumber($unitprice10x15, 2)+'&nbsp;'+$currencysymbol+' = '+formatnumber($subtotal10x15, 2)+'&nbsp;'+$currencysymbol;
			$subtotal += $subtotal10x15;

			if (document.forms['ord'].fotoshowchecked.value == '1') {
				$fotoshowsubtotal = $fotoshow * Math.ceil((100*$qty)/$maxphotosperfotoshow);
				$addon += '<br><br>zzgl. Fotoshow-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $fotoshowsubtotal;
			}
			if (document.forms['ord'].fotoshowxxlchecked.value == '1') {
				$fotoshowsubtotal = $fotoshowxxl * Math.ceil((100*$qty)/$maxphotosperfotoshowxxl);
				$addon += '<br><br>zzgl. Fotoshow-XXL-Video-DVD f&uuml;r TV &amp; PC, nur '+formatnumber($fotoshowsubtotal, 2)+'&nbsp;'+$currencysymbol;
				$subtotal += $fotoshowsubtotal;
			}

			if ($outputformat2 == '0') {
				$noofdvds = Math.ceil(($qty*100)/$maxphotosperdvd);
				if ($noofbackups > 0) {
					$pricecopies = $dvd * $noofdvds * $noofbackups;
					$subtotal += $pricecopies;
					if ($noofbackups == 1) {
						$addon += '<br><br>Von jeder fertigen DVD soll 1 Kopie f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
					} else {
						$addon += '<br><br>Von jeder fertigen DVD sollen '+$noofbackups+' Kopien f&uuml;r je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden (= '+formatnumber($pricecopies, 2)+'&nbsp;'+$currencysymbol+').';
					}
				}
			} else {
				$addon += '<br><br>Die Scans sollen auf eine externe USB- oder Firewire-Festplatte ausgegeben werden, die ich mit einsende. Dadurch spare ich die Kosten f&uuml;r DVD-Datentr&auml;ger.';
			}
			
			document.getElementById('noofphotos').innerHTML = formatnumber($qty, 0);
			document.getElementById('subtotal').innerHTML = formatnumber($subtotal, 2);
			document.getElementById('addon').innerHTML = $addon;

		} else {
			setordershortversiondisplay('0', 0)
		}
	}

// Digital Photo Rescue

	function testorddigitalfotorettungform1() {
		$sysmsg = '';
		$tmp = getnumericvalue(document.forms['ord'].noofmemorycards.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>Bitte geben Sie ein, wie viele Speicherkarten Sie einsenden.</li>';
		} else if ($tmp > $maxmemorycardsperorder)	{
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxmemorycardsperorder, 0)+' Speicherkarten bearbeitet werden. Sie haben '+formatnumber($tmp, 0)+' Speicherkarten eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}
		updatepricedigitalfotorettung();
		ufwdbtn();
	}

	function updatepricedigitalfotorettung() {
		$qty = 0;
		$addon = '';
		$subtotal = 0;

		$qty = getnumericvalue(document.forms['ord'].noofmemorycards.value);
		if (($qty > 0) && ($qty <= $maxmemorycardsperorder)) {
			setordershortversiondisplay('0', 1)
			$subtotal = $qty * ($digitalfotorettungbearbeitung + $digitalfotorettung);

			if (typeof(document.forms['ord'].outputformat.options) != 'undefined') {
				$tmp = document.forms['ord'].outputformat.options[document.forms['ord'].outputformat.selectedIndex].value;
			} else {
				$tmp = document.forms['ord'].outputformat.value;
			}
			if ($tmp == '1') {
				$addon = '<br><br>Die Daten sollen nicht auf DVD, sondern auf eine externe Festplatte ausgegeben werden, die ich mit einsende.';
			} else {
				$addon = '<br><br>Die Daten sollen auf DVD ausgegeben werden. Die erste ben&ouml;tigte DVD ist inklusive, jede weitere kostet nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+'.';
			}

			document.getElementById('subtotal').innerHTML = formatnumber($subtotal, 2);
			document.getElementById('noofmemorycards').innerHTML = formatnumber($qty, 0);
			document.getElementById('addon').innerHTML = $addon;
			$plurals = getplural($qty);
			document.getElementById('pluraln').innerHTML = $plurals[0];
			document.getElementById('pluraln2').innerHTML = $plurals[1];

		} else {
			setordershortversiondisplay('0', 0)
		}
	}


// Film

	function testordfilmform1() {
		$sysmsg = '';

		if ((document.forms['ord'].quality[0].checked) || (document.forms['ord'].quality[1].checked)) {
			document.getElementById('output').className = 'on';
		}

		$noofspools = getnumericvalue(document.forms['ord'].noofspools.value);
		$spooltype = getCheckedValue(document.forms['ord'].spooltype);
		
		if ($noofspools == 0) {
			$sysmsg += '<li class=error>'+unescape('Bitte tragen Sie ein, wie viele Filmspulen Sie einsenden.')+'</li>';
		} else if ($noofspools > $maxspoolsperorder) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxspoolsperorder, 0)+' Spulen bearbeitet werden. Sie haben '+formatnumber($noofspools, 0)+' Spulen eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}

		if ($spooltype == '1') {
			document.getElementById('hdquality').className = 'off';
			document.forms['ord'].quality[1].checked = true;
		} else {
			document.getElementById('hdquality').className = 'on';
		}
		document.getElementById('outputbluray').className = document.getElementById('hdquality').className;
		document.getElementById('outputblurayvideo').className = document.getElementById('hdquality').className;
		document.getElementById('outputmpeg2hdd').className = document.getElementById('hdquality').className;
		document.getElementById('outputmpeg2hddsd').className = document.getElementById('hdquality').className;

		document.getElementById('introsd').className = 'off';
		document.getElementById('introhd').className = 'off';
		if (($spooltype == '0') && (document.forms['ord'].quality[0].checked)) {
			// only 8mm and HD
			document.getElementById('outputblurayvideo').className = 'on';
			document.getElementById('outputbluray').className = 'on';
			document.getElementById('outputmpeg2hdd').className = 'on';
			document.getElementById('outputmpeg2file').className = 'off';
			document.getElementById('outputavifile').className = 'off';
			document.getElementById('outputvideodvd').className = 'off';
			document.getElementById('outputmpeg2hddsd').className = 'off';
		} else {
			if ($spooltype == '1') {
				document.getElementById('outputblurayvideo').className = 'off';
				document.getElementById('outputbluray').className = 'off';
				document.getElementById('outputmpeg2hdd').className = 'off';
			} else if (document.forms['ord'].quality[0].checked) {
				document.getElementById('outputblurayvideo').className = 'on';
				document.getElementById('outputbluray').className = 'on';
				document.getElementById('outputmpeg2hdd').className = 'on';
				document.getElementById('introsd').className = 'on';
				document.getElementById('introhd').className = 'on';
			} else {
				document.getElementById('outputblurayvideo').className = 'off';
				document.getElementById('outputbluray').className = 'off';
				document.getElementById('outputmpeg2hdd').className = 'off';
			}
			document.getElementById('outputvideodvd').className = 'on';
			document.getElementById('outputmpeg2file').className = 'on';
			document.getElementById('outputmpeg2hddsd').className = 'on';
			document.getElementById('outputavifile').className = 'on';
		}

		// #786 requires a not-so-nice change to the code
		$onblurayvideo = false;
		$onbluray = false;
		$onvideodvd = false;
		$onhdd = false;
		$onhddsd = false;
		$onmpeg2file = false;
		$onavifile = false;
		if (getCheckedValue(document.forms['ord'].outputformathd) == 'onblurayvideo') {
			$onblurayvideo = true;
		} else if (getCheckedValue(document.forms['ord'].outputformathd) == 'onbluray') {
			$onbluray = true;
		} else if (getCheckedValue(document.forms['ord'].outputformathd) == 'onhdd') {
			$onhdd = true;
		}
		if (getCheckedValue(document.forms['ord'].outputformatsd) == 'onvideodvd') {
			$onvideodvd = true;
		} else if (getCheckedValue(document.forms['ord'].outputformatsd) == 'onhdds') {
			$onhddsd = true;
		} else if (getCheckedValue(document.forms['ord'].outputformatsd) == 'onmpeg2file') {
			$onmpeg2file = true;
		} else if (getCheckedValue(document.forms['ord'].outputformatsd) == 'onavifile') {
			$onavifile = true;
		}
		
		// #2226
		
		if ((((document.forms['ord'].quality[0].checked) && ($onblurayvideo)) || ((document.forms['ord'].quality[1].checked) && ($onvideodvd))) && ($noofspools > 1)) {
			document.getElementById('sepoutput').className = 'on';
		} else {
			document.getElementById('sepoutput').className = 'off';
			document.forms['ord'].separateoutput.checked = false;
		}

		if ((!(document.forms['ord'].quality[0].checked)) && (!(document.forms['ord'].quality[1].checked))) {
			$sysmsg += '<li class=error>Bitte w&auml;hlen Sie die Ausgabequalit&auml;t.</li>';
		} else {
			if (($spooltype == '1') || (document.forms['ord'].quality[1].checked)) {
				document.getElementById('additionalsdformats').className = 'on';
			} else {
				document.getElementById('additionalsdformats').className = 'off';
			}
			if ($noofspools > 0) {
				if (((document.forms['ord'].quality[1].checked) && ($onvideodvd == false) && ($onmpeg2file == false) && ($onhddsd == false) && ($onavifile == false)) 
					|| ((document.forms['ord'].quality[0].checked) && ($onblurayvideo == false) && ($onbluray == false) && ($onhdd == false))) {
					$sysmsg += '<li class=error>Bitte w&auml;hlen Sie ein Ausgabeformat.</li>';
				}
			}
		}

		if ($onblurayvideo) {
			document.getElementById('blurayvideobackup').className = 'on';
			if (document.forms['ord'].addblurayvideobackups.checked == false) {
				document.forms['ord'].noofblurayvideobackups.value = 0;
			} else if ( (document.forms['ord'].addblurayvideobackups.checked) && ( (document.forms['ord'].noofblurayvideobackups.value == '0') || (document.forms['ord'].noofblurayvideobackups.value == '')) ) {
				document.forms['ord'].noofblurayvideobackups.value = 1;
			}
			if (document.forms['ord'].addbd2mpeg.checked == false) {
				document.forms['ord'].noofbluraybackups.value = 0;
			} else if ( (document.forms['ord'].addbd2mpeg.checked) && ( (document.forms['ord'].noofbluraybackups.value == '0') || (document.forms['ord'].noofbluraybackups.value == '')) ) {
				document.forms['ord'].noofbluraybackups.value = 1;
			}
		} else {
			document.getElementById('blurayvideobackup').className = 'off';
		}
		if ($onvideodvd) {
			document.getElementById('viddvdbackup').className = 'on';
			if (document.forms['ord'].addvideodvdbackups.checked == false) {
				document.forms['ord'].noofvideodvdbackups.value = 0;
			} else if ( (document.forms['ord'].addvideodvdbackups.checked) && ( (document.forms['ord'].noofvideodvdbackups.value == '0') || (document.forms['ord'].noofvideodvdbackups.value == '')) ) {
				document.forms['ord'].noofvideodvdbackups.value = 1;
			}
		} else {
			document.getElementById('viddvdbackup').className = 'off';
		}
		if ($onbluray) {
			document.getElementById('bluraybackup').className = 'on';
			if (document.forms['ord'].addbluraybackups.checked == false) {
				document.forms['ord'].noofbluraybackups.value = 0;
			} else if ( (document.forms['ord'].addbluraybackups.checked) && ( (document.forms['ord'].noofbluraybackups.value == '0') || (document.forms['ord'].noofbluraybackups.value == '')) ) {
				document.forms['ord'].noofbluraybackups.value = 1;
			}
		} else {
			document.getElementById('bluraybackup').className = 'off';
		}
		if ($onmpeg2file) {
			document.getElementById('mpeg2filebackup').className = 'on';
			if (document.forms['ord'].addmpeg2filebackups.checked == false) {
				document.forms['ord'].noofmpeg2filebackups.value = 0;
			} else if ( (document.forms['ord'].addmpeg2filebackups.checked) && ( (document.forms['ord'].noofmpeg2filebackups.value == '0') || (document.forms['ord'].noofmpeg2filebackups.value == '')) ) {
				document.forms['ord'].noofmpeg2filebackups.value = 1;
			}
		} else {
			document.getElementById('mpeg2filebackup').className = 'off';
		}

		ufwdbtnfilm();
	}

	function removeinvisibleoutputformats() {
		// #786 requires changes
		
		if ((document.getElementById('outputblurayvideo').className == 'off') && (document.getElementById('outputbluray').className == 'off') && (document.getElementById('outputmpeg2hdd').className == 'off')) {
			document.forms['ord'].outputformathd[0].checked = true;
		}
		if ((document.getElementById('outputmpeg2hddsd').className == 'off') && (document.getElementById('outputmpeg2file').className == 'off') && (document.getElementById('outputavifile').className == 'off') && (document.getElementById('outputvideodvd').className == 'off')) {
			document.forms['ord'].outputformatsd[0].checked = true;
		}
	}

// Videos

	function testordvideoform1() {
		$sysmsg = '';

		$noofvideos = getnumericvalue(document.forms['ord'].noofvideos.value);
		if ($noofvideos == 0) {
			$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele Videokassetten oder DVDs Sie einsenden.</li>';
		} else if ($noofvideos > $maxvideosperorder) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxvideosperorder, 0)+' Videokassetten/DVDs bearbeitet werden. Sie haben '+formatnumber($noofvideos, 0)+' Videokassetten eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}

/* #1729
		$onvideodvd = document.forms['ord'].onvideodvd.checked;
		$onmpeg2file = document.forms['ord'].onmpeg2file.checked;
		$onhddvid = document.forms['ord'].onhddvid.checked;
*/
		$onvideodvd = 0;
		$onmpeg2file = 0;
		$onhddvid = 0;
		if (document.forms['ord'].outputformat[0].checked == true) {
			$onvideodvd = 1;
		} else if (document.forms['ord'].outputformat[1].checked == true) {
			$onmpeg2file = 1;
		} else if (document.forms['ord'].outputformat[2].checked == true) {
			$onhddvid = 1;
		}


		if (($onvideodvd == false) && ($onmpeg2file == false) && ($onhddvid == false)) {
			$sysmsg += '<li class=error>Bitte w&auml;hlen Sie mindestens ein Ausgabeformat.</li>';
		}

		if ($noofvideos >= $noofvideosforhddrecommendation) {
			document.getElementById('recommendhdd').className = 'on';
		} else {
			document.getElementById('recommendhdd').className = 'off';
		}
		if ($onvideodvd) {
			document.getElementById('viddvdbackup').className = 'on';
			if (document.forms['ord'].addvideodvdbackups.checked == false) {
				document.forms['ord'].noofvideodvdbackups.value = 0;
			} else if ( (document.forms['ord'].addvideodvdbackups.checked) && ( (document.forms['ord'].noofvideodvdbackups.value == '0') || (document.forms['ord'].noofvideodvdbackups.value == '')) ) {
				document.forms['ord'].noofvideodvdbackups.value = 1;
			}
		} else {
			document.getElementById('viddvdbackup').className = 'off';
		}
		if ($onmpeg2file) {
			document.getElementById('mpeg2filebackup').className = 'on';
			if (document.forms['ord'].addmpeg2backups.checked == false) {
				document.forms['ord'].noofmpeg2filebackups.value = 0;
			} else if ( (document.forms['ord'].addmpeg2backups.checked) && ( (document.forms['ord'].noofmpeg2filebackups.value == '0') || (document.forms['ord'].noofmpeg2filebackups.value == '')) ) {
				document.forms['ord'].noofmpeg2filebackups.value = 1;
			}
		} else {
			document.getElementById('mpeg2filebackup').className = 'off';
		}

		$postdubbing = document.forms['ord'].postdubbing.checked;
		if ($postdubbing == false) {
			document.forms['ord'].soundtrack[0].checked = false;
			document.forms['ord'].soundtrack[1].checked = false;
			document.forms['ord'].soundtrack[2].checked = false;
		} else if ((document.forms['ord'].soundtrack[0].checked == false) && (document.forms['ord'].soundtrack[1].checked == false) && (document.forms['ord'].soundtrack[2].checked == false)) {
			$sysmsg += '<li class=error>Bitte w&auml;hlen Sie die Soundspur(en) der Nachvertonung.</li>';
		}

		updatepricevideo();
		ufwdbtn();
	}
	
	function updatepricevideo() {
		$qty = getnumericvalue(document.forms['ord'].noofvideos.value);
		if ($qty > 0) {
			if ($qty >= $minqtyvideostufe3) {
				$unitprice = $videostufe3;
			} else if ($qty >= $minqtyvideostufe2) {
				$unitprice = $videostufe2;
			} else {
				$unitprice = $videostufe1;
			}
		} else 
			$unitprice = $videostufe1;
		document.getElementById('unitprice').innerHTML = '<a href="'+$base+'service/preise#video">'+formatnumber($unitprice, 2)+'&nbsp;'+$currencysymbol+'</a>';
	}
	

// Tontraeger

	function testordtontraegerform1() {
		$sysmsg = '';
		$tmp = getnumericvalue(document.forms['ord'].noofaudios.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>'+unescape('Bitte tragen Sie ein, wie viele Tontr%E4ger Sie einsenden.')+'</li>';
		} else if ($tmp > $maxtontraegerperorder) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxtontraegerperorder, 0)+' Tontr&auml;ger bearbeitet werden. Sie haben '+formatnumber($tmp, 0)+' Tontr&auml;ger eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}

		if (document.forms['ord'].outputformat[0].checked == true) {
			document.getElementById('audiocdbackup').className = 'on';
			if (document.forms['ord'].addaudiocdbackups.checked == true) {
				$tmp = getnumericvalue(document.forms['ord'].noofaudiocdbackups.value);
				if ($tmp == 0) 
					$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele Audio CD Kopien Sie m&ouml;chten.</li>';
			}
		} else
			document.getElementById('audiocdbackup').className = 'off';

		if (document.forms['ord'].outputformat[1].checked == true) {
			document.getElementById('wavcdbackup').className = 'on';
			if (document.forms['ord'].addwavcdbackups.checked == true) {
				$tmp = getnumericvalue(document.forms['ord'].noofwavcdbackups.value);
				if ($tmp == 0) 
					$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele WAV Daten CD Kopien Sie m&ouml;chten.</li>';
			}
		} else
			document.getElementById('wavcdbackup').className = 'off';

		if (document.forms['ord'].outputformat[2].checked == true) {
			document.getElementById('mp3cdbackup').className = 'on';
			if (document.forms['ord'].addmp3cdbackups.checked == true) {
				$tmp = getnumericvalue(document.forms['ord'].noofmp3cdbackups.value);
				if ($tmp == 0) 
					$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele MP3 Daten CD Kopien Sie m&ouml;chten.</li>';
			}
		} else
			document.getElementById('mp3cdbackup').className = 'off';


		updatepricetontraeger();
		ufwdbtn();
	}

	function updatepricetontraeger() {
		$addon = '';
		$qualityverbose = '';
		$qty = getnumericvalue(document.forms['ord'].noofaudios.value);
		if (($qty > 0) && ($qty <= $maxtontraegerperorder)) {
			setordershortversiondisplay('0', 1)

			if (typeof(document.forms['ord'].quality) != 'undefined') {
				$quality = getCheckedValue(document.forms['ord'].quality);
			} else {
				$quality = document.forms['ord'].qualitychecked.value
			}

			if ($quality == '0') {
				$qualityverbose += 'Premium';
				$subtotal = $premium * $qty;
			} else {
				$qualityverbose += 'Basic';
				$subtotal = $basic * $qty;
			}
			$plurals = getplural($qty);
			if (document.forms['ord'].mediatype.value == 'schallplatten') {
				$unit = 'je Schallplatte = f&uuml;r '+formatnumber($qty, 0)+' Schallplatte'+$plurals[0]+' nur '+formatnumber($subtotal, 2)+'&nbsp;'+$currencysymbol;
			} else if (document.forms['ord'].mediatype.value == 'musikkassetten') {
				$unit = 'je Musikkassette = f&uuml;r '+formatnumber($qty, 0)+' Musikkassette'+$plurals[0]+' nur '+formatnumber($subtotal, 2)+'&nbsp;'+$currencysymbol;
			} else {
				$unit = 'je angebrochene Stunde';
			}		
			if ($quality == '0') {
				$addon += 'f&uuml;r nur '+formatnumber($premium, 2)+'&nbsp;'+$currencysymbol+' '+$unit+'.';
			} else {
				$addon += 'f&uuml;r nur '+formatnumber($basic, 2)+'&nbsp;'+$currencysymbol+' '+$unit+'.';
			}


			if (typeof(document.forms['ord'].outputformat) != 'undefined') {
				$outputformat = getCheckedValue(document.forms['ord'].outputformat);
			} else {
				$outputformat = document.forms['ord'].outputformatchecked.value
			}
			if ($outputformat == '0') {
				$addon += '<br><br>Das Ergebnis soll als Audio-CD ausgegeben werden.<br><br>Preis zzgl. der daf&uuml;r ben&ouml;tigten Ausgabe-CDs zu je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+'.';
			} else if ($outputformat == '1') {
				$addon += '<br><br>Das Ergebnis soll als WAV-Dateien auf Daten-DVD ausgegeben werden.<br><br>Preis zzgl. der daf&uuml;r ben&ouml;tigten Ausgabe-DVDs zu je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+'.';
			} else if ($outputformat == '2') {
				$addon += '<br><br>Das Ergebnis soll als MP3-Dateien auf Daten-DVD ausgegeben werden.<br><br>Preis zzgl. der daf&uuml;r ben&ouml;tigten Ausgabe-DVDs zu je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+'.';
			} else if ($outputformat == '3') {
				$addon += '<br><br>Das Ergebnis soll als WAV-Dateien auf einer leeren, externen USB oder Firewire Festplatte ausgegeben werden (bitte zusammen mit dem Originalmaterial einsenden).';
			} else if ($outputformat == '4') {
				$addon += '<br><br>Das Ergebnis soll als MP3-Dateien auf einer leeren, externen USB oder Firewire Festplatte ausgegeben werden (bitte zusammen mit dem Originalmaterial einsenden).';
			}

			$addaudiocdbackups = (((typeof(document.forms['ord'].addaudiocdbackups) != 'undefined') && (document.forms['ord'].addaudiocdbackups.checked)) || (typeof(document.forms['ord'].addaudiocdbackups) == 'undefined'));
			$addwavcdbackups = (((typeof(document.forms['ord'].addwavcdbackups) != 'undefined') && (document.forms['ord'].addwavcdbackups.checked)) || (typeof(document.forms['ord'].addwavcdbackups) == 'undefined'));;
			$tmp = 0;
			if (($outputformat == 0) && ($addaudiocdbackups)) {
				$tmp = getnumericvalue(document.forms['ord'].noofaudiocdbackups.value);
			}
			if (($outputformat == 1) && ($addwavcdbackups)) {
				$tmp = getnumericvalue(document.forms['ord'].noofwavcdbackups.value);
			}
			if ($tmp > 0) 
				$addon += ' Von jeder CD sollen '+$tmp+' Kopien zu je nur '+formatnumber($dvd, 2)+'&nbsp;'+$currencysymbol+' angefertigt werden.';

			$plurals = getplural($qty);
			document.getElementById('pluraln2').innerHTML = $plurals[1];
			if (document.forms['ord'].mediatype.value == 'tonbaender') {
				if ($qty > 1) {
					document.getElementById('mediatype').innerHTML = 'Tonb&auml;nder';
				} else {
					document.getElementById('mediatype').innerHTML = 'Tonband';
				}
			} else {
				document.getElementById('pluraln').innerHTML = $plurals[0];
			}

			if (typeof($hasindividualtitles) != 'undefined') {
				if (($outputformat != '0') && ($hasindividualtitles > 0)) {
					$addon += '<br><br>Die Dateien sollen individuell benannt werden zu '+formatnumber($hasindividualtitles, 0)+' x '+formatnumber($individualfilename, 2)+'&nbsp;'+$currencysymbol+' = '+formatnumber($hasindividualtitles*$individualfilename, 2)+'&nbsp;'+$currencysymbol+'.';
				}
			}

			document.getElementById('noofaudios').innerHTML = formatnumber($qty, 0);
			document.getElementById('qualityverbose').innerHTML = $qualityverbose;
			document.getElementById('addon').innerHTML = $addon;
		} else {
			setordershortversiondisplay('0', 0)
		}
	}


// Cassette repair

	function testordkassettenreparaturform1() {
		$sysmsg = '';
		$tmp = getnumericvalue(document.forms['ord'].noofvideos.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>'+unescape('Bitte tragen Sie ein, wie viele defekte Videokassetten Sie einsenden.')+'</li>';
		} else if ($tmp > $maxvideosperorder) {
			$sysmsg += '<li class=error>Insgesamt k&ouml;nnen pro Auftrag h&ouml;chstens '+formatnumber($maxvideosperorder, 0)+' Videokassetten bearbeitet werden. Sie haben '+formatnumber($tmp, 0)+' Videokassetten eingetragen. Bitte verteilen Sie die Menge auf mindestens zwei Auftr&auml;ge.</li>';
		}
		updatepricekassettenreparatur();
		ufwdbtn();
	}

	function updatepricekassettenreparatur() {
		$qty = getnumericvalue(document.forms['ord'].noofvideos.value);
		if (($qty > 0) && ($qty <= $maxvideosperorder)) {
			setordershortversiondisplay('0', 1)

			$subtotal = $qty * $kassettenreparatur;
			if ($qty > 1) {
				$addon = '<br><br>Preis f&uuml;r '+formatnumber($qty, 0)+' Kassetten nur '+formatnumber($subtotal, 2)+'&nbsp;'+$currencysymbol+'.';
			} else {
				$addon = '<br><br>Preis f&uuml;r 1 Kassette nur '+formatnumber($subtotal, 2)+'&nbsp;'+$currencysymbol+'.';
			}

			$plurals = getplural($qty);
			document.getElementById('pluraln2').innerHTML = $plurals[0];
			document.getElementById('pluraln3').innerHTML = $plurals[1];
			document.getElementById('noofvideos').innerHTML = formatnumber($qty, 0);
			document.getElementById('addon').innerHTML = $addon;
		} else {
			setordershortversiondisplay('0', 0)
		}
	}

// Director's Cut

	function inittitlecount($noofdvdoutput) {
		for (i=0;i<$noofdvdoutput;i++) 
			eval("testordform2showlength(document.forms['ord'].dvdoutputtitle"+i+".value, 'dvdoutputtitleic"+i+"')");
	}

	function testorddcform1() {
		$sysmsg = '';
		$tmp = getnumericvalue(document.forms['ord'].noofdvdinput.value);
		if ($tmp == 0) {
			$sysmsg += '<li class=error>Bitte tragen Sie ein, wie viele DVDs Sie einsenden.</li>';
		} else if ($tmp > 3) {
			$sysmsg += '<li class=error>Das &quot;Best of&quot; kann aus h&ouml;chstens drei DVDs erstellt werden.</li>';
		}
		ufwdbtn();
	}

	function dotestdcform2() {
		clearTimeout($dcformtest);
		$sysmsg = testtimelogic();
		ufwdbtn();
	}

	function testdcform2() {
		if (typeof($dcformtest) != 'undefined') {
			clearTimeout($dcformtest);
		}
		$dcformtest = setTimeout('dotestdcform2()', 100);
	}

	function ftrtdisplay($element, rthours, rtminutes, rtseconds) {
		if (rthours < 10) {
			$verbosesubtotalruntimehours = '0'+rthours;
		} else {
			$verbosesubtotalruntimehours = rthours;
		}
		if (rtminutes < 10) {
			$verbosesubtotalruntimeminutes = '0'+rtminutes;
		} else {
			$verbosesubtotalruntimeminutes = rtminutes;
		}
		if (rtseconds < 10) {
			$verbosesubtotalruntimeseconds = '0'+rtseconds;
		} else {
			$verbosesubtotalruntimeseconds = rtseconds;
		}
		$tmp = $verbosesubtotalruntimehours+':'+$verbosesubtotalruntimeminutes+':'+$verbosesubtotalruntimeseconds;
		document.getElementById($element).innerHTML = $tmp;
		return $tmp;
	}

	function testtimelogic() {
		$sysmsg = '';

		totalruntime = 0;
		i = 0;
		$atleastonetoolong = false;
		for (i=0;i<$maxnoofdvds;i++) {
			$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+i+"t1");
			if (typeof($tmp) != 'undefined') {
				$verbosedvdoutput = 1+i;
				subtotalruntime = 0;
				scene = 0;
				noofvisiblescenes = 0;
				$addscenelink = true;
				for (scene=1;scene<=$maxnoofscenes;scene++) {
					$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+i+"t"+scene);
					if ((document.getElementById('dvdoutput'+i+'scene'+scene).className != 'off') && (typeof($tmp) != 'undefined')) {
						$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+i+"t"+scene+".options[document.forms['ord'].dvdoutputhoursstart"+i+"t"+scene+".selectedIndex].value");
						$start = parseInt($tmp)*3600;
						$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+i+"t"+scene+".options[document.forms['ord'].dvdoutputminutesstart"+i+"t"+scene+".selectedIndex].value");
						$start += parseInt($tmp)*60;
						$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+i+"t"+scene+".options[document.forms['ord'].dvdoutputsecondsstart"+i+"t"+scene+".selectedIndex].value");
						$start += parseInt($tmp);
						$tmp = eval("document.forms['ord'].dvdoutputhoursend"+i+"t"+scene+".options[document.forms['ord'].dvdoutputhoursend"+i+"t"+scene+".selectedIndex].value");
						$end = parseInt($tmp)*3600;
						$tmp = eval("document.forms['ord'].dvdoutputminutesend"+i+"t"+scene+".options[document.forms['ord'].dvdoutputminutesend"+i+"t"+scene+".selectedIndex].value");
						$end += parseInt($tmp)*60;
						$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+i+"t"+scene+".options[document.forms['ord'].dvdoutputsecondsend"+i+"t"+scene+".selectedIndex].value");
						$end += parseInt($tmp);
						if ($end <= $start) {
// #1610							$sysmsg += '<li class=error>Die Endzeit von Abschnitt '+scene+' auf Ausgabe-DVD '+$verbosedvdoutput+' muss nach der Startzeit liegen.</li>';
							$sysmsg += '<li class=error>Die Endzeit von Abschnitt '+scene+' auf der Ausgabe-DVD muss nach der Startzeit liegen.</li>';
							$addscenelink = false;
						} else if ($end-$start < 9) {
// #1610							$sysmsg += '<li class=error>Ein Abschnitt muss mindestens 10 Sekunden lang sein. Abschnitt '+scene+' auf Ausgabe-DVD '+$verbosedvdoutput+' ist nur '+(1+($end-$start))+' Sekunden lang.</li>';
							$sysmsg += '<li class=error>Ein Abschnitt muss mindestens 10 Sekunden lang sein. Abschnitt '+scene+' auf der Ausgabe-DVD ist nur '+(1+($end-$start))+' Sekunden lang.</li>';
							$addscenelink = false;
						} else {
							subtotalruntime += 1 + $end - $start;
						}
						++noofvisiblescenes;
					}
				}
				totalruntime += subtotalruntime;
				subtotalruntimehours = Math.floor(subtotalruntime/3600);
				subtotalruntimeminutes = Math.floor((subtotalruntime-(subtotalruntimehours*3600))/60);
				subtotalruntimeseconds = subtotalruntime-(subtotalruntimehours*3600)-(subtotalruntimeminutes*60);
				$tmp = ftrtdisplay('rtdvdoutput'+$verbosedvdoutput, subtotalruntimehours, subtotalruntimeminutes, subtotalruntimeseconds);
				if (subtotalruntime > 5400) {
/* #1610
					$sysmsg += '<li class=error>Die Laufzeit von Ausgabe-DVD '+$verbosedvdoutput+' ist zu lang. Sie betr&auml;gt zur Zeit '+$tmp+', darf aber h&ouml;chstens 1:30:00 sein. Bitte verteilen Sie die Abschnitte von Ausgabe-DVD '+$verbosedvdoutput+' auf mehrere DVDs.<br>';
					$sysmsg += '<a href="#" onclick="adddvd();return false"><img border=0 src="i/o/i_as.gif" width=12 height=12> Weitere Ausgabe-DVD hinzuf&uuml;gen</a></li>';
*/
					$sysmsg += '<li class=error>Die Laufzeit der Ausgabe-DVD ist zu lang. Sie betr&auml;gt zur Zeit '+$tmp+', darf aber h&ouml;chstens 1:30:00 sein.</li>';
					$addscenelink = false;

					$atleastonetoolong = true;
				}

				if (noofvisiblescenes == $maxnoofscenes) {
					$addscenelink = false;
				}
				if ($addscenelink) {
					document.getElementById('addscenelink'+i).className = 'on';
				} else {
					document.getElementById('addscenelink'+i).className = 'off';
				}

				$tmp = eval("document.forms['ord'].noofscenesdvd"+$verbosedvdoutput);
				$tmp.value = noofvisiblescenes;

				// update scene links
				$tmp = eval("document.getElementById('uarrdvd"+i+"scene1')");
				$tmp.className = 'off';
				$tmp = eval("document.getElementById('rmscene"+i+"scene1')");
				if (noofvisiblescenes > 1) {
					$tmp.className = 'on';
				} else {
					$tmp.className = 'off';
				}
				for (scene=1;scene<=$maxnoofscenes;scene++) {
					$tmp = eval("document.getElementById('uarrdvd"+i+"scene"+scene+"')");
					if (scene > 1) {
						$tmp.className = 'on';
					}
					$tmp = eval("document.getElementById('darrdvd"+i+"scene"+scene+"')");
					if ((scene == noofvisiblescenes) || (noofvisiblescenes == 1)) {
						$tmp.className = 'off';
					} else {
						$tmp.className = 'on';
					}
				}
			}
		}
		totalruntimehours = Math.floor(totalruntime/3600);
		totalruntimeminutes = Math.floor((totalruntime-(totalruntimehours*3600))/60);
		totalruntimeseconds = totalruntime-(totalruntimehours*3600)-(totalruntimeminutes*60);
// #1610		ftrtdisplay('rtdvdoutputtotal', totalruntimehours, totalruntimeminutes, totalruntimeseconds);

		if ($atleastonetoolong) {
// #1610			document.getElementById('adddvd').className = 'on';
			document.getElementById('adddvd').className = 'off';
		} else {
			document.getElementById('adddvd').className = 'off';
		}

		return $sysmsg;
	}

	function rmdvd($dvdid) {
		$verbosedvdid = 1+parseInt($dvdid);
// #1610		if (confirm(unescape('M%F6chten Sie die Ausgabe-DVD Nr. '+$verbosedvdid+' wirklich vollst%E4ndig entfernen?\nAlle in Ausgabe-DVD '+$verbosedvdid+' enthaltenen Abschnitte werden dadurch ebenfalls entfernt.'))) {
		if (confirm(unescape('M%F6chten Sie die Ausgabe-DVD wirklich vollst%E4ndig entfernen?\nAlle in der Ausgabe-DVD enthaltenen Abschnitte werden dadurch ebenfalls entfernt.'))) {
			hg();
			document.forms['ord'].dvdid.value = $dvdid;
			document.forms['ord'].transaction.value = 'rmdvd';
			document.forms['ord'].submit();
		}
	}

	function adddvd() {
		hg();
		document.forms['ord'].transaction.value = 'adddvd';
		document.forms['ord'].submit();
	}

	function addscene($dvdid, $runtest) {
		addscenecounter: for (scenei=1;scenei<=$maxnoofscenes;scenei++) {
			if (document.getElementById('dvdoutput'+$dvdid+'scene'+scenei).className == 'off') {
				document.getElementById('dvdoutput'+$dvdid+'scene'+scenei).className = 'on';
				break addscenecounter;
			}
		}
		if ((typeof($runtest) == 'undefined') || ($runtest == true)) {
			dotestdcform2();
		}
	}

	function rmscene($dvdid, scenetoremove) {
		$verbosedvdid = parseInt($dvdid)+1;
		if (confirm(unescape('M%F6chten Sie den Abschnitt '+scenetoremove+' von Ausgabe-DVD Nr. '+$verbosedvdid+' wirklich entfernen?'))) {

			// read all input field contents into an array but from the line that the user wants to remove
			var $sources = new Array();
			var $hoursstart = new Array();
			var $minutesstart = new Array();
			var $secondsstart = new Array();
			var $hoursend = new Array();
			var $minutesend = new Array();
			var $secondsend = new Array();
			var $titles = new Array();
			for (scene=1;scene<=$maxnoofscenes;scene++) {
				if (document.getElementById('dvdoutput'+$dvdid+'scene'+scene).className == 'off') {
					break;
				} else if (scene != scenetoremove) {
					$sources.push(eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+scene+".selectedIndex"));
					$hoursstart.push(eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+scene+".selectedIndex"));
					$minutesstart.push(eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+scene+".selectedIndex"));
					$secondsstart.push(eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+scene+".selectedIndex"));
					$hoursend.push(eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+scene+".selectedIndex"));
					$minutesend.push(eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+scene+".selectedIndex"));
					$secondsend.push(eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+scene+".selectedIndex"));
					$titles.push(eval("document.forms['ord'].dvdoutputscene"+scene+"title"+$dvdid+".value"));
				};
			}
			// turn off display of last scene and remove the content of the fields
			--scene;
			document.getElementById('dvdoutput'+$dvdid+'scene'+scene).className = 'off';

			$tmp = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+scene);
			$tmp.selectedIndex = 0;
			$tmp = eval("document.forms['ord'].dvdoutputscene"+scene+"title"+$dvdid);
			$tmp.value = '';

			// write the input fields from scene 1 to X back into the fields that remain visible
			$max = $sources.length;
			for (scene=0;scene<=$max;scene++) {
				sceneid = scene+1;
				$tmp = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $sources[scene];
				$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $hoursstart[scene];
				$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $minutesstart[scene];
				$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $secondsstart[scene];
				$tmp = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $hoursend[scene];
				$tmp = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $minutesend[scene];
				$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+sceneid);
				$tmp.selectedIndex = $secondsend[scene];
				$tmp = eval("document.forms['ord'].dvdoutputscene"+sceneid+"title"+$dvdid);
				if (typeof($titles[scene]) != 'undefined') {
					$tmp.value = $titles[scene];
				} else {
					$tmp.value = '';
				}
			}
		}
		dotestdcform2();
	}

	function mvscene($dvdid, scenetomove, step) {

		// read source set
		$sourcesrc = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+scenetomove+".selectedIndex");
		$hoursstartsrc = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+scenetomove+".selectedIndex");
		$minutesstartsrc = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+scenetomove+".selectedIndex");
		$secondsstartsrc = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+scenetomove+".selectedIndex");
		$hoursendsrc = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+scenetomove+".selectedIndex");
		$minutesendsrc = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+scenetomove+".selectedIndex");
		$secondsendsrc = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+scenetomove+".selectedIndex");
		$titlesrc = eval("document.forms['ord'].dvdoutputscene"+scenetomove+"title"+$dvdid+".value");

		// read target set
		target = scenetomove + step;
		$sourcetrg = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+target+".selectedIndex");
		$hoursstarttrg = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+target+".selectedIndex");
		$minutesstarttrg = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+target+".selectedIndex");
		$secondsstarttrg = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+target+".selectedIndex");
		$hoursendtrg = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+target+".selectedIndex");
		$minutesendtrg = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+target+".selectedIndex");
		$secondsendtrg = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+target+".selectedIndex");
		$titletrg = eval("document.forms['ord'].dvdoutputscene"+target+"title"+$dvdid+".value");

		// interchange the sets
		$tmp = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $sourcetrg;
		$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $hoursstarttrg;
		$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $minutesstarttrg;
		$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $secondsstarttrg;
		$tmp = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $hoursendtrg;
		$tmp = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $minutesendtrg;
		$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+scenetomove);
		$tmp.selectedIndex = $secondsendtrg;
		$tmp = eval("document.forms['ord'].dvdoutputscene"+scenetomove+"title"+$dvdid);
		$tmp.value = $titletrg;

		$tmp = eval("document.forms['ord'].dvdoutputsources"+$dvdid+"t"+target);
		$tmp.selectedIndex = $sourcesrc;
		$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+$dvdid+"t"+target);
		$tmp.selectedIndex = $hoursstartsrc;
		$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+$dvdid+"t"+target);
		$tmp.selectedIndex = $minutesstartsrc;
		$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+$dvdid+"t"+target);
		$tmp.selectedIndex = $secondsstartsrc;
		$tmp = eval("document.forms['ord'].dvdoutputhoursend"+$dvdid+"t"+target);
		$tmp.selectedIndex = $hoursendsrc;
		$tmp = eval("document.forms['ord'].dvdoutputminutesend"+$dvdid+"t"+target);
		$tmp.selectedIndex = $minutesendsrc;
		$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+$dvdid+"t"+target);
		$tmp.selectedIndex = $secondsendsrc;
		$tmp = eval("document.forms['ord'].dvdoutputscene"+target+"title"+$dvdid);
		$tmp.value = $titlesrc;

		dotestdcform2();
	}

	function initscenes() {
		// cut scenes down to max allowed for the selected number of source dvds
		if ($noofsourcedvds == 1) {
			$maxnoofscenes = 25;
		} else if ($noofsourcedvds == 2) {
			$maxnoofscenes = 50;
		} else {
			$maxnoofscenes = 100;
		}
		// set scene contents from $jsscenes upon page load
		noofscenes = $jsscenes.length;
		if (noofscenes > $maxnoofscenes) {
			noofscenes = $maxnoofscenes;
		}

		if (noofscenes == 0) {
			addscene($jsscenes[0][0], false);
		} else {
			$lastdvdprocessed = 0;
			previousscenes = 0;
			for (scene=1;scene<=noofscenes;scene++) {
				sc = scene-1;
				if (($jsscenes[sc][1] != '') && ($jsscenes[sc][0] < parseInt(document.forms['ord'].noofdvds.value))) {
					if ($jsscenes[sc][0] != $lastdvdprocessed) {
						previousscenes = sc;
						$lastdvdprocessed = $jsscenes[sc][0];
					}
					currentscene = scene-previousscenes;
					$tmp = eval("document.forms['ord'].dvdoutputsources"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][1]);
					$tmp = eval("document.forms['ord'].dvdoutputhoursstart"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][2]);
					$tmp = eval("document.forms['ord'].dvdoutputminutesstart"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][3]);
					$tmp = eval("document.forms['ord'].dvdoutputsecondsstart"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][4]);
					$tmp = eval("document.forms['ord'].dvdoutputhoursend"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][5]);
					$tmp = eval("document.forms['ord'].dvdoutputminutesend"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][6]);
					$tmp = eval("document.forms['ord'].dvdoutputsecondsend"+$jsscenes[sc][0]+"t"+currentscene);
					selectvalueset($tmp, $jsscenes[sc][7]);
					$tmp = eval("document.forms['ord'].dvdoutputscene"+currentscene+"title"+$jsscenes[sc][0]);
					$tmp.value = $jsscenes[sc][8];
					addscene($jsscenes[sc][0], false);
				} 
			}
		}
		dotestdcform2();
	}


