function initPreview(){setInterval('updateAll()',300);}

function updateAll()
{
	charCounter('title',75,'titleCounter');
	charCounter('description',1024,'descriptionCounter');
}

function charLimit(field,maxLength)
{
	var inputLength=field.value.length;
	if(inputLength>=maxLength)
	{
		field.value=field.value.substring(0,maxLength);
	}
}

function charCounter(field,maxLength,countTarget)
{
	f = document.getElementById(field);
	var inputLength=f.value.length;
	if(inputLength>=maxLength)
	{
		f.value=f.value.substring(0,maxLength);
	}
	t = document.getElementById(countTarget);
	t.innerHTML=maxLength-f.value.length;
}

function show(div)
{
	f = document.getElementById(div);
	f.style.display = 'block';	
}

function hide(div)
{
	f = document.getElementById(div);
	f.style.display = 'none';	
}
