jQuery(function($) {
    $('#slider').cycle({
        fx:      'fade',
        timeout:  3000,
		speed:    3000,
        prev:    '.nivo-prevNav',
        next:    '.nivo-nextNav'
    });
});
jQuery(function($) {
    $('#slidere').cycle({
        fx:      'fade',
        timeout:  1500,
		speed:    1500,
        prev:    '.nivo-prevNav',
        next:    '.nivo-nextNav'
    });
});
jQuery(function($) {
    $('#testimonials').cycle({
        fx:      'fade',
        timeout:  1500,
		speed:    1500,
        prev:    '.nivo-prevNav2',
        next:    '.nivo-nextNav2'
    });
});
jQuery(function($) {
    $('#bannerslide').cycle({
        fx:      'turnRight',
        timeout:  4000,
		speed:    1000
    });
	   $('#lito').cycle({
        fx:      'turnLeft',
        timeout:  4000,
		speed:    1000
    });
	$('#seni').cycle({
        fx:      'turnUp',
        timeout:  4000,
		speed:    1000
    });
	$('#spec').cycle({
        fx:      'turnDown',
        timeout:  4000,
		speed:    1000
    });
});
jQuery(function($) {
    $('#bannerleft').cycle({
        fx:      'fade',
        timeout:  3000,
		speed:    2000
    });
});

$(document).ready(function() {
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}


	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);



});
//Initialize 2nd demo:
ddaccordion.init({
	headerclass: "pachet", //Shared CSS class name of headers group
	contentclass: "continutpachet", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["accclosed", "accopen"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
$(document).ready(function() {
	$('#myselectbox4').selectbox({debug: true});
});
	jQuery(document).ready(function($) {
		$('.cereoferta,.cauta,.rezerv,.lpbutondetalii').append("<span class='hover'><\/span>").each(function () {
	  		var $span = $('> span.hover', this).css('opacity', 0);
	  		$(this).hover(function () {
	    		$span.stop().fadeTo(500, 1);
	 		}, function () {
	   	$span.stop().fadeTo(500, 0);
	  		});
		});
	});

