
/* ####################################################
   ####################################################
   ##                                                ##
   ## THE SHOPPING CART		                     ##
   ## Version 1.1                                    ##
   ## Written by Dane Moodie                         ##
   ## (c)2000                                        ##
   ## Please do not claim any of this code as your   ##
   ## own.                                           ##
   ## If you make any interesting modifications      ##
   ## to the code, I am always interested in seeing  ##
   ## them. Email me at: milhous@paradise.net.nz     ##
   ##                                                ##
   ##                                                ##
   ####################################################
   ####################################################

The code is written entirely in HTML and Java Script. It functions exactly the same on
either Internet Explorer or Netscape. This program represents a basic shell for an
e-shop. It can easily be extened by adding extra pages, and extra products to each page.
There is really no maximum to the number of products you can display with this site, although
it will begin to become more unmanagable as the number goes over a couple of a hundred.
All processing takes place on the users computer. The server is only used to receive the
order form once the user has finished their shopping.
All functions are commented. Also the HTML representing Product One on Page One is commented
and explains exactly how to add a new product to a page.
*/

/* --------------------------------------------------------------------------------- 

	This function is used to create instances of products. Each product must be
    represented by an object in the following form. The parameters are all self-
    explainatory - the PRICE of the product - the NAME of the product - the URL
    of the product on your site - the ID of the product. The product ID is essencial
    because this is sent back to you rather than the name of the product.*/
    
function product(price, name, location, id) {
   this.price = price; 
   this.name = name;
   this.location = location;
   this.id = id;
}

/* --------------------------------------------------------------------------------------------

	This code creates instances of the nine demo products on this site. It is recommended
   that you maintain a naming system similar to the one below to avoid confusion as the
   size of your site increases. (eg pgone_prone means page one - product one (the first
   product displayed on the first page)).*/

// ***INSERT HERE***

urenreg2003 = new product(139.00, "Nedsoft Urenregistratie 2003", "../producten/Administratieve_software/Urenregistratie/Urenregistratie.htm", 303677);
uren1xtra = new product(119.00, "Urenregistratie 1 extra gebruiker", "../producten/Administratieve_software/Urenregistratie/Urenregistratie.htm", 303944);
uren5xtra = new product(567.50, "Urenregistratie 5 extra gebruikers", "../producten/Administratieve_software/Urenregistratie/Urenregistratie.htm", 303945);
uren10xtra = new product(1089.00, "Urenregistratie 10 extra gebruikers", "../producten/Administratieve_software/Urenregistratie/Urenregistratie.htm", 303946);
uren20xtra = new product(2129.00, "Urenregistratie 20 extra gebruikers", "../producten/Administratieve_software/Urenregistratie/Urenregistratie.htm", 303047);

kilometer2001 = new product(31.30, "Nedsoft Kilometerdeclaratie 2001", "../producten/Administratieve_software/kilometerdecla/kilometerdeclaratie.htm", 302474);
kilometer2003 = new product(49.00, "Nedsoft Kilometerdeclaratie 2003", "../producten/Administratieve_software/kilometerdecla02/kilometerdeclaratie02.htm", 303087);

kas2003 = new product(59.00, "Nedsoft Kasboek 2003", "../producten/Administratieve_software/kasboek/kasboek.htm", 303675);

persz = new product(229.00, "Personeelszaken", "../producten/Administratieve_software/personeelszaken/personeelszaken.htm", 302155);
perszonb = new product(859.90, "Personeelszaken voor onbeperkt aantal werknemers", "../producten/Administratieve_software/personeelszaken/personeelszaken.htm", 302159);

