// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.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 rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (f.author != undefined)
       setCookie('mtcmtauth', f.author.value, now, '/', '', '');
    if (f.email != undefined)
       setCookie('mtcmtmail', f.email.value, now, '/', '', '');
    if (f.url != undefined)
       setCookie('mtcmthome', f.url.value, now, '/', '', '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '/', '');
    deleteCookie('mtcmthome', '/', '');
    deleteCookie('mtcmtauth', '/', '');
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

function hideDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'none';
}

function showDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'block';
}

var commenter_name;

function individualArchivesOnLoad(commenter_name) {

    hideDocumentElement('trackbacks-info');

 // comments are allowed but not required
    if (commenter_name) {
        hideDocumentElement('name-email');
    } else {
        showDocumentElement('name-email');
    }



    if (document.comments_form) {
        if (!commenter_name && (document.comments_form.email != undefined) &&
            (mtcmtmail = getCookie("mtcmtmail")))
            document.comments_form.email.value = mtcmtmail;
        if (!commenter_name && (document.comments_form.author != undefined) &&
            (mtcmtauth = getCookie("mtcmtauth")))
            document.comments_form.author.value = mtcmtauth;
        if (document.comments_form.url != undefined && 
            (mtcmthome = getCookie("mtcmthome")))
            document.comments_form.url.value = mtcmthome;
        if (document.comments_form["bakecookie"]) {
            if (mtcmtauth || mtcmthome) {
                document.comments_form.bakecookie.checked = true;
            } else {
                document.comments_form.bakecookie.checked = false;
            }
        }
    }
}


if ('www.elise.com' != 'www.elise.com') {
    document.write('<script src="http://www.elise.com/cgi-bin/mt333/readerscomm.cgi?__mode=cmtr_name_js"></script>');
} else {
    commenter_name = getCookie('commenter_name');
}


var targetTags = new Array('p');
var fontSizes = new Array('xx-small','x-small','small','medium','large','x-large','xx-large');
var startSize = 2;
	
//This function resizes our select text
function resizeText(targetID,changeBy) {
	
	if (!document.getElementById) return; //Die if the browser doesn't like DOM
	var changeElement = null,fontSize = startSize,i,j,changeTags;
	
	//Up the fontSize counter
	fontSize += changeBy;
	if ( fontSize < 0 ) fontSize = 0;
	if ( fontSize > 6 ) fontSize = 6;
	startSize = fontSize;
	
	//If we can't get the element by ID, let's try by tag	
	if (!(changeElement=document.getElementById(targetID))) changeElement = document.getElementsByTagName(targetID)[ 0 ];

	//Actually apply the changes
	changeElement.style.fontSize = fontSizes[fontSize];

	//If at first you don't succeed...
	for (i = 0 ; i < targetTags.length ; i++) {
		changeTags = changeElement.getElementsByTagName(targetTags[ i ]);
		for ( j = 0 ; j < changeTags.length ; j++ ) changeTags[ j ].style.fontSize = fontSizes[ fontSize ];
	}
}

/*
 * Clear Default Text: functions for clearing and replacing default text in <input> elements.
 */
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}
/*
	Expandable Listmenu Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
	Customized for SimplyRecipes by Jesse Gardner - http://plasticmind.com
*/

function showMe() {
	if (!document.getElementsByTagName) return;
	
	var allDivs = document.getElementsByTagName("div");
	for (var i = 0; i < allDivs.length; i++) {
		var mclass = allDivs[i].className;
		if (mclass.indexOf("showmelist") > -1) {
			var submenu = allDivs[i].childNodes;
			for (var j = 0; j < submenu.length; j++) {
				if (submenu[j].tagName == "A") {
					
					submenu[j].onclick = function() {
						var node = this.nextSibling;
											
						while (1) {
							if (node != null) {
								if (node.tagName == "UL") {
									var d = (node.style.display == "none")
									node.style.display = (d) ? "block" : "none";
									this.className = (d) ? "treeopen" : "treeclosed";
									return false;
								}
								node = node.nextSibling;
							} else {
								return false;
							}
						}
						return false;
					}
					
					submenu[j].className = (mclass.indexOf("open") > -1) ? "treeopen" : "treeclosed";
				}
				
				if (submenu[j].tagName == "UL")
					submenu[j].style.display = (mclass.indexOf("open") > -1) ? "block" : "none";
			}
		}
	}
}

window.onload = showMe;

function revealThis(targetid) {

	if (!document.getElementById) return; //Die if the browser doesn't like DOM
	var thisInfo = document.getElementById(targetid).style;

	// If the article summary is showing, hide it.
	if (thisInfo.display == "block") {
		thisInfo.display = "none";
	}
	else {
		// If the article summary is hidden, show it.
		thisInfo.display = "block";
	}
	return false;
}