/**
 * @author Fred
 */

diagnose("landing_controller loaded", true);
$(document).ready(function(){
	
	$("a.show_extra_content").unbind("click");
	$("a.show_extra_content").bind("click",function(){
		
		container 	= $(this).parents("div.range_container");
		var clone	= container.clone().appendTo("#products_landing_container");
		position	= container.position();
		clone.css({
			position:"absolute",
			height:375,
			top:0,
			"z-index":5,
			left:position.left
		})
		.find("a.show_extra_content").hide().end()
		.find("p.extra_content").show()
		.find("a.hide_extra_content").bind(
			"click", function(){
				clone.remove();
			}
		);
		
	})
	
	$("a.hide_extra_content").unbind("click");
	$("a.hide_extra_content").bind("click",function(){
		alert("click");
	})
	
	var oMb;
	$("a.show_extra_landing_content").unbind("click");
	$("a.show_extra_landing_content").bind("click",function(){
		
		diagnose("show extra");
		
		var parent = $(this).parent().parent();
		
		var oMb = parent.find("img.choose_choose").css("margin-bottom");
		
		var curWidth = $("img.choose_choose").width();
		
		diagnose(curWidth);
		
		parent.find("img.choose_choose").css({width:curWidth}).slideUp("fast", function(){
			parent.find("p.extra_landing_content").slideDown("fast");
		});
		
		if($(this).hasClass("domains")){
			$("img.instant_activation_sash").fadeOut("fast");
		}
		
		$(this).hide();
			
	});
	$("a.hide_extra_landing_content").unbind("click");
	$("a.hide_extra_landing_content").bind("click",function(){
		
		var parent = $(this).parent().parent();
		
		parent.find("p.extra_landing_content").slideUp("fast", function(){
			parent.find("img.choose_choose").slideDown("fast");
		});
		
		if($(this).hasClass("domains")){
			$("img.instant_activation_sash").fadeIn("fast");
		}
		
		parent.find("a.show_extra_landing_content").show();
			
	});			
})