
/**
 *
 */
var popup = null;

/**
 *
 */
function goTo(url)
{
	document.location.href = url;
}

/**
 *
 */
function closePopUp()
{
	popup.close();
}

/**
 *
 */
function deleteItem(url)
{
	if(confirm("Weet u zeker dat u dit item wilt verwijderen?"))
		goTo(url);
}

/**
 *
 */ 
function openPopUp(url, width, height)
{
	if(width  == null)	width  = 800;
	if(height == null)	height = 600;
	
	popup = window.open(url, "", "height=" + height + ",scrollbars=yes,width=" + width);
}

/**
 *
 */
function setFocus(id)
{	
	document.getElementById(id).focus();
}

/**
 *
 */
function refreshPage()
{
	document.location.href = document.location.href;
}

/**
 *
 */
function updateBrowser()
{
	$(document).ready(function()
	{
		$('body').prepend
		(
			$('<div></div>')
			.attr('id', 'ie6')
			.html('Uw browser wordt niet meer ondersteund. <a href="/upgrade.html">Klik hier</a> om uw browser te upgraden')
		);
	});
}

/**
 *
 */
function rekenuit(t)
{
	var type  = "Koopsom";
	var value = t.prev().prev().prev().val();
	
	$.post(ROOT_PATH+'php/_extra/process.php', {'type': type, 'value': value}, function(data)
	{
		if(data == 'false')
			$('#uitkomst').html('Het bedrag komt niet voor in onze lijst');
		else if(data.indexOf('hoger') != -1)
		{
			data = data.split('=>');
			
			$('#uitkomst').html('De maandlasten zijn hoger dan &euro; '+data[1]+',-');
		}
		else
			$('#uitkomst').html((type == 'Koopsom' ? 'Indicatieve maandlasten: ' : 'Maandlasten: ')+data);
	});
};

$(document).ready(function()
{
	$('.r').hover(function()
	{
		var t = $(this);
		
		t.find('img').attr('src', t.find('img').attr('src').replace(".jpg", "_zw.jpg"));
	}, function()
	{
		var t = $(this);
		
		t.find('img').attr('src', t.find('img').attr('src').replace("_zw.jpg", ".jpg"));
	});
});
