﻿

$(document).ready(function(){
	
	
	initIE6Hovers();
	initTooltip();
	initProductFeatureHove();
	initHyperlinks();
	
});

function initHyperlinks()
{
	$("a[rel=external]").each(function(){
		$(this).click(function(){ window.open($(this).attr("href")); return false; }); 
	});
}


function initProductFeatureHove()
{
	$('#marktsegmentfeatures .producten li').hover(function(){ 
		$(this).find('img').css('display','block');	
	}, function(){ 
		$(this).find('img').css('display','none');
	});
	$('#marktsegmentfeatures .features li').hover(function(){ 
		$(this).find('img').css('display','block');	
	}, function(){ 
		$(this).find('img').css('display','none');
	});
}


function initIE6Hovers()
{
	$('#nav li').hover(function(){
		$(this).addClass('sfhover');
	}, function(){
		$(this).removeClass('sfhover');
	});
}

function initTooltip() {

    xOffset = 10;
    yOffset = 20;

    $('.tooltip').hover(function(e) {
        this.t = this.title;
        this.title = '';
        $('body').append('<div id="tooltip">' + this.t + '</div>');
        $('#tooltip')
                                    .css('top', (e.pageY - xOffset) + 'px')
                                    .css('left', (e.pageX + yOffset) + 'px')
                                    .fadeIn('fast');
    },
    function() {
        this.title = this.t;
        $('#tooltip').remove();
    });
    $('li.tooltip').mousemove(function(e) {
        $('#tooltip')
                                    .css('top', (e.pageY - xOffset) + 'px')
                                    .css('left', (e.pageX + yOffset) + 'px');
    });
    
};

$(document).ready(function() {    

    jQuery.extend(jQuery.validator.messages, {
        required: trans_js_form_required,
        minlength: jQuery.format("U dient minimaal {0} karakters in te voeren."),
        rangelength: jQuery.format("U dient minimaal {0} en maximaal {1} karakters in te voeren."),
        email: trans_js_form_email
    });

    $('form.contact').validate();
    $('form.aanvraag').validate();
	
});


