/*
	0-> Class: Javascript-construct
	0-> Use: AllLayout
	0-> Author: 77(host@7nana.jp)
	0-> Version: 1.2 / 2011.05.18
*/
$(document).ready(function(){
	$('img[src*="__roll."]').each(function() {
		var onImages = $(this).attr('src').replace('__roll.','__rollon.');
		$(this).parent().css({'background-image':'url(' + onImages + ')','background-repeat':'no-repeat','height':'auto','overflow':'hidden','display':'inline-block'});
	});
	$('img[src*="__roll."]').hover(function() {	
		$(this).parent().addClass('a_hover');	
		$(this).stop(true,false).animate({opacity:0},500);
		}, function() {
		$(this).stop(true,false).animate({opacity:1},700,function(){$(this).parent().removeClass('a_hover');});
        });
	$("a img,iframe.opacity,.twitter-share-button").hover(function(){
		if(!$(this).attr('src').match("__roll.")){
			$(this).parent().addClass('a_hover');
			$(this).fadeTo(380,0.6);
		}
	},
	function(){
		$(this).fadeTo("normal",1.0,function(){$(this).parent().removeClass('a_hover');});
	});
	function imgActiveChg_with_Category(activeCategory) {
		if(activeCategory == ""){return;}
		if(document.getElementsByTagName) {
			var images = document.getElementsByTagName("img");
			for(var i=0; i < images.length; i++) {
				if(images[i].getAttribute("src").match(activeCategory+"__roll.")){	
				images[i].setAttribute("src", images[i].getAttribute("src").replace("__roll.", "__rollon."));
				images[i].setAttribute("class", "onactive");
				}
			}
		}
	}
	$('a[href*=#],area[href*=#]').click(function() {  
		var target = $(this.hash);  
		target = target.length && target;  
		if (target.length) {  
			var sclpos = 30;  
			var scldurat = 1200;  
			var targetOffset = target.offset().top - sclpos;  
			$('html,body')  
			.animate({scrollTop: targetOffset},'slow');  
			return false;  
		} 
	});
});
