  $(document).ready(function(){
  
  

	$("div#content_toggle").css("display","block");
	$("a.content_hide").css("display","block");
	$("div#content_toggle_top").css("display","block");
   
	var hidden=false;
	$("#content_toggle_top").hide();
    testWidth();
	
	
	
	function testWidth(){
		var tw=$(window).width();
		var minW=950; //MAGIC NUMBER
		if (tw < minW) {
			// to small
			$("#content_toggle").hide();
			if (hidden) {
				$("#content_toggle_top").show();
			}
			else {
				$("#footer .content_hide").show();
			}
		}
		else {
			// wide enough
			$("#content_toggle").show();
			
			$("#content_toggle_top").hide();
			$("#footer .content_hide").hide();
			
			var hwh=$("#headerwrapper").height();
			//alert(hwh);
			$("#content_toggle").css("top",hwh);
			
		}		
	}
	
	$(window).resize(function() {
		testWidth();
	});
	
	

	
	
   
    $("#content_toggle").mouseup(function(){
		if (hidden) {
			hidden=false;
			$(".content").show();
			$("#content_toggle a.ct_show").hide();
			$("#content_toggle a.ct_hide").show();
			$("#footer").show();
			$("div#headergap").removeClass("header_space_gap_temp");
			callToActionscript_BackMode('m', 'back');
		
		} else {
			hidden=true;
			$(".content").hide();
			
			$("#content_toggle a.ct_show").show();
			$("#content_toggle a.ct_hide").hide();
			$("#footer").hide();
			
			
			$("div#headergap").addClass("header_space_gap_temp");
			callToActionscript_FullMode('m', 'full');
		}

    });
	
	
	
	
	
	
	$("#footer .content_hide").mouseup(function(){
		$(".content").hide();
		$("#footer").hide();
		$("#content_toggle_top").show();
		hidden=true;
		$("div#headergap").addClass("header_space_gap_temp");
		callToActionscript_FullMode('m', 'full');
    });
	
	$("#content_toggle_top").mouseup(function(){
		hidden=false;
		$(".content").show();
		$("#footer").show();
		$("#content_toggle_top").hide();
		$("div#headergap").removeClass("header_space_gap_temp");
		callToActionscript_BackMode('m', 'back');
    });
	
		
		
  });