/*
 * 	Agence Rembrandt Index Pagina javascript
 *
 *	Copyright 2010 - Westdesign, www.westdesign.be
 */
 
$(document).ready(function() {

	var taal = $('#Ktaal').val();
	
	// Login box
	
	$(".loginbox").colorbox({
		onComplete:function() {
			//testje();
		},
		onClosed:function() {
        	//location.reload();
		},
		innerWidth:"335px",innerHeight:"360px", href:"beheer/loginNieuw.php"}); 

		
	$(".box-seizoenverhuur").hover(function()
		{
			$(".box-seizoenverhuur").css("cursor", "pointer"); 
			$(".box-seizoenverhuur").fadeTo("slow", 0.5); 
		},function()
		{
			$(".box-seizoenverhuur").fadeTo("slow", 1.0); 
		});
	
	$(".box-jaarverhuur").hover(function()
		{
			$(".box-jaarverhuur").css("cursor", "pointer"); 
			$(".box-jaarverhuur").fadeTo("slow", 0.5); 
		},function()
		{
			$(".box-jaarverhuur").fadeTo("slow", 1.0); 
		});	
	
	$(".box-tekoop").hover(function()
		{
			$(".box-tekoop").css("cursor", "pointer"); 
			$(".box-tekoop").fadeTo("slow", 0.5); 
		},function()
		{
			$(".box-tekoop").fadeTo("slow", 1.0); 
		});			
	
	
	// Klik toestanden
	
	$(".box-seizoenverhuur").click(function(){
		top.location="seizoenverhuur.php?tl=" + taal;
		return false;
	});
	
	$(".box-jaarverhuur").click(function(){
		top.location="jaarverhuur.php?tl=" + taal;
		
		return false;
	});
	
	$(".box-tekoop").click(function(){
		top.location="tekoop.php?tl=" + taal;
		
		return false;
	});
});

function loginControle()
{
	var formData = $('#loginForm').serialize();

 	var dataString = formData + '&aktie=loginControle';

    $.ajax({
    	type: 'POST',
        url: 'beheer/_backend-login.php',
        data: dataString,
        	beforeSend: function()
            {
                			
            },
            success: function(data)
            {
				if (data == 'fout')
                {
                    $('#Bericht').html('<font color=red>Login gegevens incorrect!</font>');
				} else {
					window.location = "beheer/woningenNieuw.php";
				}
            }
        });
	return false;
}
