$(document).ready(function() {
						   
	/* ACCORDION */
	
	$("div.accordion-img").click(function() {
		$(".accordion-wrapper").slideToggle("fast");
		pos = $("div.accordion-img").css("background-position");
		if (pos == "0px 0px") {
			$("div.accordion-img").css("background-position", "0px -32px");
			$("#chiedi-preventivo").hide();
		}
		else {
			$("div.accordion-img").css("background-position", "0px 0px");
			$("#chiedi-preventivo").show();
		}
	});
						   
	/* TABBER */
	
	$("#hometabs .tabbody, #sidetabs .tabbody, #portfoliotabs .tabbody, #portfolio2tabs .tabbody").hide();
	$("ul.nav-tabs li.tab").first().addClass("active");
	$("ul.nav-tabs4 li.tab").first().addClass("active");
	$("ul.nav-tabs2 li.tab, ul.nav-tabs3 li.tab").first().addClass("active");
	
	$("#hometabs .tabbody").first().show();
	$("#portfolio2tabs .tabbody").first().show();
	$("#sidetabs .tabbody, #portfoliotabs .tabbody").first().show();
	
	$("ul.nav-tabs li.tab").click(function() {
		var rel = $(this).attr("rel");
		$("ul.nav-tabs li.tab").removeClass("active");
		$(this).addClass("active");
		$("#hometabs .tabbody").hide();
		$("#"+rel).show();
	});
	
	$("ul.nav-tabs2 li.tab").click(function() {
		var rel = $(this).attr("rel");
		$("ul.nav-tabs2 li.tab").removeClass("active");
		$(this).addClass("active");
		$("#sidetabs .tabbody").hide();
		$("#"+rel).show();
	});
	
	$("ul.nav-tabs3 li.tab").click(function() {
		var rel = $(this).attr("rel");
		$("ul.nav-tabs3 li.tab").removeClass("active");
		$(this).addClass("active");
		$("#portfoliotabs .tabbody").hide();
		$("#"+rel).show();
	});
	
	$("ul.nav-tabs4 li.tab").click(function() {
		var rel = $(this).attr("rel");
		$("ul.nav-tabs4 li.tab").removeClass("active");
		$(this).addClass("active");
		$("#portfolio2tabs .tabbody").hide();
		$("#"+rel).show();
	});

	/* TEXT FOCUS */
	
	$("input[type=text], textarea").focusin(function() {
		var rel = $(this).attr("rel");
		var value = $(this).attr("value");
		if (value == rel)
			$(this).attr("value", "");
	});
	
	$("input[type=text], textarea").focusout(function() {
		var rel = $(this).attr("rel");
		var value = $(this).attr("value");
		if (value == "")
			$(this).attr("value", rel);
	});
	
	/* OPACIZE ELEMENTS */
	
	jQuery(".opacize").css("opacity", "0.6");
	jQuery(".opacize").hover(function() {
		jQuery(this).fadeTo(300, 1);
	}, function() {
		jQuery(this).fadeTo(300, 0.6);
	});
	
	/* NAVIGATION MENU */
	
	$(document).ready(function(){
		$("ul.nav-menu > li").hover(
			function(){$(this).find('ul').stop(1,1).fadeIn("fast"); }, 
			function(){$(this).find('ul').stop(1,1).fadeOut("fast") } 
		);
	});
	
	/* DELETE MARGIN AND BORDER */
	
	$(".footer_widget").last().css("margin-right", "0px");
	$("#aboutus .block").last().css("margin-bottom", "0px");
	$("ul.about-side li").last().css("margin-bottom", "-15px");
	$("ul.about-side li").last().css("border-bottom", "0px");
	$("ul.about-side li").first().css("margin-top", "-15px");
	$("ul.feedback li").last().css("margin-bottom", "0px");
	$("ul.feedback li").last().css("border-bottom", "0px");	
	$("ul.feedback li").last().css("padding-bottom", "20px");	
	$(".a_portfolio").last().css("margin-bottom", "0px");
});

