// JavaScript Document

// homepage menu rollovers
function setState(iState,iTarget,iTrigger,iAmount){
	/*
	if(iState=="show"){
		document.getElementById(iTarget).style.display = 'block';
		document.getElementById(iTrigger).style.backgroundPosition = ("0px "+iAmount+"px");
	}else{
		document.getElementById(iTarget).style.display = 'none';
		document.getElementById(iTrigger).style.backgroundPosition = "0px 0px";
	}
	*/
}

var prod, sus, res;

// width of the menus

prod = 150;
sus = 400;
res = 360;

$(document).ready(function(){


	var menu1 = $("#products_wrapper");
	menu1.bind('mouseleave', function() {
		$("#products_slidedown").css("display", "none");
		$("#products_wrapper .tab_content").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});
	
	var menu2 = $("#sustainable_wrapper");
	menu2.bind('mouseleave', function() {		
		$("#sustainable_slidedown").css("display", "none");
		$("#sustainable_wrapper .tab_content").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});
	
	var menu3 = $("#resources_wrapper");
	menu3.bind('mouseleave', function() {				
		$("#resources_slidedown").css("display", "none");
		$("#resources_wrapper .tab_content").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "")
	});
	
	// Products

	$("#products_wrapper .tab_right_wrapper").css("margin-left", ($("#products_wrapper .tab_content").width()+16)+"px");
	$("#products_wrapper .tab_right_wrapper").css("margin-top", "-"+($("#products_wrapper .tab_right_wrapper").height())+"px");

	$("#products_wrapper .tab_wrapper").css("width", ($("#products_wrapper .tab_content").width()+16)+"px");
	$("#products_wrapper .tab_wrapper p").css("margin", "0 4px 0 4px");
	
	$("#products_wrapper").css("width", prod+"px");
	$("#products_wrapper .right_wrapper").css("margin-left", (prod)+"px");
	
	$("#products_wrapper .menu_wrapper").css("width", $("#products_wrapper").width()+"px");
	$("#products_wrapper .menu_wrapper").css("height", ($("#products_wrapper .menu_wrapper").height()+16)+"px");
	
	$("#products_wrapper .bottom_wrapper").css("margin-top", ($("#products_wrapper .menu_wrapper").height())+"px");
	$("#products_wrapper .menu_bottom").css("width", ($("#products_wrapper").width()-16)+"px");
	
	$("#products_wrapper .menu_right").css("height", $("#products_wrapper .menu_wrapper").height()-15+"px");
	$("#products_wrapper .menu_content").css("width", ($("#products_wrapper").width()-16)+"px");
	
	// Sustainability
	
	$("#sustainable_wrapper .tab_right_wrapper").css("margin-left", ($("#sustainable_wrapper .tab_content").width()+16)+"px");
	$("#sustainable_wrapper .tab_right_wrapper").css("margin-top", "-"+($("#sustainable_wrapper .tab_right_wrapper").height())+"px");

	$("#sustainable_wrapper .tab_wrapper").css("width", ($("#sustainable_wrapper .tab_content").width()+16)+"px");
	$("#sustainable_wrapper .tab_wrapper p").css("margin", "0 4px 0 6px");
	
	$("#sustainable_wrapper").css("width", sus+"px");
	$("#sustainable_wrapper .right_wrapper").css("margin-left", (sus)+"px");
	
	$("#sustainable_wrapper .menu_wrapper").css("width", $("#sustainable_wrapper").width()+"px");
	$("#sustainable_wrapper .menu_wrapper").css("height", ($("#sustainable_wrapper .menu_wrapper").height()+16)+"px");
	
	$("#sustainable_wrapper .bottom_wrapper").css("margin-top", ($("#sustainable_wrapper .menu_wrapper").height())+"px");
	$("#sustainable_wrapper .menu_bottom").css("width", ($("#sustainable_wrapper").width()-16)+"px");
	
	$("#sustainable_wrapper .menu_right").css("height", $("#sustainable_wrapper .menu_wrapper").height()-15+"px");
	$("#sustainable_wrapper .menu_content").css("width", ($("#sustainable_wrapper").width()-16)+"px");
	
	// Resources
	
	$("#resources_wrapper .tab_right_wrapper").css("margin-left", ($("#resources_wrapper .tab_content").width()+16)+"px");
	$("#resources_wrapper .tab_right_wrapper").css("margin-top", "-"+($("#resources_wrapper .tab_right_wrapper").height())+"px");

	$("#resources_wrapper .tab_wrapper").css("width", ($("#resources_wrapper .tab_content").width()+16)+"px");
	$("#resources_wrapper .tab_wrapper p").css("margin", "0 0 0 6px");
	
	$("#resources_wrapper").css("width", res+"px");
	$("#resources_wrapper .right_wrapper").css("margin-left", (res)+"px");
	
	$("#resources_wrapper .menu_wrapper").css("width", $("#resources_wrapper").width()+"px");
	$("#resources_wrapper .menu_content").css("height", ($("#resources_wrapper .menu_content").height()+16)+"px");
	
	$("#resources_wrapper .bottom_wrapper").css("margin-top", ($("#resources_wrapper .menu_wrapper").height())+"px");
	$("#resources_wrapper .menu_bottom").css("width", ($("#resources_wrapper").width()-16)+"px");
	
	$("#resources_wrapper .menu_right").css("height", $("#resources_wrapper .menu_wrapper").height()-15+"px");
	$("#resources_wrapper .menu_content").css("width", ($("#resources_wrapper").width()-16)+"px");
	
	$("#products_slidedown").css("display", "none");
	$("#sustainable_slidedown").css("display", "none");
	$("#resources_slidedown").css("display", "none");
	
	$("#products_slidedown").css("visibility", "visible");
	$("#sustainable_slidedown").css("visibility", "visible");
	$("#resources_slidedown").css("visibility", "visible");
	
	// Set functions
	
	$("#products_wrapper .tab_content a").mouseover(function () {
		$("#products_slidedown").css("display", "block");
		$("#products_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
		$("#sustainable_slidedown").css("display", "none");
		$("#resources_slidedown").css("display", "none");
		
		$("#sustainable_wrapper .tab_content").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "");
		
		$("#resources_wrapper  .tab_content").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});
	
	$("#products_slidedown").mouseover(function(){
		$("#products_slidedown").css("display", "block");
		$("#products_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
	}).mouseout(function(){
		$("#products_slidedown").css("display", "none");
		$("#products_wrapper .tab_content").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});	
	
	$("#sustainable_wrapper .tab_content a").mouseover(function () {
		$("#sustainable_slidedown").css("display", "block");
		$("#sustainable_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
		$("#products_slidedown").css("display", "none");
		$("#resources_slidedown").css("display", "none");
		
		$("#products_wrapper .tab_content").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "");
		
		$("#resources_wrapper  .tab_content").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});
	
	$("#sustainable_slidedown").mouseover(function(){
		$("#sustainable_slidedown").css("display", "block");
		$("#sustainable_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
	}).mouseout(function(){
		$("#sustainable_slidedown").css("display", "none");
		$("#sustainable_wrapper .tab_content").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});
	
	$("#resources_wrapper .tab_content a").mouseover(function () {
		$("#resources_slidedown").css("display", "block");
		$("#resources_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
		$("#sustainable_slidedown").css("display", "none");
		$("#products_slidedown").css("display", "none");
		
		$("#products_wrapper .tab_content").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#products_wrapper .tab_right_wrapper .tab_right").css("background", "");
		
		$("#sustainable_wrapper .tab_content").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#sustainable_wrapper .tab_right_wrapper .tab_right").css("background", "");

	});
	
	$("#resources_slidedown").mouseover(function(){
		$("#resources_slidedown").css("display", "block");
		$("#resources_wrapper .tab_content").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat 0 0");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right top");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "transparent url('/public/_img/drop_bg.png') no-repeat right center");
	}).mouseout(function(){
		$("#resources_slidedown").css("display", "none");
		$("#resources_wrapper .tab_content").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_top_right").css("background", "");
		$("#resources_wrapper .tab_right_wrapper .tab_right").css("background", "");
	});	
	
});


