/*
window.onload = postload;
var img = null;
if (document.images)
{img = new Image();}
function go2a() {
var t, url;
t = (new Date()).getTime();
url = 'img?l='+escape(a)+'&t='+t;
if (navigator.appName == "Microsoft Internet Explorer") 
{ img.src = url; }
else 
{ document.getElementById('bgi').style.backgroundImage = 'url('+url+')'; }
}
function postload() {
var theDiv = document.createElement('div');
theDiv.setAttribute('id', 'bgi');
document.body.appendChild(theDiv);
}
*/
function go2(a){if (document.images){l=new Image();l.src="img?l="+escape(a);}return true;}
function lc(a){if (document.images){l=new Image();l.src="img?l="+escape(a);}return true;}
function srvr(vote,id){if (document.images){l=new Image();var url="vote.php?vote="+vote+"&id="+escape(id);l.src=url;}return true;}
function s(a) { self.status = a; return true; }
function cs() { self.status = ''; return true; }
function pre(imgsrc) { var img = new Image(); if (img != null) { img.src = imgsrc; } }
function setSelect(a, b)
{var s= document.getElementById(b);
document.getElementById(a).value = s.options[s.selectedIndex].value;
s.selectedIndex = 0;}

function showHide(a, b)
{
	var c = document.getElementById(a);
	var d = document.getElementById(b);
	if (c.style.display == 'none')
	{
		c.style.display = 'block';
		d.src = 'down.gif';
		srvr('show', a);
	}
	else
	{
		c.style.display = 'none';
		d.src = 'right.gif';
		srvr('hide', a);
	}
	return false;
}


function showHide2(a, b)
{var c = document.getElementById(a);var d = document.getElementById(b);
if (c.style.display == 'none')
{c.style.display = 'inline';d.style.display = 'none';}
else{d.style.display = 'inline';c.style.display = 'none';}
return false;}

function showHide3(a, b)
{var c = document.getElementById(a);var d = document.getElementById(b);
if (c.style.display == 'none')
{c.style.display = 'block';d.style.display = 'none';}
else{d.style.display = 'block';c.style.display = 'none';}
return false;}

function showDiv(a)
{var b = document.getElementById(a);
if (b) b.style.display = 'block';
return false;}

function hideDiv(a)
{var b = document.getElementById(a);
if (b) b.style.display = 'none';
return false;}

function togDiv(a, f)
{var b = document.getElementById(a);
if (b) { if (b.style.display == 'none') 
{ 
b.style.display = 'block';
var d = document.getElementById(f);
if (d) { d.focus(); }
}else b.style.display = 'none'; }
return false;}

