var AllItems = new Array(15);
AllItems[1] = "Blue Bird Scrunch Bracelet";
AllItems[2] = "Colored Green Caterpillar Bracelet";
AllItems[3] = "Cactus Necklace";
AllItems[4] = "Couture Bubblegum Cuff Bracelet";
AllItems[5] = "Sun Laurel Necklace";
AllItems[6] = "Electro-Bib Necklace with Colored Buttons";
AllItems[7] = "Colored Molecule Necklace";
AllItems[8] = "Purple Bracelet";
AllItems[9] = "Molecule Necklace";
AllItems[10] = "Colored Confetti Necklace";
AllItems[11] = "Long Summer Strand Necklace";
AllItems[12] = "Couture Deco Shell Necklace";
AllItems[13] = "Green Chiffon and Red Crystal Necklace";
AllItems[14] = "Chemistry Lab Wreath Necklace";
AllItems[15] = "";

var AllDescs = new Array(15);
AllDescs[1] = "Plastic blue and wood beads on elastic cords with gold bird button";
AllDescs[2] = "Green tile bracelet with white and green bead clusters";
AllDescs[3] = "Long oxidized chain with coral, green, and white floral clusters";
AllDescs[4] = "Chain mail with pink silk fabric covered by multi-color pastic beads";
AllDescs[5] = "Cast laurels with jumbo yellow discs on chain";
AllDescs[6] = "Black leather bib with primary colored buttons (item may vary)";
AllDescs[7] = "Large metallic, plastic and metal beads tangled into antique chain";
AllDescs[8] = "Silver chain with miscellaneous purple beads and amethyst crystals";
AllDescs[9] = "Metallic ball, robot bead, spoke and rhinestone clusters, strung together with resistors";
AllDescs[10] = "Multi-strand blue beads with large yellow flower printed beads and multi-color confetti discs";
AllDescs[11] = "Bright plastic and ceramic beads with sunsplash medallions on chain";
AllDescs[12] = "Shell frames with anodized aluminum discs and robot beads on bright chain";
AllDescs[13] = "Torn green chiffon fringe, red crystals, giant resin beads, and green rhinestone brooch";
AllDescs[14] = "Multi-colored crystals, spokes, and hexagons collide on vintage snail chain";
AllDescs[15] = "";

var AllPrices = new Array(15);
AllPrices[1] = "150.00";
AllPrices[2] = "350";
AllPrices[3] = "OLD";
AllPrices[4] = "650.00";
AllPrices[5] = "650.00";
AllPrices[6] = "950.00";
AllPrices[7] = "850.00";
AllPrices[8] = "350.00";
AllPrices[9] = "550.00";
AllPrices[10] = "OLD";
AllPrices[11] = "550.00";
AllPrices[12] = "650.00";
AllPrices[13] = "950.00";
AllPrices[14] = "850.00";
AllPrices[15] = "";

var AllRetail = new Array(15);
AllRetail[1] = "380.00";
AllRetail[2] = "500.00";
AllRetail[3] = "";
AllRetail[4] = "1200.00";
AllRetail[5] = "1100.00";
AllRetail[6] = "1800.00";
AllRetail[7] = "1600.00";
AllRetail[8] = "480.00";
AllRetail[9] = "840.00";
AllRetail[10] = "";
AllRetail[11] = "980.00";
AllRetail[12] = "1250.00";
AllRetail[13] = "1800.00";
AllRetail[14] = "1600.00";
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 = 'pop/item0' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'pop/tn0' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'pop/tn0' + i.toString() + 'b.jpg';
    }
    else {
        itm[i] = new Image();
        itm[i].src = 'pop/item' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'pop/tn' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'pop/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;
}