(function ($) {
$(document).ready(function() {

	// Wistia lightbox
	if ($('#videoArea').hasClass('wide')) {
		Wistia.requireFancyBoxAssets(function() { 
         Wistia.fancyBoxJQuery("#foo-hd").fancybox({ type: "iframe", 
                                                     width: 640, 
                                                     height: 360, 
                                                     autoDimensions: false }); 
                                             });
	} else {
		Wistia.requireFancyBoxAssets(function() { 
         Wistia.fancyBoxJQuery("#foo-hd").fancybox({ type: "iframe", 
                                                     width: 480, 
                                                     height: 384, 
                                                     autoDimensions: false }); 
                                             });
	}

	// Return to top
    $('#return p').click(function(){
        $('html, body').animate({"scrollTop": 0}, 'slow');
        return false;
    });
    
    // Toggle highlight class with CSS3 effects when hovering products
   $('.pro-wrap div').hover(function() {
      $(this).addClass('highlight');
   }, function() {
      $(this).removeClass('highlight');
   });
	
	$('#resources div').hover(function() {
		$(this).addClass('highlight');
	}, function() {
		$(this).removeClass('highlight');
	});
	
	// Add map
	$("#gmap").gMap({
		markers: [{
			latitude: 61.166611,
            longitude: 23.898762,
            html: "Ipeka Automation Oy<br />Palokuja 1, 37800 Toijala<br />Akaa",
            popup: true
        }],
        zoom: 15
    });
    
    // Slider
    $(".product-image").easySlider({
		auto: false,
		continuous: false,
		nextId: "slider1next",
		prevId: "slider1prev"
	});
 
 	// If there is only one image, remove the slider navigation
 	var imgCount = $(".product-image li").size();
   if (imgCount == 1) {
      $('#slider1next').remove();
	}
});

}) (jQuery);