function GetDateString()
{
	now = new Date();
	return now.getHours() + '_' + now.getMinutes() + '_' + 
	now.getSeconds() + '_' + now.getDate() + '_' + 
	now.getMonth() + '_' + now.getYear();
}
function m(b)
{
	movingLabel = document.getElementById('MI' + b);
	movingDiv = document.getElementById('MD' + b);
	theSelect = document.getElementById('moveitem');
	if (movingDiv.style.display == 'none')
	{
		movingLabel.innerHTML = 'Choose item to move after (or click here to cancel)';
		movingDiv.innerHTML = theSelect.innerHTML;
		movingDiv.style.display = 'block';
	}
	else
	{
		movingLabel.innerHTML = '&bull; move item...';
		movingDiv.innerHTML = '';
		movingDiv.style.display = 'block';
	}
	return false;
}
function s(b)
{
	a = document.getElementById('saving');
	if (a)
	{ 
		a.style.display = 'block';
		if (b == 1) str = 'Updating';
		else if (b == 2) str = 'Deleting';
		else if (b == 3) str = 'Emailing';
		else if (b == 4) str = 'Adding';
		else if (b == 5) str = 'Creating';
		str = str + ', please wait...';
		a.innerHTML = str;
	}
	return true;
}
function sh(list_id, item_id)
{
	var theid, displaystyle, itemdiv, itemname, itemform;
	if (item_id == '')
	{
		theid = 'lc' + list_id;
		displaystyle = 'inline';
		itemdiv = 'LD' + list_id;
		itemname = 'LN' + list_id;
		itemform = 'LF' + list_id;
	}
	else
	{
		theid = 'ic' + list_id + '_' + item_id;
		displaystyle = 'inline';
		itemdiv = 'ID' + item_id;
		itemname = 'IN' + item_id;
		itemform = 'IF' + item_id;
	}

	var a = document.getElementById(theid);
	var b = document.getElementById(itemdiv);
	var c = document.getElementById(itemname);
	var d = document.getElementById(itemform);

	if (a.style.display == "none")
	{
		if (a) a.style.display = displaystyle;
		if (b) b.style.backgroundColor = '#EAEEFF'; 
		if (b) b.style.border = 'solid 1px #C2CFFF'; 
		if (b) b.style.padding = '0.4em'; 
		if (c) c.style.display = "none"; 
		if (d) d.style.display = "block"; 

	}
	else
	{
		if (a) a.style.display = "none"; 
		if (b) b.style.backgroundColor = '#FFFFFF'; 
		if (b) b.style.border = ''; 
		if (b) b.style.padding = '0'; 
		if (c) c.style.display = "block"; 
		if (d) d.style.display = "none";
	}
	return false;
}
function showHide2(theid1, theid2, thefocusid)
{
	var a = document.getElementById(theid1);
	var b = document.getElementById(theid2);
	var c = document.getElementById(thefocusid);
	if (a != null) a.style.display = 'none';
	if (b != null) b.style.display = 'block';
	if (c != null) c.focus();
	return false;
}
function ToggleElement(listid)
{
	var imgelement = 'img' + listid;
	var divelement = 'items' + listid;

	var theImage = null;
	if (imgelement != null) 
		theImage = document.getElementById(imgelement);
	var theDiv = null;
	if (divelement != null)
		theDiv = document.getElementById(divelement);

	if ((theImage != null) && (theDiv != null))
	{
		if (theDiv.style.display == "none")
		{
			theImage.src = "down.gif";
			theImage.title = "Click to collapse list.";
			theDiv.style.display = "block";
			if (tempImg != null)
				tempImg.src = 'http://www.tudu.org/?expandlist=' + listid + '&date=' + GetDateString();
		}
		else
		{
			theImage.src = "right.gif";
			theImage.title = "Click to expand list.";
			theDiv.style.display = "none";
			if (tempImg != null)
				tempImg.src = 'http://www.tudu.org/?collapselist=' + listid + '&date=' + GetDateString();
		}
	}

	return false;
}
function setDisplayByClass(className, displayType)
{
var theArray = document.getElementsByTagName('div');
for ( i = 0 ; i < theArray.length ; i++) 
{
if (theArray.item(i).className == className)
{
theArray.item(i).style.display = displayType;
}
}
}
function printerFriendly()
{
var a, b, c, d, e, f;
a = document.getElementById('hdr');
if (a.style.display == 'block')
{
a.style.display = 'none';
b = document.getElementById('foot'); if (b) b.style.display = 'none';
c = document.getElementById('nav'); if (c) { c.style.display = 'none'; }
d = document.getElementById('createlist'); if (d) { d.style.display = 'none'; } 
e = document.getElementById('ads'); if (e) { e.style.display = 'none'; } 
f = document.getElementById('info'); if (f) { f.style.display = 'none'; } 
setDisplayByClass('additem', 'none');
}
else
{
a.style.display = 'block';
b = document.getElementById('foot'); if (b) b.style.display = 'block';
c = document.getElementById('nav'); if (c) { c.style.display = 'block'; }
d = document.getElementById('createlist'); if (d) { d.style.display = 'block'; } 
e = document.getElementById('ads'); if (e) { e.style.display = 'block'; } 
f = document.getElementById('info'); if (f) { f.style.display = 'block'; } 
setDisplayByClass('additem', 'block');
}
return false;
}
function co(item_id)
{
	var a = document.getElementById('ITD' + item_id);
	if (a)
	{
		a.style.textDecoration = 'line-through';
		a.style.color = '#777777';
	}
	var b = document.getElementById('IM' + item_id);
	if (b)
	{
		b.src = 'c.gif';
	}
}

var tempImg = null;
if (document.images)
	tempImg = new Image();
var fade_object = null;
var hex = null;
var fadecolor = null;
function dupItem(itemid, listid, domain)
{
	itemText = document.getElementById(itemid);
	if (itemText)
	{
		location.href = 'http://' + domain + '/?itemname=' + escape(itemText.value) + '&listid=' + listid;
	}
	return false;
}
function fade()
{
	fadecolor++;
	if ((fadecolor <= 15) && (fade_object != null))
	{
		fade_object.style.backgroundColor = '#' + 'FFFF' + hex[fadecolor] + hex[fadecolor];
		setTimeout("fade()", 55);
	}
	else
	{
		fade_object = null;
	}
}
function doFade(fadeid)
{
	if (hex == null)
	{
		hex = new Array(16);
		hex[0]='0'; hex[1]='1'; hex[2]='2'; hex[3]='3';
		hex[4]='4'; hex[5]='5'; hex[6]='6'; hex[7]='7';
		hex[8]='8'; hex[9]='9'; hex[10]='A'; hex[11]='B';
		hex[12]='C'; hex[13]='D'; hex[14]='E'; hex[15]='F';
	}
	fade_object = document.getElementById(fadeid);
	fadecolor = 0;
	setTimeout("fade()", 20);
}

function BoxesChecked(theclass)
{
	var alltags = document.all ? document.all : document.getElementsByTagName("input");
	for (i=0; i<alltags.length; i++)
	{
		if (alltags[i].className == theclass)
			if (alltags[i].checked)
				return true;
	}
	alert('Please select one or more items.');
	return false;
}

function CheckAll(theclass, checkit)
{
	var alltags = document.all ? document.all : document.getElementsByTagName("input");
	for (i=0; i<alltags.length; i++)
	{
		if (alltags[i].className == theclass)
			alltags[i].checked = checkit;
	}
	return false;
}