$(function(){
	$("#about_page:visible").hide();
	$("h2").corner();
	$("div.description").corner();
	$("div.site_description").corner();
	$('div.message').wrap('<div class="message_border"></div>');
	$('div.message').corner("round 10px").parent()
	.css('padding', '3px').corner("round 5px");
	$("div.howto_register").corner();
    $("#rss_reader dl dd p").corner("dog 15px");
    $("div.blog dl dd p").corner("dog 15px");
	
	$(window).scroll(function () { 
		var curRCtop = parseInt($("#rightcolumn").css("top"));
		var RCtop;
		var yOff;
		yOff = document.documentElement.scrollTop;
		if (yOff < 300) {
			RCtop = "0px";
		} else if (Math.abs(yOff - curRCtop) > 450) {
    		RCtop = yOff + "px";
    	}
    	$("#rightcolumn").css("top", RCtop);
    });
    
 	$("div.menu").hover(function(){
		$(this).fadeTo("normal", 0.5);
	}, function(){
		$(this).fadeTo("normal", 1.0);
	});

  	$("#rsstable td, #member_table td").hover(function(){
		/* $(this).parent().children().css("font-weight", "bold"); */
		$(this).addClass("selected");
		$(this).siblings().addClass("selected");
	}, function(){
		/* $(this).parent().children().css("font-weight", "normal"); */
		$(this).removeClass("selected");
		$(this).siblings().removeClass("selected");
	});

	function hide_others() {
    	$("#top_images:visible").hide();
    	$("#footer:visible").hide();
		$("#contents").children().each(function(){
    		$(this).hide();
		});
	}

	$("#about").click(function(){
		hide_others();
		$("#about_page:hidden").show();
    	/* $("#iframe").css("height", "125em").attr("src", "about.html").show(); */
 		return false;
	});

	$("#howto").click(function(){
		hide_others();
    	$("#iframe").css("height", "105em").attr("src", "howto.html").show();
		return false;
	});
	
	$("#blog").click(function(){
		hide_others();
    	$("#iframe").css("height", "300em").attr("src", "rss/index.php?page=1").show();
		return false;
	});

	$("#register").click(function(){
		hide_others();
     	$("#iframe").css("height", "700px").attr("src", "register.php").show();
		return false;
	});

	$("#member").click(function(){
		hide_others();
    	$("#iframe").css("height", "300em").attr("src", "member.php").show();
		return false;
	});

	$("#kameesa").click(function(){
 		hide_others();
    	$("#iframe").css("height", "700px").attr("src", "kameesa.html").show();
		return false;
	});

	$("#QandA").click(function(){
		hide_others();
    	$("#iframe").css("height", "1000px").attr("src", "QandA.html").show();
		return false;
	});
	
	$("#intro").click(function(){
		hide_others();
     	$("#iframe").css("height", "700px").attr("src", "intro.html").show();
		return false;
	});
	
	$("#weather").click(function(){
		$("#menu_weather_img").slideToggle("slow");
		$("div.important").toggle();
		$("#myyahoo").toggle();
		$("#mobile").toggle();
        $("#counter").toggle();
		return false;
	});
	
	$("#menu_weather_img").click(function(){
		hide_others();
   		$("#iframe").css("height", "120em").attr("src", "http://www.jma.go.jp/jp/yoho/").show();
 		return false;
	});

	$("#mobile").click(function(){
        $("#img_qrcode").html("<img src='img/qrcode.jpg' alt='QR code' />");
		$("#qrcode").slideToggle("slow");
		$("div.important").toggle();
		$("#myyahoo").toggle();
		$("#counter").toggle();
		return false;
	});

	$("#show_search_form").click(function(){
		$("#search_form").toggle();
		return false;
	});
	
});
