$.fn.vAlign = function() {
    return this.each(function(i) {
        var h = $(this).height();
        var oh = $(this).outerHeight();
        var mt = (h + (oh - h)) / 2;
        $(this).css("margin-top", "-" + mt + "px");
        $(this).css("top", "50%");
        $(this).css("position", "absolute");
		$(this).css("display", 'block');
    });
};
$.fn.vBottomAlign = function() {
    return this.each(function(i) {
        $(this).css("bottom", "0%");
        $(this).css("position", "absolute");
		$(this).css("display", 'block');
    });
};
$.fn.vAll = function() {
    return this.each(function(i) {
        var h = $(this).height();
        var oh = $(document).height();
		//alert(h+' '+oh)
		if (oh > h)
		{
		   $(this).css("height", oh);
		}
       // var mt = (h + (oh - h)) / 2;
    });
};
$(document).ready(function() {
	$('.logo1').vAlign();
	$('.slogan').vBottomAlign();
	$('.div_principal').vAll();
	
	$('#defile1').cycle(
	{ 
		next:  '#defile1', 
		fx:  'fade', 
        speed:  'fast',
		timeout: 3000,
		pager:  '#nav1',
		allowPagerClickBubble: true,
		pagerAnchorBuilder: function(index, el) {
			return ' '; // whatever markup you want
		}
	});
	$('#defile2').cycle(
	{ 
		fx:  'scrollHorz', 
        speed:  'fast',
		timeout: 4000,
		pager:  '#nav5',
		allowPagerClickBubble: true,
		pagerAnchorBuilder: function(index, el) {
			return ' '; // whatever markup you want
		}
	});
	$('#slider').cycle({ 
		fx:  'fade', 
		next:  '#slider',
		speed:  700,
		timeout: 5000,
		allowPagerClickBubble: true,
		pager:  '#nav3'
	});
		
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animation_speed: 'fast', /* fast/slow/normal */
		opacity: 0.80, /* Value between 0 and 1 */
		show_title: false, /* true/false */
		allow_resize: false, /* Resize the photos bigger than viewport. true/false */
		theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
		horizontal_padding: 19, /* The padding on each side of the picture */
		hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
		wmode: 'opaque', /* Set the flash wmode attribute */
		modal: false, /* If set to true, only the close button will close the window */
		ie6_fallback: true
	});
	
});
$(function() {
	$("#2").lavaLamp({
                fx: "backout",
                speed: 700,
                click: function(event, menuItem) {
                    return true;
                }
            });
			// no conflict -> remove jquery.easing.min.js and put this code
	jQuery.extend( jQuery.easing,
	{ 
		bouncein: function(x, t, b, c, d) {
			return c - jQuery.easing["bounceout"](x, d - t, 0, c, d) + b;
		},    
		backout: function(x, t, b, c, d) {
			var s = 1.70158;
			return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
		}
	});
	
	/*var autoscrolling = true;
	$('.infiniteCarousel_1').infiniteCarousel().mouseover(function () {
	  autoscrolling = false;
	}).mouseout(function () {
	  autoscrolling = true;
	});
	setInterval(function () {
	  if (autoscrolling) {
		$('.infiniteCarousel_1').trigger('next');
	  }
	}, 4000);*/
});