
//CONSTANTS
var C_N4 = (document.layers) ? 1 : 0;
var C_IE4 = (document.all) ? 1 : 0;
var C_N6 = (document.getElementById && !document.all) ? 1 : 0;
var C_isMac = (navigator.appVersion.indexOf("Mac") != -1) ? 1 : 0;
var C_useMenu = (C_N4 || C_IE4 || C_N6) ? 1 : 0;

//IF WE CAN USE MENUS...
if (C_useMenu) {

	//...BUILD ARRAYS FOR MENUS
	var menuGemstones = new Array(
		"RUBIES", "/rubies-jewelry.shtml",
		"EMERALDS", "/emerald-jewelry.shtml",
		"SAPPHIRES", "/sapphires-jewelry.shtml",
		"AQUAMARINES", "/aquamarines-jewelry.shtml",
		"AMETHYST", "/amethyst-jewelry.shtml",
		"GARNETS", "/garnets-jewelry.shtml",
		"BLUE TOPAZ", "/blue-topaz-jewelry.shtml",
		"PEARL", "/pearl-jewelry.shtml",
		"ONYX", "/onyx-jewelry.shtml",
		"PERIDOT", "/peridot-jewelry.shtml",
		"OPAL", "/opal-jewelry.shtml",
		"CITRINE", "/citrine-jewelry.shtml",
		"TANZANITE", "/tanzanite-jewelry.shtml",
		"LAB CREATED GEMS", "/lab-created-precious-gems.shtml",
		"MULTI/MIXED COLOR", "/mixed-jewelry.shtml"
	);
	menuGemstones.name = "Gemstones";

	var menuOccasions = new Array(
		"HOLIDAY GIFTS", "/christmas.shtml",
		"ANNIVERSARY", "/anniversary.shtml",
		"BIRTHDAY", "/birthday.shtml",
		"WEDDING", "/wedding-jewelry.shtml",
		"VALENTINE'S DAY", "/valentines-day-jewelry.shtml",
		"FOR MOTHER", "/mothers-day-jewelry.shtml",
		"GIFT IDEAS", "/special-jewelry-gifts.shtml",
		"GEMS OF AFRICA", "/gems-of-africa.shtml"
	);
	menuOccasions.name = "Occasions";

	var menuStyles = new Array(
		"RELIGIOUS", "/religious-jewelry.shtml",
		"HEART", "/heart-jewelry.shtml",
		"BRIDAL", "/bridal.shtml",
		"NEW ITEMS", "/new-jewelry.shtml",
		"CIRCLE JEWELRY", "/circle-jewelry.shtml",
		"BLACK & WHITE", "/black-and-white-jewelry.shtml",
		"PINK JEWELRY", "/pink-gemstone-jewelry.shtml",
		"VINTAGE", "/vintage-jewelry.shtml",
		"RIGHT HAND RING", "/right-hand-ring.shtml",
		"GEOMETRIC", "/geometric.shtml",
		"WHIMSICAL", "/whimsical-jewelry.shtml",
		"ENSEMBLES", "/ensemble.shtml",
		"GIFT IDEAS", "/special-jewelry-gifts.shtml"
		//"JOURNEY", "/journey-jewelry.shtml",
		//"DUO", "/duo-jewelry.shtml",
		//"CLEARANCE", "/clearance-jewelry.shtml"
	);
	menuStyles.name = "Styles";

	//...BUILD THE MENUS
	document.write (buildMenu("Gemstones",menuGemstones));
	document.write (buildMenu("Occasions",menuOccasions));
	document.write (buildMenu("Styles",menuStyles));

}

//BUILD MENU FUNCTION
function buildMenu(menuName,menuArr) {
	strMenu = "<table id='" + menuName + "_menu' class=\"menubox\" OnMouseOver='showMenu();' OnMouseOut='hideMenu()'>";
	for (i=0;i<menuArr.length;i=i+2) {
		strMenu += "<tr><td width=\"3\"></td>";
		strMenu += "<td width=\"117\"><a class=\"sub-menu\" href=\"" + menuArr[i+1] + "\">" + menuArr[i] + "</a></td>";
		strMenu += "</tr>";
	}
	strMenu += "</table>";
	return strMenu;
}

//SHOW MENU FUNCTION
function showMenu() {
	if (C_useMenu) {
		if(C_IE4 || C_N6) {
			clearTimeout(timer);
			curMenu.style.visibility = 'visible';
		} else {
			clearTimeout(timer);
			curMenu.visibility = 'show';
		}
	}
}

//HIDE MENU FUNCTION
timer = "";
function hideMenu() {
	if (C_useMenu) {
		if(curMenu != null) {
			timer = setTimeout("hide();",100);
		}
	}
}

//HIDE FUNCTION
function hide() {
	if (C_useMenu) {
		if(C_IE4 || C_N6) {
			curMenu.style.visibility = 'hidden';
		} else {
			curMenu.visibility = 'hide';
		}
	}
}

//LOAD MENU FUNCTION
var curLink = null;
var curMenu = null;
function loadMenu(menu, pos) {
	if (C_useMenu) {
		var top = 263;
		var left = 125;
		var offset = 25;

		if(curMenu != null) {  //curLink != null &&
			if(curMenu.style.visibility != 'hidden') {
				hide();
			}
		}
		if (C_N6) {
			curLink = eval("document.getElementById('link-" + menu + "');");
			curMenu = eval("document.getElementById('" + menu + "_menu');");
		} else {
			curLink = eval("document.all('link-" + menu + "');");
			curMenu = eval("document.all('" + menu + "_menu');");
		}

		var sidebox;
		if (C_N6) {
			//curLink = eval("document.images." + menuname + "_img;");
			sidebox = eval("document.getElementById('sideboxes');");
		} else {
			//curLink = eval("document.all('" + menuname + "_img');");
			sidebox = eval("document.all('links1');");

		}
		if (C_N6) {
			curMenu.style.top = top+(offset*pos)+"px";
			curMenu.style.left = left+"px";
		} else {
			curMenu.style.top = top+(offset*pos);
			curMenu.style.left = left;
		}
		showMenu();

	}
}

var C_useExpand = (C_N4 || C_IE4 || C_N6) ? 1 : 0;

var roller;
var isOpen = false;

function expand() {
	if ( C_useExpand ) {
		var bannerDiv;
		if (C_N6) {
			bannerDiv = eval("document.getElementById('banner');");
		} else {
			bannerDiv = eval("document.all('banner');");
		}

		if ( (bannerDiv.style.height == "") || (bannerDiv.style.height == "65px") ) {
			roller = 65;
			isOpen = false;
		} else {
			roller = 500;
			isOpen = true;
		}
		roll();
	}
}

function roll() {
	if ( isOpen && (roller >= 65) ) {
		size = ""+roller+"px";
		setSize(size);
		roller -= 5;
		setTimeout("roll()", 10);
	} else if ( !isOpen && (roller <= 500 ) ) {
		size = ""+roller+"px";
		setSize(size);
		roller += 5;
		setTimeout("roll()", 10);
	}
}

function setSize(size) {
	var bannerDiv;
	if (C_N6) {
		bannerDiv = eval("document.getElementById('banner');");
	} else {
		bannerDiv = eval("document.all('banner');");
	}
	bannerDiv.style.height=size;
}


function jsRedir(url, time) {
	setTimeout("location.href='"+url+"';", time );
}