//Scrolling effect
$(function(){
   $('a[href^=#]').click(function() {
      var speed = 800;
      var href= $(this).attr("href");
      var target = $(href == "#" || href == "" ? 'html' : href);
      var position = target.offset().top;
      $($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
      return false;
   });
});


//Scroll to comment
$(function(){
	setTimeout(function(){
		var url = location.href;	
		if (url.match(/comments/i)) {
			var speed = 1500;
			var target = $('#comment').offset().top;
			//alert(target);
			$($.browser.safari ? 'body' : 'html').animate({scrollTop: target }, speed, 'swing');
			return false;
		}	
	},2000);
});


//+1 button
(function() {
	var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
	po.src = 'https://apis.google.com/js/plusone.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();



//For lazyload
$(function() {
	$("#center_column img").lazyload({
		effect      : "fadeIn"
	});
});

//IE redirecter
var ie = (function(){
var undef, v = 3, div = document.createElement('div');
	while (
		div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->',
		div.getElementsByTagName('i')[0]
	);
	return v> 4 ? v : undef;
}());

if(ie <= 8 ) {
		location.replace('http://hdri.iwalk.jp/fxxk.php');
}

//Global navigation positioner
$(window).load(resizer);
$(window).bind("resize", resizer);


function resizer(){
	if ( window.innerWidth ) {
		var window_width = 1280;
		
		if(window.innerWidth > window_width){
			$("body").removeClass("window_small");
		}else{
			$("body").addClass("window_small");
		}
	}
	else if ( document.documentElement && document.documentElement.clientWidth != 0 ) {
		if(document.documentElement.clientWidth > window_width){
			$("body").removeClass("window_small");
		}else{
			$("body").addClass("window_small");
		}
	}
	else if ( document.body ) {
		if(document.body.clientWidth > window_width){
			$("body").removeClass("window_small");
		}else{
			$("body").addClass("window_small");
		}
	}
	return 0;
}


