/*  BMT 216A class file *  Copyright (C) 2001 Preben S¿gaard, Denmark *  Only for use on the 'BMT 216A The James Bond Vehicle Library' web page. *	Any other use prohibited without written consent from the webmaster *	Contact: information"@"bmt216a.dk     (address anti-Spammed - remove ") */window.onresize = new Function("window.location.reload()");var THUMBS_PATH		= "http://d6751420.u103.surftown.dk/Vehicles/Thumbs/";var PICTURE_PATH	= "http://d6751420.u103.surftown.dk/Vehicles/Pictures/";// Class Movie ...function Movie() {	this.key					= null;	this.title 					= null;	this.year 					= null;	this.actor					= null;	this.vehicles				= null;	this.vehiclesArray			= null;	this.pictureArray			= null;	this.director				= null;	this.composer				= null;	this.producer				= null;	this.screenplay				= null;	this.photography			= null;	this.editor					= null;	this.designer				= null;	this.performer				= null;		this.initializeFromString	= initializeFromStringMovie;	this.getKey					= getKey;	this.getTitle				= getTitle;	this.getYear				= getYear;	this.getActor				= getActor;	this.hasVehicles			= hasVehicles;	this.getVehicles			= getVehicles;	this.numberOfVehicles		= numberOfVehicles;	this.hasVehicleCat			= hasVehicleCat;	this.hasVehicleElement		= hasVehicleElement;	this.hasVehicleElementCat	= hasVehicleElementCat;	this.hasPicture				= hasPicture;	this.getPictures			= getPictures;	this.getDirector			= getDirector;	this.getComposer			= getComposer;	this.getPerformer			= getPerformer;}function initializeFromStringMovie(data) {	moviedata 				= data.split('*');	this.key				= moviedata[0];	this.title				= moviedata[1];	this.year				= moviedata[2];	this.actor				= moviedata[3];	this.vehicles			= moviedata[4].split(' ');	if (this.vehicles[0] != "-") {		this.vehiclesArray 		= new Array;		for ( i in this.vehicles) {			this.vehiclesArray[i] = new Vehicle;			this.vehiclesArray[i].initializeFromString(bondVehicle[this.vehicles[i]]);		}	}	this.pictureArray	= moviedata[5].split(' ');	this.director		= moviedata[6];	this.composer		= moviedata[7];	this.performer		= moviedata[8];}function getKey() {	return this.key;}function getTitle() {	return this.title;}function getYear() {	return this.year;}function getActor() {	return this.actor;}function getVehicles() {	return this.vehiclesArray;}function numberOfVehicles() {	return this.vehiclesArray.length;}function hasVehicles() {	var rc = false;	if ( this.vehicles[0] != "-") {		rc = true;	}	return rc;}function hasVehicleCat(categories, type) {	var rc = false;	if (this.hasVehicles()) {		for (k in this.vehiclesArray) {			for (j in categories) {				for (i in this.vehiclesArray[k].getCategories()) {					if (this.vehiclesArray[k].hasCategories(categories, type)) {					rc = true;					}				}			}		}	}	return rc;}function hasVehicleElement(type) {	var rc = false;	if (this.hasVehicles()) {		for (k in this.vehiclesArray) {			if (this.vehiclesArray[k].hasElement(type)) {			rc = true;			}		}	}	return rc;}function hasVehicleElementCat(elementType, categories, match) {	var rc = false;	if (this.hasVehicles()) {		for ( k in this.vehiclesArray) {			if (this.vehiclesArray[k].hasElement(elementType) && this.vehiclesArray[k].hasCategories(categories, match))				rc = true;			}	}	return rc;}function hasPicture() {	var rc = false;	if (this.pictureArray[0] != "-") {		rc = true;	}	return rc;}function getPictures() {	return this.pictureArray;}function getDirector() {	return this.director;}function getComposer() {	return this.composer;}function getPerformer() {	return this.performer;}// ... end Class Movie// *****// Class Vehicle ...// class variablesBMTauthor = new Array ("PS","JH","JH/PS","MS","MS/PS");function Vehicle() {	this.model					= null;	this.movies					= null;	this.page					= null;	this.vehicleID				= null;	this.vehicleCat				= null;	this.vehicleElement			= null;	this.pageAuthor				= null;	this.picture				= null;	this.initializeFromString	= initializeFromStringVehicle;	this.getVehicleID			= getVehicleID;	this.getModel				= getModel;	this.getMovies				= getMovies;	this.getFilmList			= getFilmList;	this.hasPage				= hasPage;	this.getPage				= getPage;	this.getLinkedModel			= getLinkedModel;	this.hasCategories			= hasCategories;	this.getCategories			= getCategories;	this.hasElement				= hasElement;	this.getElements			= getElements;	this.getAuthor				= getAuthor;	this.getThumbs				= getThumbs;	this.hasPictures			= hasPictures;	this.getPictures			= getPictures;}function initializeFromStringVehicle(data) {	vehicleData			= data.split('*');	this.vehicleID		= vehicleData[0];	this.movies			= vehicleData[1].split(' ');	this.model			= vehicleData[2];	this.page			= vehicleData[3];	this.vehicleCat		= vehicleData[4].split(' ');	this.vehicleElement	= vehicleData[5].split(' ');	this.pageAuthor		= vehicleData[6];	this.picture		= vehicleData[7];	if ( this.pageAuthor != "-" ) {		this.pageAuthor = BMTauthor[ this.pageAuthor ];	}}function getVehicleID() {	return this.vehicleID;}function getModel() {	return this.model;}function getMovies() {	return this.movies;}function getFilmList() {	var rc = "<ul>";	for ( ii in this.getMovies() ) {		rc = rc + "<li>" + parent.movieArray[this.getMovies()[ii]].getTitle() + " (" + parent.movieArray[this.getMovies()[ii]].getYear() + ")</li>";	}	rc += "</ul>";	return rc;}function hasPage() {	var rc = false;	if (this.page != "-") {	rc = true;}	return rc;}function getPage() {	var rc = "";	if (this.hasPage()) {	rc = "V" + this.page + ".html"; } 	return rc;}function getLinkedModel() {	var rc = this.getModel();	if (this.hasPage()) {		rc = "<a href='http://d6751420.u103.surftown.dk/Vehicles/" + this.getPage() + "'>" + this.getModel() + "<\/A>";	}	return rc;}function hasCategories(categoriesData, match) {	var rc = false;	var counter = 0;	for ( vehCat in this.vehicleCat ) {		for ( catData in categoriesData ) {			if ( categoriesData[catData] == this.vehicleCat[vehCat] ) {	counter += 1;	}		}	}	if (counter >= match) {	rc = true;	}	return rc;}function getCategories() {	return this.vehicleCat;}function hasElement(elementData) {	var rc = false;	for ( vehEle in this.vehicleElement ) {		for ( eleData in elementData ) {			if ( this.vehicleElement[vehEle] == elementData[eleData] ) {	rc = true;	}		}	}	return rc;}function getElements() {	return this.vehicleElement;}function getAuthor() {	return this.pageAuthor;}function getThumbs() {	var temp = new Array;	counter = 0;	for ( ii in this.movies ) {		temp[counter] = "<img src='" + THUMBS_PATH + "m" + this.movies[counter] + "v" + this.vehicleID + "th.jpg' width='120' height='60'>";	}	return temp;}function hasPictures() {	rc = true;	if ( this.picture == "-" ) {		rc = false;	}	return rc;}function getPictures() {	var temp = new Array;	counter = 0;	for ( ii in this.movies ) {		temp[counter] = "<img src='" + PICTURE_PATH + "m" + this.movies[counter] + "v" + this.vehicleID + ".jpg' width='320' height='160'>";	}	return temp;}// ... end Class Vehicle// *****// Class External Links ...function ExternalLink() {	this.exLinkID				= null;	this.exLinkCategory			= null;	this.active					= null;	this.wwwAddress				= null;	this.vehicleIDs				= null;	this.movieIDs				= null;	this.wwwImage				= null;	this.wwwTitle				= null;	this.description			= null;	this.exLinkAbstract			= null;		this.initializeFromString	= initializeFromStringLink;	this.getLinkID				= getLinkID;	this.getLinkTitle			= getLinkTitle;	this.getTitleAsLink			= getTitleAsLink;	this.getImageAsLink			= getImageAsLink;	this.getCategory			= getCategory;	this.getDescription			= getDescription;	this.getAbstract			= getAbstract;	this.getVehicleIDs			= getVehicleIDs;	this.hasVehicle				= hasVehicle;	this.isLinkOK				= isLinkOK;}function initializeFromStringLink(data) {	linkData				= data.split('*');	this.exLinkID			= linkData[0];	this.exLinkCategory		= linkData[1];	this.active				= linkData[2];	this.wwwAddress			= linkData[3];	this.vehicleIDs			= linkData[4].split(' ');	this.movieIDs			= linkData[5].split(' ');	this.wwwTitle			= linkData[6];	this.wwwImage			= linkData[7];	this.description		= linkData[8];	this.exLinkAbstract		= linkData[9];}function getLinkID() {	return this.exLinkID;}function getLinkTitle() {	return this.wwwTitle;}function getTitleAsLink() {	var rc = "<a href='http://";	rc += this.wwwAddress + "' target='top'>"	rc += this.wwwTitle +  "<\/a>"	return rc;}function getImageAsLink() {	var rc = "<a href='http://";	rc += this.wwwAddress + "' target='top' title='" + this.wwwTitle + "'>"	if ( this.wwwImage != "-") {	rc += "<img src='../Links/" + this.wwwImage + "' border='0'>";	}	else {	rc += this.wwwTitle;	}	rc += "<\/a>";	return rc;}function getCategory() {	return this.exLinkCategory;}function getDescription() {	return this.description;}function getAbstract() {	return this.exLinkAbstract;}function getVehicleIDs() {	return this.vehicleIDs;}function hasVehicle(ID) {	var rc = false;	for ( vehID in this.vehicleIDs ) {		if ( this.vehicleIDs[vehID] == ID ) {			rc = true;		}	}	return rc;}function isLinkOK() {	var rc = true;	if ( this.active == "9" ) {		rc = false;	}	return rc;}// ... end Class ExternalLink// *****// Class Top10 ...function Top10() {	this.top10Year				= null;	this.top10Month				= null;	this.top10Hits				= new Array;	this.top10PrevHits			= new Array;	this.top10Vehicle			= new Array;	this.top10Comments			= null;			this.initializeFromString	= initializeFromStringTop10;	this.getTop10Year			= getTop10Year;	this.getTop10Month			= getTop10Month;	this.getTop10Hits			= getTop10Hits;	this.getTop10PrevHits		= getTop10PrevHits;	this.getTop10Vehicle		= getTop10Vehicle;	this.getTop10Comments		= getTop10Comments;}function initializeFromStringTop10(data) {	top10Data				= data.split('*');	this.top10Year			= top10Data[0].substring(0, 4);	this.top10Month			= top10Data[0].substring(4, 6);	theImages = new Array;	for ( i = 1; i < 11; i ++) {		temp =  top10Data[i].split(' ');		this.top10Hits[i] = temp[0];		this.top10PrevHits[i] = temp[1];		var thisVehicle = new Vehicle;		thisVehicle.initializeFromString( parent.bondVehicle[temp[2]] );		theImages = thisVehicle.getThumbs();		this.top10Vehicle[i] =  "<table><tr><td class='box' width='130'>" + theImages[0] + "</td><td width='*'>" + thisVehicle.getLinkedModel() + thisVehicle.getFilmList() + "</td></tr></table>";	}	this.top10Comments		= top10Data[11];}function getTop10Year() {	return this.top10Year;}function getTop10Month() {	return this.top10Month;}function getTop10Vehicle(data) {	return this.top10Vehicle[data];}function getTop10Hits(data) {	return this.top10Hits[data];}function getTop10PrevHits(data) {	return this.top10PrevHits[data];}function getTop10Comments() {	return this.top10Comments;}// ... end Class Top 10// *****// Class Basket ...function Basket() {	this.basketItemCount		= new Array;	this.basketItems			= new Array;		this.addItem				= addItem;	this.getShippingRate		= getShippingRate;	this.getSubTotal			= getSubTotal,	this.getTotal				= getTotal;	this.displayBasket			= displayBasket,	this.getItemCount			= getItemCount;	this.getItemString			= getItemString;	this.removeItem				= removeItem;	this.emptyBasket			= emptyBasket;	this.isBasketEmpty			= isBasketEmpty;}function addItem( itemNumber ) {	found = -1;	for (i in this.basketItems ) {		if (parseInt(this.basketItems[i].getKey()) == parseInt(itemNumber) ) {			found = i;		}	}	if (found > -1) {		this.basketItemCount[found] = (this.basketItemCount[found] + 1);	}	else {		temp = this.basketItemCount.length;		this.basketItemCount[temp] = 1;		this.basketItems[temp]	= new ShopItem;		this.basketItems[temp].initializeFromString( shopItems[itemNumber] ) ;	}}function getShippingRate(ship) {	weight = parseFloat(PACKING);	for ( ii in this.basketItems ) {		tmp = weight;		unitCount = parseFloat(this.basketItemCount[ii]);		unitWeight = new Number( this.basketItems[ii].getWeight() ) ;		weight = (tmp + ( unitWeight * unitCount ) );	}	weight = Math.floor(weight/1000);	switch (ship) {		case 0:			rc = CARRY_ON_BUDGET_UK[weight];			return rc;			break;		case 1:			rc = CARRY_ON_BUDGET_DK[weight];			return rc;			break;		case 2:			rc = CARRY_ON_UK[weight];			return rc;			break;		case 3:			rc = POSTANVISNING_DK[weight];			return rc;			break;	}	return rc;	}function getSubTotal(currency) {	total = 0;	for ( i in this.basketItems) {		total = ( total + (this.basketItems[i].getPrice(currency + 2) * this.basketItemCount[i]) );	}	temp = new String(total);	rc = new String(temp.substr(0, temp.length-2));	if (currency == 0) {		rc += "." + temp.substring((temp.length-2), temp.length);	} else {		rc += "," + temp.substring((temp.length-2), temp.length);	}	return rc;}function getTotal(currency, ship) {	total = 0;	if (currency == 0) {		total = Math.round(this.getSubTotal(currency)*100);		total = (total + Math.round(this.getShippingRate(ship)*100) );	} else {		total = new Number(this.getSubTotal(currency).replace(",", ""));		total = (total + Number(this.getShippingRate(ship).replace(",", "")));	}	temp = new String(total);	rc = new String(temp.substr(0, temp.length-2));	if (currency == 0) {		rc += "." + temp.substring((temp.length-2), temp.length);	} else {		rc += "," + temp.substring((temp.length-2), temp.length);	}	return rc;}function displayBasket(lang) {	rc = "";	for (i in this.basketItems) {		itemTotal = 0;		itemTotal = ( itemTotal + Math.floor(this.basketItems[i].getPrice(lang + 2) * this.basketItemCount[i]) );		temp = new String(itemTotal);		itemSubTotal = new String(temp.substr(0, temp.length-2));		if (lang == 0) {			itemSubTotal += "." + temp.substring((temp.length-2), temp.length);		} else {			itemSubTotal += "," + temp.substring((temp.length-2), temp.length);		}			rc += "<tr>" + this.basketItems[i].generateHTML(0, lang);		rc += "<td class='box' width='10%' align='right'>" + this.basketItemCount[i] + "</td>";		rc += "<td class='box' width='15%' align='right'>" + itemSubTotal + "</td>";		rc += "</tr>";	}	rc += "<tr><td class='box' colspan='3' align='right'><b>SubTotal</b></td>";	rc += "<td class='box' align='right'>" + this.getSubTotal(lang) + "</td></tr>";	return rc;}function getItemCount() {	rc = 0;	for (i in this.basketItems) {		rc += this.basketItemCount[i]+"|"+this.basketItemCount[i].getID()+"|";		temp = new String(this.basketItems[i].getPrice(lang + 2) * this.basketItemCount[i]);		itemTotal = new String(temp.substr(0, temp.length-2));		if (lang == LANGUAGE_UK) {			itemTotal += "." + temp.substring((temp.length-2), temp.length);		} else {			itemTotal += "," + temp.substring((temp.length-2), temp.length);		}		rc += itemTotal;	}	return rc;}function getItemString(lang) {	rc = "";	for ( i in this.basketItems) {		rc += " | " +this.basketItemCount[i] + " | " + this.basketItems[i].getID() + " | ";		temp = new String(this.basketItems[i].getPrice(lang + 2) * this.basketItemCount[i]);		itemTotal = new String(temp.substr(0, temp.length-2));		if (lang == LANGUAGE_UK) {			itemTotal += "." + temp.substring((temp.length-2), temp.length);		} else {			itemTotal += "," + temp.substring((temp.length-2), temp.length);		}		rc += itemTotal + " | ";	}	return rc;}function removeItem() {}function emptyBasket(lang, flag) {	this.basketItemCount		= new Array;	this.basketItems			= new Array;	emptyBasketTxt				= new Array("The basket is now empty.", "Kurven er nu tom.");	if ( flag == 1 ) {		alert(emptyBasketTxt[lang]);	}}function isBasketEmpty() {	rc = false;		if (this.basketItems.length < 1 ) { rc = true;}	return rc;}// ... end Class Basket// *****// Class Customer ...function Customer (nam, st1, st2, zi, cit, cou, ema, pho, shi, pay, com) {	// private values	this.name					= nam;	this.street1				= st1;	this.street2				= st2;	this.zip					= zi;	this.city					= cit;	this.country				= cou;	this.email					= ema;	this.phone					= pho;	this.shipping				= shi;	this.payment				= pay;	this.comment				= com;	// getting raw data:	this.getName				= getName;	this.getStreet1				= getStreet1;	this.getStreet2				= getStreet2;	this.getZip					= getZip;	this.getCity				= getCity;	this.getCountry				= getCountry;	this.getEmail				= getEmail;	this.getPhone				= getPhone;	this.getShipping			= getShipping;	this.getShippingCode		= getShippingCode;	this.getPayment				= getPayment;	this.getComment				= getComment;	// getting HTML:	this.getAddress				= getAddress;}function getName() {	return	this.name;}function getStreet1() {	return	this.street1;}function getStreet2() {	return	this.street2;}function getZip() {	return	this.zip;}function getCity() {	return	this.city;}function getCountry() {	return	this.country;}function getEmail() {	return this.email;}function getPhone() {	return this.phone;}function getShipping() {	return this.shipping;}function getShippingCode(lang) {	rc = lang;	if ( this.getShipping() == "CarryOn" ) { rc = 2; }	if ( this.getPayment() == "efterkrav" ) { rc = 3; }	return rc;}function getPayment() {	return this.payment;}function getComment() {	return this.comment;}function getAddress() {	rc = this.name + "<br>";	rc += this.street1 + "<br>";	if ( this.street2 != "" ) { rc += this.street2 + "<br>"; }	rc += this.zip + " " + this.city + "<br>";	rc += this.country + "<br>";	return rc;}// ... end Class Customer// *****// Class CookieTool ...function CookieTool() {	this.cookieID				= null;	this.cookieValue			= null;	this.cookieExpires			= new Date;	this.cookieExpires.setMonth(this.cookieExpires.getMonth() + 3);		this.makeCookie				= makeCookie;	this.getCookieValue			= getCookieValue;}function makeCookie(ID, Value) {	var temp	= "" + ID + "=" + Value + ";expires=" + this.cookieExpires.toGMTString();	document.cookie = temp;}function getCookieValue(ID) {	rc = "false";	if (document.cookie != ""){		bmt216aCookie = document.cookie.split("; ");		for (i in bmt216aCookie) {			if ( (bmt216aCookie[i].split("=")[0]) == ID) {				rc = bmt216aCookie[i].split("=")[1];			}		}	}	return rc;}// ... end Class CookieTool