var AllItems = new Array(15);
AllItems[1] = "Bohemian Long Strand Necklace";
AllItems[2] = "Antique Coral Cuff Bracelet";
AllItems[3] = "Couture Long Amber and Paisley Necklace";
AllItems[4] = "Tribal Cuff Bracelet";
AllItems[5] = "Long Craft Strand";
AllItems[6] = "Antique Coral Embroidered Cuff Bracelet";
AllItems[7] = "Coral Cameo with Tassel";
AllItems[8] = "Silk Military and Coral Necklace";
AllItems[9] = "Long Maharaja Strand Necklace";
AllItems[10] = "Antique Floral and Wood Cuff";
AllItems[11] = "Couture Koi Fish Necklace";
AllItems[12] = "Long Spanish Moss Necklace";
AllItems[13] = "";
AllItems[14] = "";
AllItems[15] = "";

var AllDescs = new Array(15);
AllDescs[1] = "Wood, metal, and coral beads on pearl and vintage chains with assorted brooches";
AllDescs[2] = "Miscellaneous beads with Swarovski headpins, bits of coral and rhinestone filigree, and satin ribbon";
AllDescs[3] = "Brass multi-chain long strands with amber crystal bee brooch and amber and wood beads";
AllDescs[4] = "Red coral, springs, and and embroidered tribals beads and pearls";
AllDescs[5] = "Various chains of wood, reed, metal, and plastic floral beads, with vintage velvet ribbon";
AllDescs[6] = "Gold and red coral with assorted pearls and baubles";
AllDescs[7] = "Coral cameo with sea-inspired chains and chain squid fringe";
AllDescs[8] = "Drab ribbon stitched with chain and adorned with red and white coral with various medallions";
AllDescs[9] = "Assorted chains, brooches, and feathers";
AllDescs[10] = "Warm tone vintage rhinestone floral brooch with celedon plastic pearls, rhinestone flowers, and shell";
AllDescs[11] = "Yellow ceramic beads, shell pieces, and googly eyes with pearls and fish toys on assorted chains";
AllDescs[12] = "Blackened chain with fine chain fringe and micro beading";
AllDescs[13] = "";
AllDescs[14] = "";
AllDescs[15] = "";

var AllPrices = new Array(15);
AllPrices[1] = "950";
AllPrices[2] = "OLD";
AllPrices[3] = "950.00";
AllPrices[4] = "650.00";
AllPrices[5] = "950.00";
AllPrices[6] = "750.00";
AllPrices[7] = "OLD";
AllPrices[8] = "950.00";
AllPrices[9] = "950.00";
AllPrices[10] = "650.00";
AllPrices[11] = "OLD";
AllPrices[12] = "450.00";
AllPrices[13] = "";
AllPrices[14] = "";
AllPrices[15] = "";

var AllRetail = new Array(15);
AllRetail[1] = "1800.00";
AllRetail[2] = "";
AllRetail[3] = "1800.00";
AllRetail[4] = "1200.00";
AllRetail[5] = "1800.00";
AllRetail[6] = "1400.00";
AllRetail[7] = "";
AllRetail[8] = "1800.00";
AllRetail[9] = "1800.00";
AllRetail[10] = "1250.00";
AllRetail[11] = "";
AllRetail[12] = "540.00";
AllRetail[13] = "";
AllRetail[14] = "";
AllRetail[15] = "";

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 = 'pearls/item0' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'pearls/tn0' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'pearls/tn0' + i.toString() + 'b.jpg';
    }
    else {
        itm[i] = new Image();
        itm[i].src = 'pearls/item' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'pearls/tn' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'pearls/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;
}