function init() {
	
	
	/**
	 * レイアウト変更
	 */
	if(!isSlide) {
		
		$('#mainEntries').prepend($('#hentry_slideshow')).css({marginTop: 0});
		
	}
	
	/**
	 * メインエントリー
	 */	
	 
	//並べ替え
	$('#mainEntries').masonry({
		animate: false
	});
	
	
	//一つずつ表示
	$('#mainEntries .hentry').each(function(i){
		
		var msec = 100*i;
		$(this).css({opacity: 0, visibility:"visible"}).animate({opacity: 0}, msec).animate({opacity: 1}, 500);
			
	});

	
}

function slideStart() {
	
	/**
	 * メインビジュアル (スライド)
	 */
	
	if(isSlide) {
			
			//スライド作成
			var slide = document.getElementById("slide");
			var slideController = document.getElementById("slideController");
			slides = new Array();
			
			$('#hentry_slideshow #mainVisual #slides #source a').each(function(index){
				
				//画像要素作成
				//var newImg = document.createElement("img");
				//newImg.src = this.src;
				
				//画像要素の高さと幅を消去
				var img = this.getElementsByTagName("img")[0];
				
				if(img) {
					img.removeAttribute("width");
					img.removeAttribute("height");
						
					//追加
					slide.appendChild(this);
				
					//スライドコントローラー追加
					var controller = document.createElement("a");
					//controller.addEventListener("mouseover", function(e){ clearInterval(slideShowId); $("#slide").stop(); window.slide(index); }, false);
					//controller.addEventListener("mouseout", function(e){ slideShowId = setInterval(window.slideShow, 8000);}, false);
					$(controller).hover(
					
						function(){
							clearInterval(slideShowId);
							$("#slide").stop();
							window.slide(index); 
						},
						
						function(){
							slideShowId = setInterval(window.slideShow, 8000);
						}
					
					);
		
					controller.appendChild(document.createTextNode("●"));
					slideController.appendChild(controller);
				
					//配列に追加
					slides.push({"node": this, "controller": controller});
					
				}
				
			});
			
			imageWidth = 800;
			var slideWidth = imageWidth*slides.length;
			$("#slide").css({opacity: 0, display: "block", width: slideWidth}).animate({opacity:1}, 500, function(){window.slide(0);});
			
			slideShowId = setInterval(window.slideShow, 8000);
		
		
	};
};

document.write("<style type='text/css'> #hentry_slideshow #mainVisual #slides #source, #slide {display: none;} </style>");


$(window).ready(function(){
	slideStart();
//});

//$(window).load(function(){
//$(function(){
	init();
});



