/* 汎用関数 */
$(document).ready(function(){
	$("h3:first").css("margin-top", "20px");	//最初のh3要素のみ上マージンを空けて、h2要素とすき間をとる（rss.html）
});	//汎用効果はこの上に



/* 経過日数表示関数（index.html） */

function getCountDownDay2(theYear,theMonth,theDate){
	theMonthName = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	today    = new Date();						//現在の時を取得するオブジェクトを生成
	endDay   = theMonthName[theMonth-1]+" "+theDate+","+theYear;	//指定した日付
	endToday = new Date(endDay);					//指定した日付のオブジェクトを生成
	dayCount = 24 * 60 * 60 * 1000;					//24時間×60分×60秒×1000秒、つまり１日
	countDay = (endToday.getTime() - today.getTime()) / dayCount;	//日付の差分を求める
	return Math.abs(Math.floor(countDay)+1);					//強制的に切り上げる
}	//経過日数

/* ツールチップ表示関数（works.html） */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		windowWidth = document.body.clientWidth;
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){
		this.t = this.title;
		header = $(this).text();
		this.title = "";
		$("body").append("<div id='tooltip'><h5>" + header + "</h5><p>"+ this.t +"</p></div>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("width", "600px")//ツールチップの幅
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};	//ツールチップ

/* 写真集表示関数（photo_collection.html） */
function photo_collection(){
	
	// getBrowserWidth() by Cameron Adams   
	// http://www.themaninblue.com/experiment/ResolutionLayout/   
	function getBrowserWidth (){
		if (window.innerWidth){return window.innerWidth;}
		else if (document.documentElement && document.documentElement.clientWidth != 0 ) {
			return document.documentElement.clientWidth;}
		else if (document.body){ return document.body.clientWidth;}
		return 0;
	}
	var browserWidth = Math.floor((getBrowserWidth () - 120) / 200) * 200;
	$("#sleeve").css("width", Math.max(800,browserWidth) + "px");
	//#sleeveの幅を800かそれ以上の200の倍数に
	
	$("#sleeve").load("news.html #items img");
	
/*	$("#sleeve").load("news.html #items img", function(){
		var sleeveObj = $.makeArray($(this).children());
		sleeveObj[1].css("border","white solid 1px!important");


	var m = sleeveObj.length;
	var n = m;
	for (var j = 0; j < n; j++){
		sleeveObj[j].wrap('<a href="./news.html#item' + m + '"');
		m--;
	}//for

	});

*/

};
