$(document).ready(function() {
	if($("div#overview").length)
	{
		$("span.info").hide();
	}
});


function showBox(str)
{
	$.fancybox(
		str,
		{
			'autoDimensions' : false,
			'width' : '500',
			'height' : '300',
			'transitionIn' : 'linear',
			'transitionOut' : 'linear',
			'overlayOpacity' : '0.5'
		}
	);
}

function charsLeft(field,maxChars)
{
	document.getElementById("charInfo"+field).style.display = "block";
	countChars = document.getElementById(field).value.length;
	restChars = maxChars - countChars;
				
	if(restChars<=0)
	{
		alert("Sie haben die maximale Anzahl Zeichen erreicht.");
		document.getElementById(field).value = document.getElementById(field).value.substr(0,maxChars);
	}
	else
	{
		document.getElementById("charInfo"+field).innerHTML = restChars + "/" + maxChars + " Zeichen";
	}
}

function charBar(state,field)
{
	if(state==0)
		document.getElementById("charInfo"+field).style.display = "none";
	else
		document.getElementById("charInfo"+field).style.display = "block";
}

function showInfo(nr)
{
	$("#info"+nr).toggle("slow");
}
