$(document).ready(function(){
    $('.js-toggle-value').each(function () {
        $(this).data('original_value', $(this).val());

        $(this).focus(function () {
            if ($(this).val() === $(this).data('original_value')) {
                $(this).val('');
            }
        }).blur(function () {
            if ($(this).val() === '') {
                $(this).val($(this).data('original_value'));
            }
        });
    });
    // For the menu
    $("#main-nav li a").each(function() {
        if(this.href == window.location) $(this).parent().parent().addClass("selected");
    }); 
    $('#main-nav > li').hover(function() {
        $('ul', this).slideDown(200).css('visibility', 'visible');
        $(this).addClass('selected');
    },
    function() {
        $('ul', this).slideUp(200);
        $(this).removeClass('selected');
    });
   
    $(".tooltip[title]").tooltip({
		tipClass: 'tooltiptip',
        effect: 'bouncy'
    });
    $(".tooltipbig[title]").tooltip({
        tipClass: 'tooltipbigtip',
        effect: 'bouncy'
    });
    
    $(".top-tooltip[title]").tooltip({ 
        tipClass: 'tooltipalt',
        effect: 'bouncy',
        position: ['bottom', 'center'],
        offset: [-11, -55]
    });

});

$(function(){
			$('#slides').slides({
				preload: true,
				preloadImage: IMG_DIR+'slide/loading.gif',
				play: 4500,
				pause: 2500,
				hoverPause: true
			});
		});

jQuery(document).ready(function() {

function showRequest(formData, jqForm, options) { 

    var queryString = $.param(formData); 


    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText, xhr, $form)  { 
 
}
    var options = { 
        target:        '#htmlExampleTarget',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse,
        clearForm: true 
    }; 
    
    jQuery("#ajaxContactForm").validate({
        messages: {
            name: "V&auml;nligen fyll i ditt namn",
            phone: "V&auml;nligen fyll i ditt telefonnummer",
            email: {
                required: "V&auml;nligen fyll i din e-post",
                email: "V&auml;nligen fyll i en korrekt e-post."
            }
        },
        submitHandler: function(form) {
        $(form).ajaxSubmit(options);
 }          
    });
        
});






