function updateArea(event) { var x = document.forms.produktform.height.value; var y = document.forms.produktform.width.value; var count = 0; for (i=0; i< x.length; i++) { if (x[i] == ',') count++; } if (count > 1) { alert(x + " The inserted data is no number"); return false; } count = 0; for (i=0; i< y.length; i++) { if (y[i] == ',') count++; } if (count > 1) { alert(y + " The inserted data is no number"); document.forms.produktform.weight.focus(); return false; } var rx = x.replace(/\./, ''); var ry = y.replace(/\./, ''); ry = ry.replace(/[a-zA-Z]*/g,''); rx = rx.replace(/[a-zA-Z]*/g,''); document.forms.produktform.height.value = rx; document.forms.produktform.width.value = ry; rx = rx.replace(/,/, '.'); ry = ry.replace(/,/, '.'); var hoehe = parseFloat(rx); var breite = parseFloat(ry); if (hoehe <= 0 || breite <= 0) return; var flaeche = hoehe * breite; //alert('flaeche: ' + flaeche); //flaeche = round(flaeche,2); var output = flaeche.toFixed(2).toLocaleString(); //alert('output: ' + output); output2 = output.replace(/\./, ','); //document.forms.produktform.auflage.value = output2; // Preisberechnung über ajax $("#preisanzeige").load("/preis.ajax.php", {hoehe: rx, breite: ry, catid: document.forms.produktform.catid.value, prodid: document.forms.produktform.prodid.value }); // Vorschau neu anzeigen! iFrame? $.getJSON("/draw_preview2.php", {hoehe: rx, breite: ry, catid: document.forms.produktform.catid.value, prodid: document.forms.produktform.prodid.value, number: document.forms.produktform.number.value }, function (data) { var fname = data.picname; $('#prvimg').attr('src', fname); document.forms.produktform.number.value = data.number; $('#previewinfo').show(); $('#paginator').hide(); } ); return true; } function scChanged(source, rowIndex) { var wid = '#width_'+rowIndex; var hid = '#height_'+rowIndex; var anz = '#quan_'+rowIndex; if ($(hid).size() > 0) { var height = $(hid)[0].value; var width = $(wid)[0].value; $("#shoppingcart").load("/shopcart.ajax.php", {index: rowIndex, newWidth: width, newHeight: height}, function(data){ updateWarenkorb(data); source.focus(); }); } else { var quan = $(anz)[0].value; $("#shoppingcart").load("/shopcart.ajax.php", {index: rowIndex, newQuan: quan}, function(data){ updateWarenkorb(data); source.focus(); }); } } function scDelete(source, rowIndex) { $("#shoppingcart").load("/shopcart.ajax.php", {index: rowIndex, action: 'delete'}, function(data){ updateWarenkorb(data); }); } function updateWarenkorb(data) { var z = $('#sccounter').val(); var z1 = $('#scfullprice').val(); $('#scheadartikel').text(z); $('#scheadprice').text(z1); } function formatChanged() { $("#material").load("/produkt_material.ajax.php", {format: document.forms.produkt.format.value, cat: document.forms.produkt.catid.value }); } function materialChanged() { $("#weiterverarbeitung").load("/produkt_material.ajax.php", {format: document.forms.produkt.material.value, cat: document.forms.produkt.catid.value }); document.forms.produkt.auflage.disabled = false; return false; } function valueChanged(theSource, theTarget) { // setzen der Hidden-Variable für theSource myId = theSource.id; hiddenFieldName = 'h'+myId; hiddenField = document.forms.produkt[hiddenFieldName]; hiddenField.value = theSource.value; // index für das Select-Element finden zielIndex = 0; elementArrayLength = document.forms.produkt.elements.length; for (i= 0; i < elementArrayLength; i++) { if (document.forms.produkt.elements[i] == theSource) { zielIndex = i; break; } } /* // Variablen fuer history theMaterial = null; theFormat = null; theUmfang = null; theWv = null; theType = null; theMaterial_val = -1; theFormat_val = -1; theUmfang_val = -1; theWv_val = -1; theType_val = -1; */ theForm = document.forms.produkt; // Werte für alle nachfolgenden Select-Element löschen // inklusive hidden-fields resetCounter = 0; for (i=zielIndex+1; i < elementArrayLength; ++i) { theElement = document.forms.produkt.elements[i]; if (theElement.tagName == 'SELECT') { for (j=theElement.length-1; j > 0; --j) { theElement.remove(j); } selectId = theElement.id; hfieldName = 'h'+selectId; hfield = document.forms.produkt[hfieldName]; hfield.value=''; resetCounter++; } } if (resetCounter > 0) document.forms.produkt.auflage.disabled = true; /* if (theForm.material) { theMaterial = theForm.material.innerHTML; theMaterial_val = theForm.material.selectedIndex } if (theForm.format) { theFormat = theForm.format.innerHTML; theFormat_val = theForm.format.selectedIndex; } if (theForm.umfang) { theUmfang = theForm.umfang.innerHTML; theUmfang_val = theForm.umfang.selectedIndex; } if (theForm.weiterverarbeitung) { theWv = theForm.weiterverarbeitung.innerHTML; theWv_val = theForm.weiterverarbeitung.selectedIndex; } if (theForm.produktuntertyp) { theType = theForm.produktuntertyp.innerHTML; theType_val = theForm.produktuntertyp.selectedIndex; } alert('history:write format: ' + theFormat + ' material: ' + theMaterial + ' auflage: ' + document.forms.produkt.auflage.value ); $.history({ 'format': theFormat, 'material': theMaterial, 'umfang': theUmfang, 'weiterverarbeitung': theWv, 'produktuntertyp': theType, 'auflage': document.forms.produkt.auflage.value, 'aufldisabled': document.forms.produkt.auflage.disabled, 'format_val': theFormat_val, 'material_val': theMaterial_val, 'umfang_val': theUmfang_val, 'weiterverarbeitung_val': theWv_val, 'produktuntertyp_val': theType_val }); */ // kein Target; dann letztes Dropdown und Auflage-Input freischalten // aber vorher minorder und maxorder laden! if (!theTarget) { //document.forms.produkt.auflage.disabled = false; $.getJSON('/auflage.xajax.php', { format: document.forms.produkt.hformat.value, material: document.forms.produkt.hmaterial.value, weiterverarbeitung: document.forms.produkt.hweiterverarbeitung.value, umfang: document.forms.produkt.humfang.value, produktuntertyp: document.forms.produkt.hproduktuntertyp.value, cat: document.forms.produkt.catid.value }, function (data) { document.forms.produkt.auflage.disabled = false; //msg = 'minorder: ' + data.minorder + ' maxorder: ' +data.maxorder; //alert(msg); document.forms.produkt.auflage.value=data.minorder; document.forms.produkt.minorder.value=data.minorder; document.forms.produkt.maxorder.value=data.maxorder; saveHistory(document.forms.produkt); } ); $('#comparison_div').html(''); return; } // Ergebnis der Berechnungen und Vergleichsauflagen löschen $('#comparison_div').html(''); $("#prodimage2").hide(); $("#pgimage").show(); //$("#prod_desc").html("").show(); $(theTarget).load("/produkt_material.ajax.php", { format: document.forms.produkt.hformat.value, material: document.forms.produkt.hmaterial.value, weiterverarbeitung: document.forms.produkt.hweiterverarbeitung.value, umfang: document.forms.produkt.humfang.value, produktuntertyp: document.forms.produkt.hproduktuntertyp.value, next: theTarget.name, cat: document.forms.produkt.catid.value }, function(data) { saveHistory(document.forms.produkt); } ); // Achtung als Callback müsste hier jetzt die history gespeichert werden! } function saveHistory(theForm) { // Variablen fuer history theMaterial = null; theFormat = null; theUmfang = null; theWv = null; theType = null; theMaterial_val = -1; theFormat_val = -1; theUmfang_val = -1; theWv_val = -1; theType_val = -1; if (theForm.material) { theMaterial = theForm.material.innerHTML; theMaterial_val = theForm.material.selectedIndex } if (theForm.format) { theFormat = theForm.format.innerHTML; theFormat_val = theForm.format.selectedIndex; } if (theForm.umfang) { theUmfang = theForm.umfang.innerHTML; theUmfang_val = theForm.umfang.selectedIndex; } if (theForm.weiterverarbeitung) { theWv = theForm.weiterverarbeitung.innerHTML; theWv_val = theForm.weiterverarbeitung.selectedIndex; } if (theForm.produktuntertyp) { theType = theForm.produktuntertyp.innerHTML; theType_val = theForm.produktuntertyp.selectedIndex; } /* alert('history:write format: ' + theFormat + ' material: ' + theMaterial + ' auflage: ' + document.forms.produkt.auflage.value ); */ $.history({ 'format': theFormat, 'material': theMaterial, 'umfang': theUmfang, 'weiterverarbeitung': theWv, 'produktuntertyp': theType, 'auflage': document.forms.produkt.auflage.value, 'aufldisabled': document.forms.produkt.auflage.disabled, 'format_val': theFormat_val, 'material_val': theMaterial_val, 'umfang_val': theUmfang_val, 'weiterverarbeitung_val': theWv_val, 'produktuntertyp_val': theType_val }); } function bestellAnzahlChanged() { if (parseInt(document.forms.artikel.auflage.value) > 0) { var price = parseFloat(document.forms.artikel.singleprice.value); price = price * parseInt(document.forms.artikel.auflage.value); price = price.toFixed(2); var txtprice = price.toString()+ ' EUR'; var i = txtprice.indexOf('.'); var p2 = txtprice.substring(0, i); p2 = p2 + ',' + txtprice.substring(i+1, txtprice.length); $('#zp_gesamtpreis').html(p2); } } function auflageChanged() { var minorder = parseInt(document.forms.produkt.minorder.value); var maxorder = parseInt(document.forms.produkt.maxorder.value); var auflage = parseInt(document.forms.produkt.auflage.value); if (auflage > maxorder) { var s = 'The maximal number for this product is %1 '; s = s.replace(/%1/, String(maxorder)); alert(s); document.forms.produkt.auflage.value = maxorder; } if (auflage < minorder) { var s = 'The minimum number for this product is %1 '; s = s.replace(/%1/, String(minorder)); alert(s); document.forms.produkt.auflage.value = minorder; } if (auflage >= minorder && auflage <= maxorder) $('#submitbtn').removeAttr('disabled'); } /* function checkProduct() { if (parseInt(document.forms.produkt.auflage.value) < 1) { alert("Die Auflage muss mindestens 1 Stück betragen!"); return false; } return true; } function checkProductAndSubmit() { if (parseInt(document.forms.produkt.auflage.value) < 1) { alert("Die Auflage muss mindestens 1 Stück betragen!"); return false; } //xAjax Anfrage für Vergleich der Auflagen $("#comparison_div").load("/comparison.ajax.php",{ format: document.forms.produkt.hformat.value, material: document.forms.produkt.hmaterial.value, weiterverarbeitung: document.forms.produkt.hweiterverarbeitung.value, umfang: document.forms.produkt.humfang.value, produktuntertyp: document.forms.produkt.hproduktuntertyp.value, auflage: document.forms.produkt.auflage.value, catid: document.forms.produkt.catid.value}, function(data) { $("#pgimage").hide(); document.images['tstimg'].src=document.forms.comparisonform.artnr.value; $("#prodimage2"). bind('click', function(event){ var url = '/detailImg.php?src='+document.forms.comparisonform.artnr_b.value; window.open(url, 'Tapeterie', "top="+event.pageY+",left="+event.pageX+",width=600,height=450,status=no,resizable=no,location=no"); }) .show(); //$("#prodimage2").show(); //$("#prodimg2anchor").attr('href', '/detailImg.php?src='+document.forms.comparisonform.artnr_b.value); $("#prod_desc").html(document.forms.comparisonform.artdesc.value).show(); adjustLayout(); }); return false; } */ function doOrder(auflage) { aufl = parseInt(auflage); document.forms.comparisonform.auflage.value = aufl; document.forms.comparisonform.submit(); } function menuAction() { $('li:has(ul)') .click(function(event) { if (! this.id) return; var id = this.id; var l = id.length; var sub = id.substring(2, l); location.href=sub; return false; }); $('li:not(:has(ul))') .click(function(event) { if (! this.id) return; var id = this.id; var l = id.length; var sub = id.substring(2, l); location.href=sub; return false; }); } function myToggle(element) { $('div[name='+element+']').toggle('slow').corner(); adjustLayout(); } function roundCorners() { $('.round').corner({ bl: { radius: 5 }, br: { radius: 5 }, tl: { radius: 5 }, tr: { radius: 5 }, antiAlias: true, autoPad: true}); } function roundBottom() { $('.roundbottom').corner({ tl: false, tr: false, bl: { radius: 5 }, br: { radius: 5 }, antiAlias: true, autoPad: true}); } function roundTop() { $('.roundtop').corner({ bl: false, br: false, tl: { radius: 5 }, tr: { radius: 5 }, antiAlias: true, autoPad: true}); } function checkRegistrationData() { $('#adressformid') .submit(function(event) { //alert('checking'); }); } function adjustLayout(minHeight) { //alert('dummy: ' + dummy); var cHeight = $("#central_wrapper").height(); if (minHeight) { //alert(minHeight); if (minHeight > cHeight) cHeight = minHeight; if (dummy) if (dummy > cHeight) cHeight = dummy; } var lHeight = $("#nav_wrapper").height(); var rHeight = $("#right_wrapper").height(); var bHeight = $("#central_wrapper > div.content_container > div:first").height(); bHeight -= 10; var maxHeight = Math.max(bHeight, Math.max(cHeight, Math.max(lHeight, rHeight))); //alert("maxHeight: " + maxHeight + " bHeight: "+ bHeight + " sum: " + sum); if (bHeight != maxHeight) $("#central_wrapper").height(maxHeight); if (lHeight != maxHeight) $("#nav_wrapper").height(maxHeight); if (rHeight != maxHeight) $("#right_wrapper").height(maxHeight); } function showTooltip(event, id) { var realid = '#'+id; var xpos = 0; var ypos = 0; if (event.layerX) { xpos = parseInt(event.layerX) + 10; ypos = event.layerY; } else { xpos = parseInt(event.x); ypos = parseInt(event.y); } //$(realid).css('top',ypos+'px'); //$(realid).css('left',xpos+'px'); //$(realid).show(); $(realid).css({ 'top': ypos+'px', 'left': xpos + 'px' }).show(); } function delAdress(newUrl) { var message = 'Are you sure that you want to delete this address?'; if (confirm(message)) { location.href = '/'+newUrl; return true; } return false; } function clearShipping() { var mng = $("input[name=deladrid]"); mng.attr('checked',''); } function changeInvoice() { $('#delnotinv').click(); } function checkPayment() { var message = 'How would you like to pay?'; var i = document.forms.zahlung.zselect.selectedIndex; if (i < 1) { alert(message); return false; } return true; } function checkSearchPhrase() { var sp = document.search_form.searchphrase.value; var len = sp.length; if (len < 3) { var message = 'You did not insert any item for research'; alert (message); return false; } return true; } function checkAGB() { var isChecked = $('#agb').attr('checked'); if (!isChecked) { var message = 'Please accept the terms of business.'; alert(message); return false; } $('#agbform').get(0).submit(); } function checkUploadForm() { var emptycount = 0; var nonemptycount = 0; var value; var elements = $(':file'); //alert('found '+ elements.size() +' file elements'); for (i=0; i < elements.size(); ++i) { value = elements[i].value; value = value.replace(' ', ''); if (value == '') emptycount++; else nonemptycount++; } if (nonemptycount == 0) { var message = 'No uploadfile selected'; alert(message); return false; } return true; }