var AllItems = new Array(15);
AllItems[1] = "Tribal Bead Strand Necklace";
AllItems[2] = "Deco Bead Strand";
AllItems[3] = "Tribal Bead Double Strand Necklace";
AllItems[4] = "Skull Chain Bracelet";
AllItems[5] = "Wood, Chiffon, and Crystal Necklace";
AllItems[6] = "Chiffon and Wood Bead Strand Necklace";
AllItems[7] = "Galaxy Tribal Strand Necklace";
AllItems[8] = "Wood and Rhinestone Ball Necklace";
AllItems[9] = "Hamlet Bracelet";
AllItems[10] = "Silver Spool Necklace";
AllItems[11] = "Tribal Red Chain and Enamel";
AllItems[12] = "Couture Long Amber and Paisley Necklace";
AllItems[13] = "Colored Wreath Necklace";
AllItems[14] = "Long Bohemian Couture Necklace with African Colored Beads";
AllItems[15] = "Tribal Feather Long Strand";

var AllDescs = new Array(15);
AllDescs[1] = "Wood, metal, and tribal beads on pearl, stone, and wood strands";
AllDescs[2] = "Grey, mauve, and black plastic beads on base metal chunky chain";
AllDescs[3] = "Large black and white beads on pale green chiffon ribbon with gold ring closure";
AllDescs[4] = "Oxidized chains with wrapped donut and wood skull detail";
AllDescs[5] = "Wooden balls and crystal leaves knotted on black chiffon";
AllDescs[6] = "Celedon print chiffon knotted with large wooden and metal beads";
AllDescs[7] = "Long brass chain with red and black tribal beads and mother-of-pearl donut beads";
AllDescs[8] = "Wooden balls and rhinestone brooches on assorted blackened chains";
AllDescs[9] = "Silver chain with mother of pearl and wood skull bead orbitals and assorted silver charms";
AllDescs[10] = "Long brass chain with wooden spool and silver thread with ombre ribbon accent";
AllDescs[11] = "Mixed metal findings with red crystal drops and enameled metal pieces on tube chain";
AllDescs[12] = "Brass multi-chain long strands with amber crystal bee brooch and amber and wood beads";
AllDescs[13] = "Tangled chain with jet crystals, multi-colored rhinestone and bead accents on filigree";
AllDescs[14] = "Gold mulit-chain and small pearl strand with large amethyst brooch, and beads";
AllDescs[15] = "Tribal wood beads, sapphire blue crystals, and other findings on antique chain";

var AllPrices = new Array(15);
AllPrices[1] = "OLD";
AllPrices[2] = "550.00";
AllPrices[3] = "350.00";
AllPrices[4] = "350.00";
AllPrices[5] = "550.00";
AllPrices[6] = "450.00";
AllPrices[7] = "550.00";
AllPrices[8] = "750.00";
AllPrices[9] = "350.00";
AllPrices[10] = "350.00";
AllPrices[11] = "950.00";
AllPrices[12] = "950.00";
AllPrices[13] = "950.00";
AllPrices[14] = "950.00";
AllPrices[15] = "750.00";

var AllRetail = new Array(15);
AllRetail[1] = "";
AllRetail[2] = "780.00";
AllRetail[3] = "500.00";
AllRetail[4] = "500.00";
AllRetail[5] = "980.00";
AllRetail[6] = "680.00";
AllRetail[7] = "740.00";
AllRetail[8] = "1400.00";
AllRetail[9] = "500.00";
AllRetail[10] = "480.00";
AllRetail[11] = "1800.00";
AllRetail[12] = "1800.00";
AllRetail[13] = "1800.00";
AllRetail[14] = "1800.00";
AllRetail[15] = "1400.00";

var tnA = new Array(15);
var tnB = new Array(15);
var itm = new Array(15);

// Uses the Image() prototype to preload images [variables declared above]
for (var i = 1; i <= 15; i++) {
    if (i < 10) {
        itm[i] = new Image();
        itm[i].src = 'tribal/item0' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'tribal/tn0' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'tribal/tn0' + i.toString() + 'b.jpg';
    }
    else {
        itm[i] = new Image();
        itm[i].src = 'tribal/item' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'tribal/tn' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'tribal/tn' + i.toString() + 'b.jpg';
    }
}  

// Called by thumbnails onerror - hides divs with errors
function noImage(c) {
	document.getElementById("thumb" + c).style.display = "none";
}

// Called by CloseItems(), itself called by ToggleItem() - resets display and arrays
function CloseAll() {
    for (var i = 2; i <= 15; i++) {
        document.getElementById('item' + i.toString()).style.display = "none";
	}
    document.form1.item_name.value = AllItems[1];
    document.form1.amount.value = AllPrices[1];
}

// Called by href property of thumbnail <a> tags
function ToggleItem(saleitem) {
    CloseItems();
    if (document.getElementById(saleitem).style.display !== "block") {
        document.getElementById(saleitem).style.display = "block";
        document.getElementById(saleitem).childNodes[0].style.width = "240px";
    }
}

// Called by href property of thumbnail <a> tags [see EXPLANATION above]
function swapInput(i) {
    document.form1.item_name.value = AllItems[i];
    document.form1.amount.value = AllPrices[i];
    document.getElementById("itemname").innerHTML = AllItems[i];
    document.getElementById("itemdesc").innerHTML = AllDescs[i];
    document.getElementById("itemprice").innerHTML = "$" + AllPrices[i];
    document.getElementById("retailprice").innerHTML = "$" + AllRetail[i];
    if (i == 1) {
    	document.getElementById("item1").style.display = "block";
    } else {
    	document.getElementById("item1").style.display = "none";
    }
}



// Unfortunate use of eval.  Creates mouseover effect
function Highlight(imageID, newImage) {
	document.images[imageID].src = eval(newImage + ".src");
}

function wstatus(m) {
	window.status = m;
	return true;
}

function CloseCommonBio() {
	document.getElementById('primary').style.display = "none";
	document.getElementById('biopage').style.display = "none";
	document.getElementById('biotext').style.display = "none";
	document.getElementById('biolink').style.display = "none";
}

function CloseDrawers() {
	document.getElementById('CDrawer').style.display = "none";
	document.getElementById('BDrawer').style.display = "none";
	document.getElementById('PDrawer').style.display = "none";
	document.getElementById('NDrawer').style.display = "none";
}

function ShowPage(pagetitle) {
	document.getElementById('revert').style.display = "block";
	CloseItems();
	if (pagetitle === "About") {
		document.getElementById('biopage').style.display = "block";
		document.getElementById('biotext').style.display = "block";
	} else if (pagetitle === "Revert") {
		CloseCommonBio();
		document.getElementById('primary').style.display = "block";
		document.getElementById('revert').style.display = "none";
	}
}

function OpenDrawer(drawer) {
	CloseDrawers();
	document.getElementById(drawer).style.display = "block";
}

function CloseItems() {
	CloseAll();
}

function ToggleBioText(b) {
	document.getElementById('biolink').style.display = b;
}