﻿$(function(){

	//slide images
	$.ajax({
		type: "GET",url: "top_img/slide.xml",dataType: "xml",success: xmlParser
    });
	function xmlParser(xml) {
	    $(xml).find("slide").each(function () {
	        $(".slides_container").append(
	        	'<div>' +
				($(this).find("link").text()!="" ? '<a href="' + $(this).find("link").text() + //linkが存在するかしないか。
				'" target="' + $(this).find("target").text() + '">' : "") + //targetの設定
				'<img src="' + $(this).find("image").text() + '">' + //画像のパス設定
				($(this).find("link").text()!="" ? '</a>' : "") + //linkが存在するかしないか。
				'</div>');
		});
	    $('#load').fadeOut();
		$('#slides').slides({
			pagination: true,
			generatePagination: true,
			prependPagination: false,
			fadeSpeed: 1200,
			effect: 'fade',
			crossfade: true,
			play: 3000,
			pause: 1000,
			hoverPause: true,
			bigTarget: false
		});
	}

	//NEW MARK
    var currentDate = new Date();
    $('.entryDay').each(function(){
        var pass = 72; //3days
        var content = '<img class="newmark" src="img/newmark.gif" />';
        var time = $(this).attr('date').split(":");
        var entryDate = new Date(time[0], time[1]-1, time[2], time[3], time[4], time[5]);
        var now = Math.ceil((currentDate.getTime() - entryDate.getTime())/(60*60*1000)); 
        //now = now;
        (now <= pass)?$(this).append(content):0;
    });
});
