$(function(){

//プリロードイメージ
	var buttonImg=$('#wrapper img[src*="_off"]');
	buttonImg.each(function()
		{
			plImg=$(this).attr("src").split("_");
			if(plImg.length==3){
				crtFileType=plImg[2].split(".");
					$(this).attr("src",plImg[0]+"_"+plImg[1]+"_on."+crtFileType[1]);
					$(this).attr("src",plImg[0]+"_"+plImg[1]+"_off."+crtFileType[1]);
			}
			else if(plImg.length==2){
				crtFileType=plImg[1].split(".");
					$(this).attr("src",plImg[0]+"_on."+crtFileType[1]);
					$(this).attr("src",plImg[0]+"_off."+crtFileType[1]);
			}
		});
//ロールオーバー
	buttonImg.hover(
		function(){
			crtImg=$(this).attr("src").split("_");
			if(crtImg.length==3){
				crtFileType=crtImg[2].split(".");
				$(this).attr("src",crtImg[0]+"_"+crtImg[1]+"_on."+crtFileType[1]);
			}else if(crtImg.length==2){
				crtFileType=crtImg[1].split(".");
				$(this).attr("src",crtImg[0]+"_on."+crtFileType[1]);
			}
		},
		function(){
			crtImg=$(this).attr("src").split("_");
			if(crtImg.length==3){
				crtFileType=crtImg[2].split(".");
				$(this).attr("src",crtImg[0]+"_"+crtImg[1]+"_off."+crtFileType[1]);
			}else if(crtImg.length==2){
				crtFileType=crtImg[1].split(".");
				$(this).attr("src",crtImg[0]+"_off."+crtFileType[1]);
			}
		});

});
$(window).load(function(){
/*-------------------- 未読、既読、あとで読む　CSS切り替え --------------------*/
	//あとで
	$("#search_result.search_result1 .read_status ul li.read_later a").click(function(){
		$(this).parent().parent().parent().parent().attr("class","contena_4");
	});
	//既読
	$("#search_result.search_result1 .read_status ul li.read_already a").click(function(){
		$(this).parent().parent().parent().parent().attr("class","contena_3");
	});
	//未読
	$("#search_result.search_result1 .read_status ul li.read_still a").click(function(){
		$(this).parent().parent().parent().parent().attr("class","contena_0");
	});
/*-------------------- 外部リンク --------------------*/
//外部サイト（自分のドメインは除く）
/*
	$("#main a[href^='http://']").click(function()	{
		var mydomain = "www.feed-man.com";
		crtLink = $(this).attr("href").split("/");
		if(crtLink[2] != mydomain){
			$(this).attr("target","_blank");
		}
	});
*/
/*-------------------- トップページ横カラム高さ調整 --------------------*/
	if($("body").attr("id") == "index"){
		var aHeight = $("#main .ranking").height();
		if( aHeight <= $("#main .new").height() ){
			aHeight = $("#main .new").height();
		}
		$("#main .ranking,#main .new").css("height", aHeight);
	}
/*-------------------- Debug用 --------------------*/
//description、keywordチェック
/*
	$("body").prepend('<div style="margin: 0px; padding: 5px 5px 5px 10px; overflow: hidden; -moz-border-radius-bottomleft: 12px; display: block; position: fixed; top: 0pt; right: 0pt; z-index: 10000; width: auto; height: 30px; background-color: rgb(51, 51, 51); color: white; font-size: 13px; text-align: right; opacity: 0.65;">description: ' + $("meta:[name^='description']").attr("content") + '<br />keywords   : ' + $("meta:[name^='keywords']").attr("content") + '</div>');

//altチェック
	$("img").each(function(){
		var h = $(this).height();
		var w = $(this).width();
		if($(this).attr("alt")){
			$(this).after('<div style="z-index:10000;position: absolute;background-color: #333;opacity: 0.75; color:#FFF; font-size:10px; padding:5px;margin-top:-' + h + 'px;width:' + (w-10) + 'px;">' + $(this).attr("alt") + '</div>');
		}
		else{ $(this).css({ backgroundColor:"#F00", padding:"5px" }); }
	});
*/
});
