// JavaScript Document
function replaceImage(img) {
  if (img.width == '1' && img.src.match(/\.01\./)) {
    img.src = 'http://www.planet-ape.net/amahoo/img/no-image.gif';
  } else if (img.width == '1') {
    img.src = img.src.replace('.09.','.01.');
  }
}

$(document).ready(function(){
	//amazonアソシエイト挿入
	var amazon = $(".amahoo").get();
	for (var i = 0; i < amazon.length; i++) {
		var acode = '/amahoo/2/'+$(amazon[i]).attr("rel")+'/';
		var aobj = amazon[i];
		//$(aobj).load(acode);
		ajaxGet(acode,aobj);
		
    }
	//ソースコード表示用
    //prettyPrint();

    //lightbox表示用
	$('div.textBody a.lb').lightBox();

	//document.write('<p class="shuffle"><a href="<?php echo get_settings('home'); ?>/?random"><img src="<?php bloginfo('template_directory'); ?>/images/shuffle.png"></a></p>');



});

function ajaxGet(acode,obj){
		$.get(acode, function(data){
			$(obj).replaceWith(data);
		});
}