$(function(){
		   
	//slider options
	var slider = $('#slider').bxSlider({
		  mode: 'fade',
		  speed: 3000,
		  controls: false,
		  autoHover: true,
		  auto: true,
		  pager: false
	});
	var slider = $('#slider2').bxSlider({
		  mode: 'fade',
		  speed: 3000,
		  controls: false,
		  autoHover: true,
		  auto: true,
		  pager: false
	});
	
	
	// create tab panel
	$("ul.tabs").tabs("div.panes > div");
		
	// not send user to top page on tab click
	$("ul .tabs a").bind('click', function(){ return false; });

	/*
	*	DETECT IE7 BROWSER
	*/ 
	if ($.browser.msie  && parseInt($.browser.version) == 7) 
	{			
		// for IE7 margin-right product
		$('.tab .panes ul li:nth-child(3n)').css('margin-right','0px');
	}
	
	/*
	*	copy from the domain input to domain-email input 
	*/
	function onChange(a, b)
	{
		var domain = $(a).val();
		$(b).val(domain);
	}
	
	$("#domain-pec input").focusout(function(){
		onChange($(this), "#domain-email-pec input");
	});
	
	$("#domain-email-pec input").focusout(function(){
		onChange($(this), "#domain-pec input");
	});
	
	// Simulo il click sul tab
	path = window.location;
	path = path.toString();
	if(path.search("speakerweb") !== -1) $(".tabs a:contains('SpeakerWeb')").trigger('click');
	else if(path.search("webtv") !== -1) $(".tabs a:contains('Web TV')").trigger('click');
	else if(path.search("hosting") !== -1) $(".tabs a:contains('Hosting')").trigger('click');


});

//same height 
var sameHeight = function (a){
	var mx = 0;
	var a = $(a); 
	$.each(a, function(){
		
		var h = $(this).height();
		if( h > mx) mx = h;
		
	})
	
	$(a).css('height', mx);
	
}

// set the height of the first element to the second
var setHeight = function(a){
	var a =$(a);
	var h = a.height();
	
	a.css("height",h);
}

// open div and change image
var openit = function(a, pathimg) {
	
	var div = $(a).next();
	var a = $(a);
	
	div.css('display','none');	
	a.css('cursor', 'pointer');
	
	a.click(function(){
		var div = $(this).next();
		$(this).css('background',pathimg);
		div.animate({ height: 'toggle' }, 1000);
		
	})

}
