$(document).ready(function () {
	// other
    $("a.defaultPopup").fancybox({ titlePosition: 'inside' });

	// accordion
    $('ul.subnav').accordion();

	// fancybox
	$("a#inline").fancybox({
        'hideOnContentClick': true
    });

	// landenkeuze
    $('a.selector').click(function () {
        $('#landenkeuze').slideToggle('slow');
        return false;
    });

	// widgets
    $('A.widgetBig').each(function () {
        var target = $(this).attr("target");
        if (target != '') { target = ' target="' + target + '"'; } else { target = ''; }
        $(this).replaceWith(
			'<a href="' + $(this).attr('href') + '" class="' + $(this).attr('class') + '"' + target + '>' +
				'<div class="widgetBig">' +
					'<div class="mask"></div>' +
					'<div class="alt">' + $('IMG', this).attr("alt") + '</div>' +
					'<img src="' + $('IMG', this).attr("src") + '" width="170" height="135" border="0" class="widgetBig" />' +
				'</div>' +
			'</a>'
		);
    });

    $(".widgetFancybox").fancybox({
        'padding': 0,
        'width': 600,
        'height': 380,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none'
    });

	/* overzicht */
    $('A.prodmask').each(function () {
        var target = $(this).attr("target");
        if (target != '') { target = ' target="' + target + '"'; } else { target = ''; }
        $(this).replaceWith(
			'<a class="prodmask" id="' + $(this).attr('id') + '" href="' + $(this).attr('href') + '" class="' + $(this).attr('class') + '"' + target + '">' +
				'<div class="prodmask">' +
					'<div class="mask"></div>' +
					'<img src="' + $('IMG', this).attr("src") + '" width="140" height="140" border="0" class="prodmask" />' +
				'</div>' +
			'</a>'
		);
    });

	/* overzicht */
    $('A.imgmask').each(function () {
        var target = $(this).attr("target");
        if (target != '') { target = ' target="' + target + '"'; } else { target = ''; }
        $(this).replaceWith(
			'<a class="imgmask" rel="lopital" title="' + $(this).attr('alt') + '" href="' + $(this).attr('href') + '" class="' + $(this).attr('class') + '"' + target + '">' +
				'<div class="imgmask">' +
					'<div class="mask"></div>' +
					'<img src="' + $('IMG', this).attr("src") + '" width="220" height="220" border="0" class="imgmask" />' +
				'</div>' +
			'</a>'
		);
        $("a.imgmask").fancybox({ titlePosition: 'inside' });
    });

	/* gallery */
	$('.galmask').each(function () {
        var target = $(this).attr("target");
        if (target != '') { target = ' target="' + target + '"'; } else { target = ''; }
        $(this).replaceWith(
			'<a rel="lopital" title="' + $(this).attr('alt') + '" href="' + $(this).attr('href') + '" class="' + $(this).attr('class') + '"' + target + '">' +
				'<div class="' + $(this).attr('class') + '">' +
					'<div class="mask"></div>' +
					'<img src="' + $('IMG', this).attr("src") + '" width="105" height="105" border="0" class="' + $(this).attr('class') + '"  />' +
				'</div>' +
			'</a>'
		);
        $("a.galmask").fancybox({ titlePosition: 'inside' });
    });

    $('.homemask').each(function () {
        var target = $(this).attr("target");
        if (target != '') { target = ' target="' + target + '"'; } else { target = ''; }
        $(this).replaceWith(
			'<a rel="lopital" title="' + $('IMG', this).attr('title') + '" href="' + $(this).attr('href') + '" class="' + $(this).attr('class') + '"' + target + '">' +
				'<div class="' + $(this).attr('class') + '">' +
					'<div class="mask"></div>' +
					'<img src="' + $('IMG', this).attr("src") + '" width="105" height="105" border="0" class="' + $(this).attr('class') + '"  />' +
				'</div>' +
			'</a>'
		);
    });

	/* homepage slidess */
	if($('.home-slider').length > 0) {
		$('.home-slider')
		.after('<div id="slider-nav">')
		.cycle({
			fx: 'fade',
			speed: 2000,
			timeout: 6000,
			pager: '#slider-nav',
			pause: 1
		});
	}
    $('#slider-nav a').html('')
	
	/* product page PDF link soft conversion tracking */
	$("A.download-folder").each(function () {
		$(this).click(function () {
			_gaq.push(["_trackEvent", "products", "PDF Download", window.location.pathname + "," + $(this).attr("href")]);
		});
	});
	
	/* product page Add to quotation soft conversion tracking */
	$(".product-offerte A.button2").each(function () {
		$(this).click(function () {
			_gaq.push(["_trackEvent", "products", "Add to quotation", window.location.pathname + "," + $(".product-offerte option:selected").html()]);
		});
	});
});


