// 
//  mkbas.js
//  website
//  
//  Created by rvw on 2009-06-29.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
// 
var remb_bgcolor;

// register te hover for the mtabtr class..
$(document).ready(function() {
	$(".mtabtr").hover(
		function() {
			$(this).css({ "background-color": "#ddf4cb" });
		},
		function() {
			$(this).css({ "background-color": "" });
		}
	);
	$(".htabtr").hover(
		function() {
			$(this).css({ "background-color": "#ddf4cb" });
		},
		function() {
			$(this).css({ "background-color": "" });
		}
	);
	
	$(".hfade").hover( 
		function(){	
			$(this).stop().fadeTo("normal", 0.4);
			//$(this).stop().animate({top:"5px"},'slow'); 
		}, 
		function() {
			$(this).stop().fadeTo("normal",1.0);
			//$(this).stop().animate({paddingTop:"0px", paddingBottom:"2px"},'slow');
		} 
	);
	
	$(".hfade2").hover( 
		function(){	
			$(this).css({"color":"#ffa365"}); 
			//$(this).stop().animate({top:"5px"},'slow'); 
		}, 
		function() {
			$(this).css({"color":""});
			//$(this).stop().animate({paddingTop:"0px", paddingBottom:"2px"},'slow');
		} 
	);
	$(".hfade3").hover( 
		function(){	
			remb_bgcolor=$(this).css("background-color");
			$(this).css({"background-color":"#FF6C04"}); 
			//$(this).stop().animate({top:"5px"},'slow'); 
		}, 
		function() {
			$(this).css({"background-color":remb_bgcolor});
			//$(this).stop().animate({paddingTop:"0px", paddingBottom:"2px"},'slow');
		} 
	);
});

function besp_bereken(obj) {
	// cause fancybox makes a copy of the popup html, we can only find our ID element if we 
	// traverse from the button we clicked (=obj)
	var block=$(obj).parent().parent();
	var bedrag=block.find("#gescbedr").attr("value");
	var besparing = Math.round(bedrag*0.015*1.19 - 790);
	if (besparing<0)
		besparing=0;
	// hide all
	block.find("#bespresulterror").hide();
	block.find("#bespresult").fadeOut(0);
	//block.find("#bespresult").hide();
	if (bedrag<1) {
		block.find("#bespresulterror").html("Voer de geschatte vraagprijs van uw woning in");
		block.find("#bespresulterror").show();
		setTimeout('block.find("#bespresulterror").hide()',1000);
	}
	else {
		block.find("#bespbedr").html(besparing);
		//block.find("#bespresult").css({'display':"block"});
		block.find("#bespresult").fadeIn("slow");

	}
}


