	$(document).ready(function() { 
		$(document).click(function(e) {
			var target_id = e.target.id;
    			var big = $("#login_box_big")[0] || $("#login_box_top_big")[0];
    			var box = $("#login_box")[0] || $("#login_box_top")[0];
    			if (e.target == big || $.contains(big, e.target) || e.target == box || $.contains(box, e.target)) {
				if($("#login_form")[0]) {
					var form = $("#login_form")[0];
					if( e.target == form || $.contains(form, e.target)) {
        					return false;
					}
				}
    			} else {
				big.style.visibility = 'hidden'; //should use jquery hide instead
				box.setAttribute("class", '');
                                if(box.id == 'login_box_top'){box.setAttribute("class", 'bottomLoginBorder');}
				if($("#lightbox") && e.target != $('#lightbox-panel')  && e.target != $('#graph-image')) {
					//$("#lightbox, #lightbox-panel").fadeOut(300);
				}
    			}
		});
		$("a#show-panel").click(function(){  
 			$("#lightbox, #lightbox-panel").fadeIn(300);  
 		})  
 		$("a#close-panel").click(function(){  
			 $("#lightbox, #lightbox-panel").fadeOut(300);  
		})  
	});
	
	function toggle_display_login() {
		var box_big = document.getElementById('login_box_big');
		var box = document.getElementById('login_box');
		if(box_big.style.visibility != 'visible') {
			box_big.style.visibility = 'visible'; //should use jquery 
			box.setAttribute("class", 'shadow_left');
		} else {
			box_big.style.visibility = 'hidden';
			box.setAttribute("class", '');
                }
	}
	function toggle_display_login_top() {
                var box_big = document.getElementById('login_box_top_big');
                var box = document.getElementById('login_box_top');
                if(box_big.style.visibility != 'visible') {
                        box_big.style.visibility = 'visible'; //should use jquery
                        box.setAttribute("class", 'shadow_left bottomLoginBorderNone');
                        //box.style.borderBottom = 'none';
                        //box.style.borderBottomRightRadius = '0';
                        //box.style.MozBorderRadiusBottomRight = '0';
                        //box.style.WebkitBorderBottomRightRadius = '0';
                       
                } else {
                        box_big.style.visibility = 'hidden';
                        box.setAttribute("class", 'bottomLoginBorder');
                        //box.style.borderBottom = '8px solid rgb(236,242,246)';
                        //box.style.borderBottomRightRadius = '5px';
                        //box.style.MozBorderRadiusBottomRight = '5px';
                        //box.style.WebkitBorderBottomRightRadius = '5px';
                }
        }
        function toggle_image(image, src) {
		image.src = src;
		if(/_on/.test(src)) {	
		  image.style.border = "5px solid rgb(213,224,240)";
		  $(image).addClass('shadow');
		} else {
		  image.style.border = "5px solid transparent";//rgb(236,242,246)";
		  $(image).removeClass('shadow');
		}
	}
	function slideInContent(div_id) {
		if(div_id == "info1") {
			$('h2.main').addClass('main_header_selected');
			$('h3.main').removeClass('main_header_selected');
			$('h4.main').removeClass('main_header_selected');
		} else if(div_id == "info2") {
			$('h2.main').removeClass('main_header_selected');
			$('h3.main').addClass('main_header_selected');
			$('h4.main').removeClass('main_header_selected');
		} else {
			$('h2.main').removeClass('main_header_selected');
			$('h3.main').removeClass('main_header_selected');
			$('h4.main').addClass('main_header_selected');
		}

		var middle = $('#container_middle');
		var back = $('#back_home');
		
		if(middle.css('marginLeft') != '-720px') {
			middle.animate({ 
				'marginLeft' : "-=720px"
			}, 'fast', function () {
				<!--$('#find_out_more').hide();-->
                                $('#back_home').fadeIn('slow');
				$('#' + div_id).fadeIn('fast');
			});			
		} else {
			$('#info1').fadeOut('fast');
			$('#info2').fadeOut('fast');
			$('#info3').fadeOut('fast');
			$('#' + div_id).fadeIn('fast');
	        }
		$('h2').removeClass('main_arrow');
		$('h3').removeClass('main_arrow');
		$('h4').removeClass('main_arrow');
                $('#bloggers').hide();
	}
	function backHome() {		
		$('#info1').fadeOut('fast');
		$('#info2').fadeOut('fast');
		$('#info3').fadeOut('fast');
		$('#info4').fadeOut('fast');
		$('#container_middle').animate({ 
			'marginLeft' : "+=720px"
		}, 'fast', function () {
			$('#back_home').hide();			
			<!--$('#find_out_more').show();-->
		});		
		$('h2').addClass('main_arrow');
		$('h3').addClass('main_arrow');
		$('h4').addClass('main_arrow');
		$('h2.main').removeClass('main_header_selected');
		$('h3.main').removeClass('main_header_selected');
		$('h4.main').removeClass('main_header_selected');
                $('#bloggers').show();
	}



