<!--
var caution = false
var storedValue = getCookie("outline")

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
		if (confirm("Cookie exceeds 4KB and will be cut!"))
			document.cookie = curCookie
}
function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}
function fixDate(date) {
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
		date.setTime(date.getTime() - skew)
}
function item(parent, text, depth) {
	this.parent = parent 
	this.text = text 
	this.depth = depth 
}
function makeArray(length) {
	this.length = length 
}
function makeDatabase() {
	outline = new makeArray(7) 
	
	outline[0] = new item(true, '<A class=lMenu HREF="javascript:toggle(' + 0 + ')"><b>Belly Rings</b></A>', 0)
	outline[1] = new item(false, '<A HREF="./products.php?cat=12" class=lMenu>Animal Belly Rings</A>', 1)
	outline[2] = new item(false, '<A HREF="./products.php?cat=13" class=lMenu>Chandelier Navel Rings</A>', 1)
	outline[3] = new item(false, '<A HREF="./products.php?cat=14" class=lMenu>Flowers, Hearts, Stars</A>', 1)
	outline[4] = new item(false, '<A HREF="./products.php?cat=18" class=lMenu>Skulls and Bikers</A>', 1)
	outline[5] = new item(false, '<A HREF="./products.php?cat=15" class=lMenu>Tribal Dangling, Logos</A>', 1)
	outline[6] = new item(false, '<A HREF="./products.php?cat=16" class=lMenu>Letters, Logos,  Others</A>', 1)
	//outline[7] = new item(false, '<A HREF="./products.php?cat=47" class=lMenu>X-mas Belly Rings</A>', 1)

	/*outline[0] = new item(true, '<font class=body>SimplytheBest', 0)
	outline[1] = new item(false, '<A HREF="http://simplythebest.net/software/" class=bodylink>Shareware & Freeware</A>', 1)
	outline[2] = new item(true, 'Scripts', 1)
	outline[3] = new item(false, '<A HREF="http://simplythebest.net/scripts/" class=bodylink>DHTML Scripts</A>', 2)
	outline[4] = new item(false, '<A HREF="http://simplythebest.net/scripts/" class=bodylink>CGI Scripts</A>', 2)
	outline[5] = new item(false, '<A HREF="http://info.simplythebest.net" class=bodylink>Information library</A>', 1)
	outline[6] = new item(false, '<A HREF="http://info.simplythebest.net" class=bodylink>Device drivers</A>', 1)
	outline[7] = new item(false, '<A HREF="http://simplythebest.net/fonts/" class=bodylink>Free fonts</A>', 1)
	outline[8] = new item(false, '<A HREF="http://simplythebest.net/affiliate_programs/" class=bodylink>Affiliate programs</A>', 1)
	outline[9] = new item(true, 'PlanMagic', 0)
	outline[10] = new item(false, '<A HREF="http://planmagic.com" class=bodylink>Business software</A>', 1)
	outline[11] = new item(false, '<A HREF="http://planmagic.com/business_planning.html" class=bodylink>Business plan</A>', 1)
	outline[12] = new item(false, '<A HREF="http://planmagic.com/marketing_planning.html" class=bodylink>Marketing plan</A>', 1)
	outline[13] = new item(false, '<A HREF="http://planmagic.com/financial_planning.html" class=bodylink>Financial plan</A>', 1)
	outline[14] = new item(false, '<A HREF="http://plan-a-restaurant.com" class=bodylink>Restaurant plan</A>', 1)
	outline[15] = new item(false, '<A HREF="http://planmagic.com/business_plan/hotel_business_plan.html" class=bodylink>Hotel plan</A>', 1)
	*/
	setStates()
	setImages()
}

function setStates() {
	var storedValue = getCookie("outline")
	
	if (!storedValue) {
		for (var i = 0; i < outline.length; ++i) {
			if (outline[i].depth == 0)
				outline[i].state = true
			else
				outline[i].state = false
		}
	} else {
		for (var i = 0; i < outline.length; ++i) {
			if (storedValue.charAt(i) == '1')
				outline[i].state = true
			else
				outline[i].state = false
		}
	}
}
function setImages() {
	for (var i = 0; i < outline.length; ++i) {
		if (outline[i].state)
			if (outline[i].parent) 
				if (outline[i + 1].state) 
					outline[i].pic = '<A HREF="javascript:toggle(' + i + ')"><IMG style="margin-bottom:-4px" SRC="images/minus.gif" BORDER=0></A>'
				else 
					outline[i].pic = '<A HREF="javascript:toggle(' + i + ')"><IMG style="margin-bottom:-4px" SRC="images/plus.gif" BORDER=0></A>'
			else 
				outline[i].pic = '<IMG style="margin-bottom:-5px;" SRC="images/bullet.gif" BORDER=0>'
	}
}
function toggle(num) {
	for (var i = num + 1; i < outline.length && outline[i].depth >= outline[num].depth + 1; ++i) {
		if (outline[i].depth == outline[num].depth + 1)
			outline[i].state = !outline[i].state 
	}
	setStorage()
	history.go(0)
}
function setStorage() {
	var text = ""
	for (var i = 0; i < outline.length; ++i) {
		text += (outline[i].state) ? "1" : "0"
	}

	setCookie("outline", text)
}
makeDatabase()

function callFromBellyrings(){
	//toggle(0);
	var num=0;
	for (var i = num + 1; i < outline.length && outline[i].depth >= outline[num].depth + 1; ++i) {
		if (outline[i].depth == outline[num].depth + 1)
			outline[i].state = !outline[i].state 
	}
	setStorage();
	history.go(1);
}
// -->

