// 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';
}
function showAnonymousForm() {
showDocumentElement('comments-form');

}

var commenter_name;
var commenter_blog_ids;
var is_preview;
var mtcmtmail;
var mtcmtauth;
var mtcmthome;
function individualArchivesOnLoad(commenter_name) {



hideDocumentElement('trackbacks-info');


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;

}

}

}

}

function writeCommenterGreeting(commenter_name, entry_id, blog_id, commenter_id, commenter_url) {



}



// Random encryption key feature by Andrew Moulden, Site Engineering Ltd

// This code is freeware provided these four comment lines remain intact

// A wizard to generate this code is at http://www.jottings.com/obfuscator/

var __MTTBLINK__;

var __MTTBID__;

function obfuscator(coded, key, mode, path, hidden) {

shift = coded.length;

link = "";

for(i=0;i<coded.length;i++) {

if (key.indexOf(coded.charAt(i))==-1) {

ltr = coded.charAt(i);link+=(ltr);

} else {

ltr = (key.indexOf(coded.charAt(i)) - shift + key.length) % key.length;

link += (key.charAt(ltr));

}

}

if(mode == 'hidden_input') {

document.write('<input type="hidden" name="CCode" value="' + link + '" />');

} else if(mode == '__MTTBLINK__') {

__MTTBLINK__ = path + link;

if(hidden) return;

document.write(link);

} else if(mode == '__MTTBID__') {

__MTTBID__ = link;

if(hidden) return;

document.write(link);

}

}




var enablepersist="off" 
var collapseprevious="yes" 

var contractsymbol='+' 
var expandsymbol='-' 

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate
inc++
}
revivestatus()
}


function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate



