var AllItems = new Array(15);
AllItems[1] = "Goth Heraldic Emerald Hermitage Necklace";
AllItems[2] = "Silk Rose Sunken Treasure Necklace";
AllItems[3] = "Rose and Dew Drop Necklace";
AllItems[4] = "Long gothic and jewel strand";
AllItems[5] = "Couture Black and Blue Spanish Goth Necklace";
AllItems[6] = "Butterfly Cuff";
AllItems[7] = "Gothic Cameo Pendant Necklace";
AllItems[8] = "Fish Leather Pendant Necklace";
AllItems[9] = "Couture Black Hermitage Necklace";
AllItems[10] = "Cameo Wreath Necklace";
AllItems[11] = "Wrapped Wreath Necklace";
AllItems[12] = "Goth Pendant Necklace";
AllItems[13] = "Silk Ribbon and Resin Bead Necklace";
AllItems[14] = "Goth Owl Pendant Necklace";
AllItems[15] = "Saturn Sunken Treasure Necklace";

var AllDescs = new Array(15);
AllDescs[1] = "Layered metal pendant with black feather on geometric chain with green crystal drops";
AllDescs[2] = "A range of chains accented by a black silk rose";
AllDescs[3] = "Long brass chain with satin roses, beads, mother of pearl flowers, and dew drop shapes";
AllDescs[4] = "Gothic brooch with ruby baubles on assorted chains with ribbon";
AllDescs[5] = "Black rosary chain, rhinestone chain embellished discs, jet, aqua, and yellow beads with ribbon";
AllDescs[6] = "Black plastic handcuff with buttferfly detail";
AllDescs[7] = "Gothic pendant and rusticated gold chain with faceted black beads and jumbo wooden balls on chain";
AllDescs[8] = "Copper oxidized long chain with fish leather and cameo diamond with rhinestone details";
AllDescs[9] = "Black rosary chain, coral, jet crystals, ebonized wood beads and mega crystal";
AllDescs[10] = "Ruby crystal brooches, cameo brooch, and eagle detail on single chain";
AllDescs[11] = "Silver and brass chain wreath with wire wrapped crystals on filigree bases";
AllDescs[12] = "Cross pendant with griffon motif and smoked crystal drop on twisted chain";
AllDescs[13] = "Oxidized chains with black plastic and red resin beads with red flower detail";
AllDescs[14] = "Long gold chain with gothic, owl themed pendant";
AllDescs[15] = "Silver and brass tangled chains with silver and mother of pearl saturn beads and pearl accents";

var AllPrices = new Array(15);
AllPrices[1] = "950.00";
AllPrices[2] = "550.00";
AllPrices[3] = "650.00";
AllPrices[4] = "950.00";
AllPrices[5] = "650.00";
AllPrices[6] = "250.00";
AllPrices[7] = "750.00";
AllPrices[8] = "450.00";
AllPrices[9] = "850.00";
AllPrices[10] = "950.00";
AllPrices[11] = "950.00";
AllPrices[12] = "550.00";
AllPrices[13] = "650.00";
AllPrices[14] = "450.00";
AllPrices[15] = "450.00";

var AllRetail = new Array(15);
AllRetail[1] = "1800.00";
AllRetail[2] = "780.00";
AllRetail[3] = "1200.00";
AllRetail[4] = "1800.00";
AllRetail[5] = "1250.00";
AllRetail[6] = "350.00";
AllRetail[7] = "1400.00";
AllRetail[8] = "520.00";
AllRetail[9] = "1600.00";
AllRetail[10] = "1800.00";
AllRetail[11] = "1800.00";
AllRetail[12] = "980.00";
AllRetail[13] = "1200.00";
AllRetail[14] = "520.00";
AllRetail[15] = "620.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 = 'goth/item0' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'goth/tn0' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'goth/tn0' + i.toString() + 'b.jpg';
    }
    else {
        itm[i] = new Image();
        itm[i].src = 'goth/item' + i.toString() + '.jpg';
        tnA[i] = new Image();
        tnA[i].src = 'goth/tn' + i.toString() + 'a.jpg';
        tnB[i] = new Image();
        tnB[i].src = 'goth/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;
}