/* some preloading... */
var img = new Image(304,137);
	img.src = '/img/logo_intro_houthandel_hover.jpg';
var img1 = new Image(304,137);
	img1.src = '/img/logo_intro_houtbouw_hover.jpg';
var img2 = new Image(304,137);
	img2.src = '/img/logo_intro_tuinhout_hover.jpg';
var img3 = new Image(222,32);
	img3.src = '/img/button_C7D218_hover.png';
var img4 = new Image(222,32);
	img4.src = '/img/button_C18B3F_hover.png';
var img5 = new Image(222,32);
	img5.src = '/img/button_009574_hover.png';
			
jQuery(document).ready(function() {
	jQuery(document).pngFix();
  	
  	jQuery("a[href^='http://'],a[href^='www.'],a[href^='https://'],a[rel='external']").not("a[href^='http://www.boeve-hop.nl']").attr('target','_blank');
  
  	jQuery('ul.menu li').click(function() {
		location.href = jQuery('> div a', jQuery(this)).attr('href');  
	});
	jQuery('ul.menu li').hover(function() {
		jQuery(this).addClass('hover');
	}, function() {
		jQuery(this).removeClass('hover'); 
	});	
	try {
		jQuery('div.text div.button').click(function() {
			location.href = jQuery("> a", jQuery(this)).attr('href');
		});
	} catch (error) {
	
	}
	jQuery("form#contact_form input.text, form#contact_form textarea, div.search_area input.text").click(function() {
		jQuery(this).val("");
		return false;
	});
	jQuery("form#contact_form").submit(function() {
 		var error = false;
 		var errorMessage = "De volgende verplichte velden zijn niet (juist) ingevuld:\n\n";
 		if (this.name.value == "") {
		 	errorMessage += "Naam\n";
			error = true;
			this.name.focus();	
		}
		if (this.email.value == "") {
		 	errorMessage += "Email\n";
		 	error = true;
			 this.email.focus();	
		}
		if (this.phone.value == "") {
		 	errorMessage += "Telefoonnummer\n";
		 	error = true;
			 this.phone.focus();	
		}
		if (!error) {
	 		jQuery.post('/ajax_server.php?app=frontPage&module=inform_me_form',
		  	{ 
		  		data : jQuery(this).serialize()
			},
		  	function(data){
		  		if (data) {
			   		jQuery("div.contact_box").html('<p>Het bericht is succesvol verstuurd. Er zal z.s.m. contact met u worden opgenomen.</p>');
			   		return false;
			   	};
			});
			return false;
		} else {
			alert(errorMessage);
			return false;
		}
	});
	/* to do, clean in up */
	if (jQuery('body.intro:visible').size() > 0) {
		jQuery('div#lft').hover(function() {
			jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_houthandel_hover.jpg");
			jQuery(this).addClass('lft_hover');
		}, function() {
		    jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_houthandel.jpg");
		    jQuery(this).removeClass('lft_hover');
		});
		jQuery('div#middle').hover(function() {
			jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_houtbouw_hover.jpg");
			jQuery(this).addClass('middle_hover');
		}, function() {
		    jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_houtbouw.jpg");
		    jQuery(this).removeClass('middle_hover');
		});
		jQuery('div#rgt').hover(function() {
			jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_tuinhout_hover.jpg");
			jQuery(this).addClass('rgt_hover');
		}, function() {
		    jQuery("> div.image_top > a > img", jQuery(this)).attr('src', "/img/logo_intro_tuinhout.jpg");
		    jQuery(this).removeClass('rgt_hover');
		});
	} 
	jQuery("a.fancybox").fancybox();
});
jQuery(window).load(function() {
	var maxHeight = 0;
	if (jQuery('div.content div.lft').height() > maxHeight)
		maxHeight = jQuery('div.content div.lft').height();
	if (jQuery('div.content div.rgt').height() > maxHeight)
		maxHeight = jQuery('div.content div.rgt').height();
	jQuery('div.content div.lft').css('height', maxHeight+'px');
	jQuery('div.content div.rgt').css('height', (maxHeight+50)+'px'); 	
});
