// parametre à modifier
// Copyright 2002 SRDEV
// Version Francaise
//
//static var isBasketLoaded;
// Ligne 430 // 1 = 19.6 5 = 5.5
// Kunde.shipuid = 1; pour TVA 19.6 5 pour tva 5.5 - voir ligne 37 pour les taux
if (parent.rightFrame.document.getElementById('nbrart').value=="")
{
isBasketLoaded = false;
var items = new Array();
}
if (parent.rightFrame.document.getElementById('nbrart').value.charAt(0)=="A")
{
isBasketLoaded = false;
var items = new Array();
}
var SSL = false;
var backToShopURL = new String("accueil.php");
var nrOfItems = 0;
var versand = 0;
var nachnahme = 0;
var orderitems = new String("");
var orderpaymethod = new String("");
var Kunde = new customer('','','','','','','','','','','','','',0,'',0,'','','','','','',''); // client
var Bestellung = new order('','','','','','','','',''); // commission; commande
var orderWindow;
var shipuid_inland = new Array();
var shipuid_ausland = new Array();
var vatitems = new Array();
//vatitems[vatitems.length] = new vat(0,'','','aucune','0',0);
vatitems[vatitems.length] = new vat(1,'','','19.6','19.6' ,0);
vatitems[vatitems.length] = new vat(5,'','','5.5','5.5' ,0);
function replacediese(msgr)
{
for (n=0; n < 3000; n++)
{
msgr = msgr.replace("#","²");
msgr = msgr.replace("__"," ");
}
return msgr;
}
function printEMail(nom, mailfrom) {
var s = new String("");
var msg = new String("");
//var mailfrom = new String("");
var Now = new Date();
var DateStr = Now.getDate() + '.';
var year = Now.getYear();
if (year < 2000) year += 1900;
if ((Now.getMonth()+1) < 10) DateStr += '0' + (Now.getMonth()+1) + '.' + year
else DateStr += (Now.getMonth()+1) + '.' + year;
msg = printMessage(DateStr);
mailfrom='paiement@auconfortdelamaison.com';
nomurl='http://www.auconfortdelamaison.com';
//site_cgi='';
ibs_site='1999888';
ibs_rang='99';
boundary=1227326566;
if (Kunde.paymethod == "Scheck")
{
s += '
\n';
} else if (Kunde.paymethod == "Frafinance")
{
s += '\n';
} else if (Kunde.paymethod == "crembours")
{
s += '\n';
} else if (Kunde.paymethod == "virement")
{
s += '\n';
} else if (Kunde.paymethod == "ps")
{
s += '\n';
} else {
//s += '\n';
}
//if (Kunde.vorname != "")
//{
parent.bas.location="service/gestion/enreg_php.php?boundary="
+ boundary + "&enregphp1="
+ Bestellung.items
+ "&enregphp2=" + Bestellung.delivery
+ "&enregphp3=" + Bestellung.total
+ "&enregphp4=" + Bestellung.vat
+ "&client=" + Kunde.anrede
+ "__" + Kunde.vorname
+ "__" + Kunde.nachname
+ "__" + Kunde.zusatz
+ "__" + Kunde.firma
+ "__" + Kunde.strasse
+ "__" + Kunde.plz
+ "__" + Kunde.ort
+ "__" + Kunde.land
+ "__" + Kunde.telefon
+ "__" + Kunde.email
+ "__" + Kunde.bemerkung
+ "__" + Kunde.codepromo
+ "&paiement=" + Kunde.paymethod
//}
return s;
}
function affichenbbasket ()
{
// Affiche le nombre d'article à droite
if ( nrOfItems<2 ) { ss="";} else { ss="s";} //rajout du pluriel
//parent.rightFrame.basket.nbrart.value=items[1].price ;
var subtotal = 0;
var total = 0;
for (var i=0; i < items.length; i++) {
if (items[i].qty > 0) {
subtotal = items[i].qty * items[i].price;
total += subtotal;
}
}
parent.rightFrame.document.getElementById('nbrart').value=nrOfItems + ' article' +ss+" - "+convdec(total) + " €";
//parent.topFrame.form1.nbarticle.value=nrOfItems + ' article' +ss+" - "+convdec(total) + " €";
}
function showBasket(location) {
var pos = location.pathname.lastIndexOf('/');
if (pos != -1) {
backToShopURL = location.pathname.substring(pos+1,location.pathname.length);
}
parent.mainFrame.location = "basket.php";
}
function getURL(filename) {
var url = new String(filename);
if (document.location.protocol == 'https:') {
parent.mainFrame.location = url;
} else {
parent.mainFrame.location = url;
}
}
function browser()
{
var b = new String("unknown");
if (navigator.appName == "Netscape")
b = "NN" + navigator.appVersion.charAt(0)
else if (navigator.appName == "Microsoft Internet Explorer")
b = "MSIE" + navigator.appVersion.charAt(0);
return b;
}
function checknum(str) {
if (str == "") {
alert("Veuillez indiquer une valeur comprise entre 0 et 10.")
return false
}
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i + 1)
if (ch < "0" || ch > "9") {
alert("Veuillez indiquer une valeur comprise entre 0 et 10.")
return false
}
}
return true
}
function StringToFloat(str) {
var s = new String("");
if (str.indexOf(",") >= 0) {
s = str.substring(0, str.indexOf(",")) + "." + str.substring(str.indexOf(",")+1, str.length);
} else s = str;
return(parseFloat(s));
}
var eurokurs = StringToFloat('6,55957');
function convdec(str) {
if (str == 0) {
return "0,00";
} else {
var s = "" + Math.round(str * 100);
return(s.substring(0, s.length-2) + "," + s.substring(s.length-2, s.length));
}
}
function posname(name) {
var j = -1;
for (var i = 0; i < items.length; i++) {
if (items[i].name == name) {
j = i;
}
}
return j;
}
function posimage(image) {
var j = -1;
for (var i = 0; i < items.length; i++) {
if (items[i].image == image) {
j = i;
}
}
return j;
}
function getNrOfItems() {
var j = 0;
for (var i = 0; i < items.length; i++) {
j += items[i].qty;
}
return j;
}
function vat(vid,vstateshort,vstatelong,vname,vvalue,vtotal) {
this.vid = vid;
this.vstateshort = vstateshort;
this.vstatelong = vstatelong;
this.vname = vname;
this.vvalue = StringToFloat(vvalue);
this.vtotal = vtotal;
}
function item(artnr,name,price,qty,uid,image) {
this.artnr = artnr;
this.name = name;
this.price = price;
this.qty = qty;
this.uid = uid;
this.image = image;
}
function customer(anrede,vorname,nachname,zusatz,firma,strasse,plz,ort,land,telefon,email,
sendemail,shipto,shipcost,shiptext,shipuid,paymethod,
bank,bankktonr,bankblz,bankcustname,bemerkung, codepromo)
{
this.anrede = anrede;
this.vorname = vorname;
this.nachname = nachname;
this.zusatz = zusatz;
this.firma = firma;
this.strasse = strasse;
this.plz = plz;
this.ort = ort;
this.land = land;
this.telefon = telefon;
this.email = email;
this.sendemail = sendemail;
this.shipto = shipto;
this.shipcost = shipcost;
this.shiptext = shiptext;
this.shipuid = shipuid;
this.paymethod = paymethod;
this.bank = bank;
this.bankktonr = bankktonr;
this.bankblz = bankblz;
this.bankcustname = bankcustname;
this.bemerkung = bemerkung;
this.codepromo = codepromo;
}
function order(paymethod,items,subtotal,delivery,cod,total,euro,vat,paymethodshort) {
this.paymethod = paymethod;
this.items = items;
this.subtotal = subtotal;
this.delivery = delivery;
this.cod = cod;
this.total = total;
this.euro = euro;
this.vat = vat;
this.paymethodshort = paymethodshort;
}
function initBasket(redirect,timeout) {
var danke = false;
var ret = false;
var mailScript = true;
var msgTxt = new String("Les informations vont être transmises par e-mail grâce au service de traitement automatique mis en place par Micro Application. Ce service ne contrôle ni n\'enregistre aucune donnée contenue dans cet e-mail.\n\nCes informations ne sont ni cryptées ni sécurisées. Elles sont susceptibles d\'être interceptées par un tiers.\n\nVous pouvez poursuivre ou annuler cette opération.");
var mailscripturl = 'http://microapp.internet-fr.net/mailscript/mws_mail.cgi';
if (mailScript == true)
mailscripturl == ''
ret = true;
danke = true;
if (ret == true) {
var orderWin=window.open("", "OrderWindow", "scrollbars=yes,width=300,height=100");
}
for (var i = 0; i < items.length; i++) {
items[i].qty = 0;
}
nrOfItems = 0;
if (danke == true) {
if (redirect != '') {
parent.mainFrame.location=redirect;
}
}
return ret;
}
function cancelOrder() {
if (document.location.protocol == 'https:') {
self.location = '';
} else {
for (var i = 0; i < items.length; i++) {
items[i].qty = 0;
}
nrOfItems = 0;
parent.mainFrame.location = 'accueil.php';
}
affichenbbasket();
parent.rightFrame.basket.nbrart.value="Aucun article";
alert("Votre commande a été annulée !");
}
function position(artnr)
{
var j = -1;
for (var i = 0; i < items.length; i++)
{
//alert (i+" = "+items.length+" pour "+artnr+" "+items[i].artnr);
if (items[i].artnr == artnr)
{
j = i;
}
}
return j;
}
function addToBasket(form) {
//alert(form.elements[0].value);
//if (form != "[object]") {alert ("Désolé mais je dois recharger la page suite à un dysfonctionnement de votre navigateur au niveau du //javascript !"); parent.location = 'index.php';}
var g=0;
var h=g+1, i=g+2, j=g+3, k=g+4, l=g+5, m=g+6, n=g+7, o=g+8, p=g+9;
var p_artnr = form.elements['artnr'].value;
//alert(p_artnr);
//alert(form.elements[n].name);
var p_name = form.elements['name'].value;
if (form.elements['label1'].type == 'select-one') {
p_name += ', ' + form.elements['label1'].value;
p_name += ': ' + form.elements['option1'].options[form.elements['option1'].selectedIndex].value;
}
if (form.elements[o].type == 'select-one') {
p_name += ', ' + form.elements['label1'].value;
p_name += ': ' + form.elements['option1'].options[form.elements['option1'].selectedIndex].value;
}
var p_price = StringToFloat(form.elements['price'].value);
var p_uid = form.elements['uid'].value.charAt(0);
var p_image = form.elements['image1'].value;
var p_qty = parseInt(form.elements['quantity'].value,10);
// parseInt(form.elements[p].options[form.elements[p].selectedIndex].value,10);
var pos = position(p_artnr);
if (p_price > 0 ) {
if (pos >= 0 ) { // Artikel befindet sich bereits im Warenkorb
if (items[pos].name == p_name) {
items[pos].qty += p_qty;
// if (items[pos].qty > 10) items[pos].qty = 10; // maximale Bestellmenge pro Artikel = 10
} else {
items[items.length] = new item(p_artnr,p_name,p_price,p_qty,p_uid,p_image);
}
} else {
items[items.length] = new item(p_artnr,p_name,p_price,p_qty,p_uid,p_image);
}
}
nrOfItems = getNrOfItems();
// affichage du nombre d'element sur page droite
//alert('P2');
affichenbbasket();
// message de prise en compte peut être remplacé par une page qui s'affiche en petit et pendant 2 secondes
var Valide = window.open("Valide.php", "valide", "scrollbars=no,width=400,height=270");
//alert('P3');
//alert('L\'article a été prit en compte...');
}
function deleteFromBasket(artnr) {
var pos = position(artnr);
//alert (pos);
items[pos].qty = 0;
nrOfItems = getNrOfItems();
parent.mainFrame.location="basket.php";
affichenbbasket();
}
function updateBasket(form) {
for (var g = 0; g < form.elements.length-1; g += 2) {
var h = g + 1;
var p_artnr = form.elements[g].value;
var p_qty = parseInt(form.elements[h].value,10);
var pos = position(p_artnr);
if (pos >= 0 ) { // Artikel befindet sich bereits im Warenkorb
items[pos].qty = p_qty;
// if (items[pos].qty > 10) items[pos].qty = 10; // maximale Bestellmenge pro Artikel = 10
}
}
nrOfItems = getNrOfItems();
parent.mainFrame.location="basket.php";
affichenbbasket();
}
function showBasketItems() {
var s = new String("");
var subtotal = 0;
var total = 0;
for (var i=0; i < items.length; i++) {
if (items[i].qty > 0) {
s += '
';
s += '
';
s += '';
s += '';
s += '
';
s += '
';
s += '';
s += '
';
s += '
';
s += ' '+items[i].name+'';
s += '
';
s += '
' + convdec(items[i].price) + '
';
subtotal = items[i].qty * items[i].price;
total += subtotal;
s += '
' + convdec(subtotal) + '
';
s += '
\n';
s += '
';
}
}
s += '
';
s += '
';
s += '
';
s += '
Total :
';
s += '
' + convdec(total) + '
';
s += '
';
s += '
';
s += '
';
s += 'Si vous avez modifié les quantités, cliquez sur : ';
s += '';
s += '
';
s += '
';
s += '
';
return s;
affichenbbasket();
}
function processOrderStep1(form) {
for (var i=0; i < form.elements.length; i++)
{
Kunde.shipto = form.elements[i].value;
Kunde.shipcost = form.shipping1.options[form.shipping1.selectedIndex].value;
//alert (Kunde.shipcost);
Kunde.shiptext = form.shipping1.options[form.shipping1.selectedIndex].text;
Kunde.shipuid = 1; //shipuid_inland[form.shipping1.selectedIndex];
//alert (Kunde.shipuid);
if ((form.elements[i].name == 'paymethod') && (form.elements[i].checked == true)) {
Kunde.paymethod = form.elements[i].value;
}
}
//alert (Kunde.paymethod);
if (Kunde.paymethod == 'Kreditkarte') {}
if (Kunde.paymethod == 'Frafinance') {}
if (Kunde.paymethod == 'Bankeinzug') {
Kunde.bank = form.bank.value;
Kunde.bankktonr = form.bankktonr.value;
Kunde.bankblz = form.bankblz.value;
Kunde.bankcustname = form.bankcustname.value;
}
if (Kunde.paymethod == 'Nachnahme') {
nachnahme = StringToFloat('30');
} else {
nachnahme = 0;
}
parent.mainFrame.location = 'order2.php';
}
function processOrderStep2(form) {
for (var i=0; i < form.anrede.length; i++) {
if (form.anrede[i].checked) {Kunde.anrede = form.anrede[i].value;}
}
Kunde.vorname = form.vorname.value;
Kunde.nachname = form.nachname.value;
Kunde.zusatz = form.zusatz.value;
Kunde.firma = form.firma.value;
Kunde.strasse = form.strasse.value;
Kunde.plz = form.plz.value;
Kunde.ort = form.ort.value;
Kunde.land = form.land.value;
Kunde.telefon = form.telefon.value;
Kunde.email = form.email.value;
Kunde.bemerkung = form.bemerkung.value;
Kunde.codepromo = form.codepromo.value;
parent.mainFrame.location = 'order3.php';
}
function setStatus(form) {
var s = new String("");
for (var i=0; i < form.elements.length; i++) {
if (form.elements[i].type == 'radio') {
var radiofield = form.elements[i];
var radiovalue = eval('Kunde.'+radiofield.name);
if (radiovalue == '' && radiofield.name == 'paymethod') {
radiofield.checked = true;
/*
if (isNaN(form.paymethod.length)) {
form.paymethod.checked = true;
} else {
form.paymethod[0].checked = true;
}
*/
} else {
if (radiofield.value == radiovalue) {radiofield.checked = true;}
}
}
if (form.elements[i].type == 'select-one') {
var selectfield = form.elements[i];
for (var j=0; j < selectfield.length; j++) {
if (selectfield.name.indexOf('shipping') == 0) {
var text = Kunde.shiptext;
} else {
var text = eval('Kunde.'+selectfield.name);
}
if (selectfield.options[j].text == text) {selectfield.options[j].selected = true;}
}
}
if (form.elements[i].type == 'checkbox') {
var checkboxfield = form.elements[i];
if (checkboxfield.value == eval('Kunde.'+checkboxfield.name)) {checkboxfield.checked = true;}
}
}
}
function showOrderItems() {
Bestellung.items = '';
var s = new String("");
var versand = StringToFloat(Kunde.shipcost);
var subtotal = 0;
var total = 0;
for (var i=0; i < vatitems.length; i++) {vatitems[i].vtotal = 0}
for (var i=0; i < items.length; i++) {
if (items[i].qty > 0) {
s += '
';
codepromo = 0; // Code promo
// pour le moment 10% de remise avec code = RSAT10
// pour le moment 20% de remise avec code = RSBL20
//alert (Kunde.codepromo);
if (Kunde.codepromo == 'RSAT25') codepromo = 25; // 25%
if (Kunde.codepromo == 'RSBL20') codepromo = 20;
if (codepromo > 0)
{
s += '
';
s += 'Remise sur code :
';
s += '
';
s += '' + convdec(((total*codepromo)/100)) + '
';
}
total = total - ((total*codepromo)/100);
Bestellung.subtotal = 'Sous-total__' + convdec(total); // SOUS TOTAL DES ARTICLES
// Versandkosten
if (Kunde.shipuid > 0)
{
for (var j=0; j < vatitems.length; j++) {
if (vatitems[j].vid == Kunde.shipuid) {
vatitems[j].vtotal += Kunde.shipcost - (Kunde.shipcost / (1+(vatitems[j].vvalue / 100)));
//alert (Kunde.shipcost);
//alert (vatitems[j].vvalue);
//alert (vatitems[j].vtotal);
}
}
}
s += '
';
s += '
';
s += '+ Port et emballage :
';
s += '
';
s += '' + convdec(versand) + '
';
Bestellung.delivery = '+ Port et emballage__' + convdec(versand);
// Nachnahme
// Gesamtbetrag inkl. MwSt.
Bestellung.total = 'Total__' + convdec(total+versand+nachnahme);
IBS_TOTAL = total+versand+nachnahme;
// Affichage TVA
Bestellung.vat = '';
var vattotal = 0;
for (var j=0; j < vatitems.length; j++) {
if (vatitems[j].vid > 0)
{
if (vatitems[j].vtotal > 0)
{
s += '
';
s += 'Dont TVA ' + vatitems[j].vname + ' :
';
s += '
';
s += '' + convdec(vatitems[j].vtotal-((vatitems[j].vtotal*codepromo)/100)) + '
';
if (Bestellung.vat != '') {Bestellung.vat += '¶__';}
Bestellung.vat += 'Montant TVA__' + convdec(vattotal);
// Envoyer les données pour enregistrement Dans la base MYSQL (.php)
//alert (Kunde.vorname);
return s;
}
function showOrder1Form() {
var s = new String("");
// Shipping Inland
s += '