$(window).bind("load",function(){

//$(".pane").filter(":eq(0)").hide();

$("#pagetop").click(function(){
	pageScroll();
	return false;
});

bodyHeight();
$(window).resize(function(){
bodyHeight();
});


if($.browser.msie && $.browser.version < 7) {
$(".photo_t, .photo_b, .aboutph_t, .aboutph_b").pngfix();
}



});


$(document).ready(function(){
//$(window).bind("load",function(){
//$(function(){
		   
//////////////////////

$('.post').each(function() {
	
	$(this).prepend('<div class="postcnr_t"></div>');
	$(this).append('<div class="postcnr_b"></div>');
	
	var $this = $(this);
	$('.postbody', $(this)).prepend('<div class="photoboxwrap"></div>');
	$('.postbody', $(this)).append('<div class="textbox"></div>');
	
	$('form').appendTo($('.textbox', $this));
	
	$('p:not(".category, .data"), h3, ul', $(this)).not('form p').each(function(i) {
		if($('img',$(this)).size() || $('object',$(this)).size() ){
			$(this).addClass('photobox');
			$(this).prepend('<span class="photo_t"></span>');
			$(this).append('<span class="photo_b"></span>');
			$(this).appendTo($('.photoboxwrap', $this));
		}else{
			$(this).appendTo($('.textbox', $this));
		}
	});
	
	$('.postheader', $(this)).prependTo($('.textbox', $(this)));
	
	//$('.photobox:last',$(this)).css('margin-bottom','-8px');
	$('p:last',$(this)).css('margin-bottom','0');
	
	
	
});


$('#about img').each(function() {
	$(this).wrap("<span class='aboutph'></span>");
	$(this).before('<span class="aboutph_t"></span>');
	$(this).after('<span class="aboutph_b"></span>');
});


$('.nextpostslink').attr({rel: 'next'});

//////////////////////

});

////////////////////////////////////////////

function bodyHeight() {
	if(!$.browser.msie) {
		$(document.body).height($("#page").height());
	}else{
	$("#footer").css({'bottom':0});
	}
}

function pageScroll(o){
	if(!o) o=0;
	$.scrollTo(o,250);
}

function slideToggle(o) {
	var $tgtNode = $("div.pane", $(o.parentNode.parentNode));
	$tgtNode.slideToggle("fast");
}



/*document.body.addEventListener('DOMNodeInserted',function(evt){
    if (/hoge/i.test(evt.target.className)) {
         // 処理
		 alert('a');
    }
}, false);*/


/*document.body.addEventListener('AutoPagerize_DOMNodeInserted',function(evt){
    var node = evt.target;
    var requestURL = evt.newValue;
    var parentNode = evt.relatedNode;
    // 処理
	alert(node);
}, false);*/


/*
var boot = function(){
    AutoPagerize.addFilter(function(docs){
        docs.forEach(function(node){
            if (/hentry/i.test(node.className)) {
                // 処理
				alert('a');
            }
        });
    });
};
if (window.AutoPagerize) {
    boot();
} else {
    window.addEventListener('GM_AutoPagerizeLoaded',boot,false);



 */