/*********************************************
 * Special Order bvba
 * (c) Ken Pimontel, ken at specialorder dot be
 * Purpose: Base JQ script settings
 *
 * NOTES

 *
 * DEPENDENCIES
 *
 * TODO
 *
 * HISTORY
 * 090331 ADDED Topmenu li:not(.active)
 * 090331 UPDATE SideMenu-T2 afgewerkt
 * 090327 ADDED auto form label width
 * 090327 ADDED a.box
 * 090120 First version
 *********************************************/


 // Logging function - kan je gebruiken in de chain. $("blabla").log("Wat je wil zeggen").fadeofzo...
jQuery.fn.log = function (msg) {
      console.log("%s: %o", msg, this);
      return this;
  };


// Lazy load

$(document).ready(function(){
    $("img").lazyload({
         effect      : "fadeIn"
     });
});

// TopMenu-img
$(document).ready(function(){
	$("#TopMenu li:not(.active) img").fadeTo("slow", 0.6); // This sets the opacity of the thumbs to fade down to 60% when the page loads
	$("#TopMenu li:not(.active) img").hover(function(){
		$(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
		},function(){
		$(this).fadeTo("fast", 0.6); // This should set the opacity back to 60% on mouseout
	});
});


// SideMenu-T2
$(document).ready(function(){
	$('#SideMenu-T2 ul').slideUp(700);
//	$('#SideMenu-T2 ul').hide();
	$('#SideMenu-T2 ul.actief').show();
	$('#SideMenu-T2 li a').click(function() {
			$('#SideMenu-T2 ul.open').slideUp(700).removeClass("open");
			$(this).next().hide().slideDown(700).addClass("open");
			return false;
		}
	);
});


//$(document).ready(function(){
//    $('div.box').corner("8px");
//    $('div.boxright').corner("tr br 10px");
//    $('div.boxtop').corner("top 10px");
//    $('div.boxbottom').corner("bottom 10px");
//});


jQuery.fn.fancybox.defaults.path = 'http://nethome.be/_js/fancybox-1.3.4/';
$(document).ready(function() {
	 $("a.box").fancybox({
	 	'hideOnContentClick': true,
	 	'zoomSpeedIn': 500,
	 	'zoomSpeedOut': 500,
	 	'frameWidth': 500,
	 	'frameHeight': 600,
	 	'overlayShow': true,
        'titlePosition': 'inside',
	 	'overlayColor': '#fff',
	 	'overlayOpacity': 0.60
	 	});

 });

// Automatically sets a form's label width correctly

$(document).ready(function() {
    var max = 0;
    $("form.autowidth label").each(function(){
        if ($(this).width() > max)
            max = $(this).width();
    });
    $("form.autowidth label").width(max);
});

// Loading on works page
$(document).ready(function() {
       jQuery(".loading").show();
       jQuery("body#works #main .grid_9").show("slow");
       jQuery("body#works #main .grid_3").show("slow");
       jQuery(".loading").hide();
});

