function textCounter(field, countfield, countbar, maxlimit)
{
/*
alert ("field: " + field);
alert ("field: " + document.getElementById(field).value);
alert ("countfield: " + document.getElementById(countfield).childNodes[0].nodeValue);
alert ("countfield: " + countfield);
alert ("maxlimit: " + maxlimit);
*/
	if (document.getElementById(field).value.length > maxlimit)
	{
		document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlimit);
	}
	else
	{
		width = document.getElementById(field).value.length * 2;
		document.getElementById(countfield).childNodes[0].nodeValue = maxlimit - document.getElementById(field).value.length;
		setStyle (document.getElementById(countbar), "width: " + width + "px;");
	}
}

function setCounterBar(countbar, width)
{
	width = width * 2;
	setStyle (document.getElementById(countbar), "width: " + width + "px;");
}

function changePhotoAccess()
{
	if (document.getElementById('photo').disabled)
		document.getElementById('photo').disabled = false;
	else
		document.getElementById('photo').disabled = true;
}

function checkConfirmation()
{
	if (!document.getElementById('confirm_listing').checked)
	{
		alert ("Please confirm that you have reviewed your listing.\n\nYou will be unable to modify it following this page.");
		document.getElementById('confirm_listing').focus();
		return false;
	}
	
	return true;
}

function checkConfirmationDale()
{
	if (!document.getElementById('confirm_listing').checked)
	{
		alert ("Dale, have you confirmed that you have reviewed this listing.");
		document.getElementById('confirm_listing').focus();
		return false;
	}
	
	return true;
}

function setStyle(object, styleText)
{
	if( object.style.setAttribute )
	{
		object.style.setAttribute("cssText", styleText );
	}
	else
	{
		object.setAttribute("style", styleText );
	}
}