function pageInit($section)
{
	switch($section)
	{
		case "frontpage":
		
			frontpage();
			break;
		case "loggedin":
			loggedin();
			break;
		case "register":
			register();
			break;
		case "post_your_challenge":
			toggle_post();
			post_your_challenge();
			break;
		default:
			break;
	}
}

function frontpage()
{
	$(".what_is_it_hover").live("mouseover", function (){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y-0;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y-0;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x+220+'px', 'top' : y-308+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_right.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['rel']);
	});
	$(".what_is_it_hover").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});

	$("#hoverimage_right").live("mouseover", function(){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y+50;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y+50;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x+-43+'px', 'top' : y-73-115+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_right.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['firstChild']['alt']);
	});
	$("#hoverimage_right").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});
	
	$("#hoverimage_left").live("mouseover", function(){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y+50;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y+50;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x-240+'px', 'top' : y-73-115+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_left.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['firstChild']['alt']);
	});
	$("#hoverimage_left").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});
}

function loggedin()
{
	$(".what_is_it_hover").live("mouseover", function (){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y+0;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y+0;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x-50+'px', 'top' : y-310+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_right.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['rel']);
	});
	$(".what_is_it_hover").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});

	$("#hoverimage_right").live("mouseover", function(){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y+50;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y+50;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x+-43+'px', 'top' : y-180+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_right.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['firstChild']['alt']);
	});
	$("#hoverimage_right").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});
	
	$("#hoverimage_left").live("mouseover", function(){
		var x = $(this).position()["left"];
		var y = $(this).position()["top"];
		if($.browser['msie'] == true)
		{
			x=x+0;
			y=y+50;
		}
		if($.browser['opera'] == true)
		{
			x=x+0;
			y=y+50;
		}
		$(".hoverlayer").css({'display' : 'block', 'left' : x-240+'px', 'top' : y-180+'px'});
		$(".hoverlayer").css({'background-image' : 'url("/img/hopenet/hoverimage_left.gif")'});
		$(".hoverlayer_inner").html($(this)['context']['firstChild']['alt']);
	});
	$("#hoverimage_left").live("mouseout", function(){
		$(".hoverlayer").css({'display' : 'none'});
	});
}

function register()
{
	
}

function post_your_challenge()
{
	$("#HopeForSomeoneElse").live("click", function (){
		toggle_post();
	});
}

function toggle_post()
{
	var var_name = $('#HopeForSomeoneElse').attr('checked')?1:0;
	if(var_name == 1)
	{
		$(".someone_else_toggle").css({'display' : 'block'});
		$(".height").css({'height' : '510px'});
		$(".text_height").css({'height' : '430px'});
		$(".get_help_form_button").css({'top' : '390px'});
	}else{
		$(".someone_else_toggle").css({'display' : 'none'});
		$(".height").css({'height' : '460px'});
		$(".text_height").css({'height' : '380px'});
		$(".get_help_form_button").css({'top' : '340px'});
	}
}
