function showVeilingPopup(content, position)
{
	$('veiling_popup').set('html', content);
	if(position != null)
	{
		$('veiling_popup').setStyle('left', (position.x - 150) + 'px');
		$('veiling_popup').setStyle('top', (position.y-75) + 'px');
	}
	$('veiling_popup').setStyle('display', 'block');
}

function getMarkerPosition(marker)
{
	var scale = Math.pow(2, map.getZoom());
	var nw = new google.maps.LatLng(
		map.getBounds().getNorthEast().lat(),
		map.getBounds().getSouthWest().lng()
	);
	var worldCoordinateNW = map.getProjection().fromLatLngToPoint(nw);
	var worldCoordinate = map.getProjection().fromLatLngToPoint(marker.getPosition());
	var pixelOffset = new google.maps.Point(
		Math.floor((worldCoordinate.x - worldCoordinateNW.x) * scale),
		Math.floor((worldCoordinate.y - worldCoordinateNW.y) * scale)
	);
	return pixelOffset;
}

function toggleCheckNice(id, parent)
{
	checked = toggleCheck(id);
	if(checked)
		$(parent).addClass('onhover');
	else
		$(parent).removeClass('onhover');
}

function toggleCheck(id)
{
	element = document.getElementById(id);
	if(element)
	{
		if(element.disabled == false)
		{
			if(element.checked == false)
			{
				element.checked = true;
			}
			else
			{
				element.checked = false;
			}
			element.fireEvent('change');
			return element.checked;
		}
	}
	return null;
}

function toggleApprove(className, value)
{
	$$('.' + className).each(function(element)
	{
		if(element.disabled == false)
		{
			element.checked = value;
			
			if(!Browser.ie)
			{
				/** Possible table row */
				parent = element.getParent().getParent();
				if($defined(parent))
				{
					if(element.checked)
						parent.addClass('onhover');
					else
						parent.removeClass('onhover');
				}
			}
			element.fireEvent('change');
		}
	}
	);
}

Locale.use('nl-NL');

