$(function(){

    var config = {    
         sensitivity: 500, // number = sensitivity threshold (must be 1 or higher)    
         interval: 100,  // number = milliseconds for onMouseOver polling interval    
         over: doOpen,   // function = onMouseOver callback (REQUIRED)    
         timeout: 50,   // number = milliseconds delay before onMouseOut    
         out: doClose    // function = onMouseOut callback (REQUIRED)    
    };
    
    function doOpen() {
        $(this).addClass("hover");
        $('div:first',this).css({visibility: "visible", display: "none"}).slideDown(300);
    }
 
    function doClose() {
        $(this).removeClass("hover");
        $('div:first',this).slideUp(400);
    }

    $("#menu li").hoverIntent(config);
    

});

$(document).ready(function() {
	// VERTICALLY ALIGN FUNCTION
	$.fn.vAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		var ph = $(this).parent().height();
		var mh = (ph - ah) / 2;
		$(this).css('margin-top', mh);
		});
	};
	$('#right_title h2').vAlign();
	$('#right_title h2').delay(1000).fadeIn(3000);

});


function goToForm(lang) {

        space  = $('#chooseSpace').val();

        if (lang != '') {
                lang = '/'+lang;
        }

        switch(space) {
                case '1':
                        window.location = lang+'/formular-comercial/' ;
                        break;
                case '2':
                        window.location = lang+'/formular-office/';
                        break;
                case '3':
                        window.location = lang+'/formular-rezidential/';
                        break;
                default: break;

        }
        
}


$(document).ready(function(){

        $("ul.zoom a").fancybox({
                'overlayShow'			: true,
                'zoomSpeedIn'			: 600,
                'zoomSpeedOut'			: 500,
                'transitionIn'			: 'elastic',
                'transitionOut'			: 'elastic',
                'easingIn'				: 'easeOutBack',
                'easingOut'				: 'easeInBack',
                'padding'               : 3,
                'overlayOpacity'        : 0.9,
                'titleShow'				: true,
                'titlePosition'			: 'over'
        });

});


