function SKU(SKUValue, Price) {
	this.SKU = SKUValue;
	this.Price = Price;
	this.Accessory = new Array();
	this.AddAccessory = AddAccessory;
	this.PrintSKU = PrintSKU;
	this.AccessoryExists = AccessoryExists;
	this.GetAccessoryValueByName = GetAccessoryValueByName;
	this.AreOptionsSelected = AreOptionsSelected;
	this.AlertSKU = AlertSKU;
}

function AddAccessory(Accessory) {
	this.Accessory[this.Accessory.length] = Accessory;
}

function AccessoryExists(AccessoryName, AccessoryValue) {
	// this.AlertSKU();
	var Found = false;
	for(var pos = 0; pos < this.Accessory.length; pos++) {
		// alert("Comparing " + this.Accessory[pos].OptionName + " to " + AccessoryName + "\n " + this.Accessory[pos].OptionValue + " with " + AccessoryValue);
		if ( this.Accessory[pos].OptionName == AccessoryName && this.Accessory[pos].OptionValue == AccessoryValue ) {
			Found = true;
			break;
		}
	}
	return Found;
}

function GetAccessoryValueByName(AccessoryName) {
	var AccessoryValue = "";
	for(var pos = 0; pos < this.Accessory.length; pos++) {
		if ( this.Accessory[pos].OptionName == AccessoryName ) {
			AccessoryValue = this.Accessory[pos].OptionValue;
			break;
		}
	}
	return AccessoryValue;
}

function AreOptionsSelected(OptionsSelected) {
	Matches = true;
	for(var pos = 0; pos < this.Accessory.length; pos++) {
		if ( this.Accessory[pos].OptionValue != unescape(OptionsSelected[this.Accessory[pos].OptionName]) ) {
			Matches = false;
			break;
		}
	}
	return Matches;
}

function PrintSKU() {
	document.write("SKU = " + this.SKU + "<BR>\n");
	for(var pos = 0; pos < this.Accessory.length; pos++) {
		this.Accessory[pos].PrintAccessory();
	}
}

function AlertSKU() {
	str = "SKU = " + this.SKU + "\n";
	for(var pos = 0; pos < this.Accessory.length; pos++) {
		str = str + this.Accessory[pos].ToString();
	}
	alert(str);
}