repb = new product(139.00, "Reparatiebeheer", "../producten/Administratieve_software/reparatiebeheer/reparatiebeheer.htm", 301835);
voorr = new product(89.00, "Voorraadbeheer", "../producten/Administratieve_software/voorraadbeheer/voorraadbeheer.htm", 302233);
prikklok = new product(499.00, "Prikklok", "../producten/Administratieve_software/prikklok/prikklok.htm", 303931);
prikklok1 = new product(20.00, "10 extra magneetkaarten", "../producten/Administratieve_software/prikklok/prikklok.htm", 301091);
prikklok2 = new product(399.00, "Prikklok met 1 extra scanner(klokingang)", "../producten/Administratieve_software/prikklok/prikklok.htm", 303948);
prikklok3 = new product(99.00, " Prikklok met 1 extra monitor", "../producten/Administratieve_software/prikklok/prikklok.htm", 303949);
prikklok4 = new product(149.00, " Prikklok met 1 extra manager", "../producten/Administratieve_software/prikklok/prikklok.htm", 303988);

adressen = new product(44.90, "Creëer & Beheer Adressen", "../producten/Administratieve_software/c&badressen/c&badressen.htm", 300391);

gsmlink = new product(40.35, "GSM-Link", "../producten/Utilities/gsm-link/gsm-link.htm", 302234);
crashdok = new product(40.35, "Crash-Dokter", "../producten/Utilities/crashdokter/crashdokter.htm", 301580);
//diskar = new product(13.15, "DiskArchief", "../producten/Utilities/diskarchief/diskarchief.htm", 300564);
eurocalc = new product(26.75, "Eurocalculator", "../producten/Utilities/eurocalculator/eurocalculator.htm", 300395);
internetp = new product(22.65, "Internet Politie", "../producten/Utilities/internetpolitie/internetpolitie.htm", 300659);
adresbestpro = new product(224.60, "Adresbestand Pro", "../producten/Directmail/adresbestandpro/adresbestandpro.htm", 302171);
adresbest = new product(111.15, "Adresbestand", "../producten/Directmail/adresbestand/adresbestand.htm", 301767);
wince200 = new product(22.20, "200 programma's voor Windows CE", "../producten/Palmtop-software/Palmtop.htm", 300753);
psion5 = new product(22.20, "120 Psion 5 programma's", "../producten/Palmtop-software/Palmtop.htm", 300439);
psion3 = new product(22.20, "400 Psion 3 programma's", "../producten/Palmtop-software/Palmtop.htm", 300418);
palmp250 = new product(22.20, "250 PalmPilot programma's", "../producten/Palmtop-software/Palmtop.htm", 300671);

