function showElement( sElement )
{
	document.getElementById(sElement).style.display = 'block';
}

function showElements( aElements )
{
	for( i in aElements )
		showElement( aElements[ i ] );
}

function hideElement( sElement )
{
	document.getElementById(sElement).style.display = 'none';
}

function hideElements( aElements )
{
	for( i in aElements )
		hideElement( aElements[ i ] );
}

function showElementWithBg( sElement )
{                                   
    document.getElementById(sElement).style.display = 'block';
}

function hideElementWithBg( sElement )
{
    document.getElementById(sElement).style.display = 'none';
}

function showPopup( sUrl )
{
	window.open( sUrl, "popup", "toolbar=no,location=0,directories=0,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=500");
	return false;
}

function cleanField( oField, sText )
{
	if ( oField.value  == sText )
		oField.value = "" ;
}

function loadText( sElement, sText, iDots )
{
	var sNewtext = sText;
	for(i=0; i<iDots; i++)
		sNewtext += ".";
	if( iDots > 4 )
		iDots = 0;
	else
		iDots++;
	document.getElementById( sElement ).innerHTML = sNewtext;
	setTimeout("loadText( '"+sElement+"', '"+sText+"', "+iDots+" );",1000);
}

function showError( sText )
{
	document.getElementById("generalerror").innerHTML = sText;
}

function confirmLink(sQuestion, sUrl)
{
	if (confirm(sQuestion))
		document.location = sUrl;
	return false;
}

function checkQualityForm(numberOfchildsValue)
{
	if (numberOfchildsValue > 1)
	{
		document.getElementById('youngestchild').style.display = 'block';
	}
	else
	{
		document.getElementById('youngestchild').style.display = 'none';
		document.getElementById('birthyear_youngestchild').value = '';
	}
}

function clearQualityResearchFields()
{
	document.getElementById('birthyear_youngestchild').value ='';
	document.getElementById('birthyear_oldestchild').value ='';
	document.getElementById('numberofchilds').value= '0';
	checkQualityForm('0');
}