﻿// Set up banner
$('#image img').cycle();

// Set up main navigation
$('#main-navigation > li').menu({
	dropdown : 'ul',
	ignoreDummy : true
});

// Set up filter
var filter = $('#filter');
if(filter.length) {
	var checkboxes = filter.find('input[type=checkbox]');
	checkboxes.each(function(i) {
		var el = $(this),
			id = 'checkbox-' + i;
		el.attr('id', id);
		el.next('label').attr('for', id);
	});
	checkboxes.bind('click', function() {
		window.location.href = $(this).val();
	});
};

// Set up search box
var search = $('#search');
if(search.length) {
	
	var input = search.find('input[type=text]');
	if(input.val() == '') {
		input.val($('<div />').html('Zoeken&hellip;').text());
	};
	
	var val = input.val();
	input.bind({
		'focus' : function() {
			if(input.val() == val) {
				input.val('')
			};
		},
		'blur' : function() {
			if(input.val() == '') {
				input.val(val);
			};
		}
	});
	
};

// Fix PNG images if the user client is IE 6 or 'worse'
if($.browser.msie) {
	if($.browser.version <= 6) {
		$('head').append('<script type="text/javascript" src="style/modelec/js/jquery.pngfix.js" />');
		$('#product-details .left, #product-details .right').pngfix();
		$('#background').css('background', 'none');
	};
};

setupProductsPage();
setupProductPage();
setupNewsPage();
setupContactPage();
setupOverlay();