eurofpro = new product(67.60, "EuroOffice Pro", "../producten/utilities/euroofficepro/euroofficepro.htm", 303009);
eurofpro5 = new product(324.45, "EuroOffice Pro 5 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303031);
eurofpro10 = new product(635.25, "EuroOffice Pro 10 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303032);
eurofpro20 = new product(1243.35, "EuroOffice Pro 20 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303033);
eurofpro50 = new product(2873.55, "EuroOffice Pro 50 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303011);
eurofpro100 = new product(4800.50, "EuroOffice Pro 100 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303012);
eurofpro500 = new product(20283.95, "EuroOffice Pro 500 extra gebruikers", "../producten/utilities/euroofficepro/euroofficepro.htm", 303013);
eurof = new product(44.90, "EuroOffice", "../producten/utilities/eurooffice/eurooffice.htm", 303015);
eurof5 = new product(217.80, "EuroOffice 5 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303028);
eurof10 = new product(426.55, "EuroOffice 10 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303029);
eurof20 = new product(834.95, "EuroOffice 20 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303030);
eurof50 = new product(1928.55, "EuroOffice 50 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303017);
eurof100 = new product(3217.30, "EuroOffice 100 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303018);
eurof500 = new product(13590.70, "EuroOffice 500 extra gebruikers", "../producten/utilities/eurooffice/eurooffice.htm", 303019);


eurofprol = new product(67.60, "EuroOffice Pro \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303009);
eurofprol5 = new product(324.45, "EuroOffice Pro 5 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303031);
eurofprol10 = new product(635.25, "EuroOffice Pro 10 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303032);
eurofprol20 = new product(1243.35, "EuroOffice Pro 20 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303033);
eurofprol50 = new product(2873.55, "EuroOffice Pro 50 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303011);
eurofprol100 = new product(4800.50, "EuroOffice Pro 100 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303012);
eurofprol500 = new product(20283.95, "EuroOffice Pro 500 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303013);
eurofl = new product(44.90, "EuroOffice \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303015);
eurofl5 = new product(217.80, "EuroOffice 5 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303028);
eurofl10 = new product(426.55, "EuroOffice 10 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303029);
eurofl20 = new product(834.95, "EuroOffice 20 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303030);
eurofl50 = new product(1928.55, "EuroOffice 50 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303017);
eurofl100 = new product(3217.30, "EuroOffice 100 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303018);
eurofl500 = new product(13590.70, "EuroOffice 500 extra gebruikers \(alleen licentie\)", "../producten/Utilities/euroofficeprol/euroofficeprol.htm", 303019);

webontwerper = new product(38.55, "WebOntwerper", "../producten/Utilities/webontwerper/webontwerper.htm", 303034);

virtuelecdrom = new product(58.50, "Virtuele CD-Romspeler", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 303042);

virtuelecdrom1 = new product(53.55, "Virtuele CD-Romspeler 1 extra gebruiker", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 303102);
virtuelecdrom5 = new product(247.9, "Virtuele CD-Romspeler 5 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 303103);
virtuelecdrom10 = new product(477.95, "Virtuele CD-Romspeler 10 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 303104);
virtuelecdrom20 = new product(932.10, "Virtuele CD-Romspeler 20 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 303105);
virtuelecdrom40 = new product(10.00, "Virtuele CD-Romspeler 40 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 000000);
virtuelecdrom50 = new product(10.00, "Virtuele CD-Romspeler 50 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 000000);
virtuelecdrom100 = new product(10.00, "Virtuele CD-Romspeler 100 extra gebruikers", "../producten/Utilities/virtuelecdromspeler/virtuelecdromspeler.htm", 000000);

factuur = new product(159.00, "Nedsoft Factuur", "../producten/Administratieve_software/factuur/factuur.htm", 303130);
factuur1 = new product(149.00, "Nedsoft Factuur 1 extra gebruiker", "../producten/Administratieve_software/factuur/factuur.htm", 303271);
factuur5 = new product(679.00, "Nedsoft Factuur 5 extra gebruikers", "../producten/Administratieve_software/factuur/factuur.htm", 303272);
factuur10 = new product(1299.00, "Nedsoft Factuur 10 extra gebruikers", "../producten/Administratieve_software/factuur/factuur.htm", 303273);
factuur20 = new product(2549.00, "Nedsoft Factuur 20 extra gebruikers", "../producten/Administratieve_software/factuur/factuur.htm", 303274);

postage = 6.81;

/* ----------------------------------------------------------------------------------------

	This function sets a cookie. When a customer buys a product, the quantity is stored in 
	a cookie represented by the products name. Each product bought has its own cookie.
	These are destoyed automatically when the customer leaves the site because they have
	no expiry date. There is nothing to stop you adding an expiry date to these cookies
	however. */

function setCookie(name, value) {
document.cookie = name + "=" + escape(value);
}
//setCookie(top.factuur.name, 0);

/* ------------------------------------------------------------------------------------

	This function gets a cookie that had previously been set with the function above.
   It accepts a parameter representing the name of a product, which you will recall
   is also the name of that products cookie. If it finds a cookie it returns the value
   representing the quantity of that product the customer has bought. */

function getCookie(name){
var Search = name + "=";
if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(Search)
	if (offset != -1) {
		offset += Search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
		}
	}
}

/* -------------------------------------------------------------------------------------

	This function is called everytime you want to convert a number into a currency.
   For instance, if you send it 8.87634 it will return 8.88. If you send it 45.5 it
   will return 45.50. */

function roundToCents(n)
{
cents = n * 100;
cents = Math.round(cents);
strCents = "" + cents;
len = strCents.length;
	
first = strCents.substring(0, len - 2) + ".";
last = strCents.substring(len - 2, len);
	
	if (first == "."){
	   first = "0.";
  	}
	
	if (last.length == 1){
	   last += "0";
	}
	
return first+last;
}
function showIt(){
alert('dit werkt wel');
}
