		  function bp_update_res(){
          }
		  function del(){
		  if(window.confirm('本当に削除しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function add(){
		  if(window.confirm('「最近読んだ本」に追加しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function add_pre(){
		  if(window.confirm('「読みたい本」に追加しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function add_now(){
		  if(window.confirm('「読んでる本」に追加しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function add_tun(){
		  if(window.confirm('「積読本」に追加しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function readd(){
		  if(window.confirm('「最近再読した本」に追加しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function del_res(){
		  if(window.confirm('本当に削除しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function del_pre(){
		  if(window.confirm('「読みたい本」から削除しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function del_now(){
		  if(window.confirm('「読んでる本」から削除しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function del_tun(){
		  if(window.confirm('「積読本」から削除しますか？')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function del_log(){
		  if(window.confirm('ログを削除しますか？\r\n\r\n注意）ログを削除しても実際に登録した情報は削除されません。')){
		  return true;
		  }else{
		  return false;
		  }
		}
		  function res_midoku(){}
		  function res_open(no,uid){
		  var res_no = document.getElementById("res_"+no);
		  if(res_no.style.display == "block"){
		  res_no.style.display = "none";
		  }else{
		  res_no.style.display = "block";
		  if(uid){
		  sendRequest(res_midoku,'&book_no='+no+'&id='+uid+'&type=midoku','POST','/action/home.php',true,true)
		  }
		  }
		}
		  function image_update_res(oj){
		  var res = decodeURIComponent(oj.responseText);
		  var res2 = res.split(",");
		  var image = res2[0];
		  var page = res2[1];
		  var title = res2[2];
		  var author = res2[3];
		  var now_image = document.getElementById("book_image").src;
		  var now_page = document.getElementById("book_pages").innerHTML;
		  var now_title = document.getElementById("title").innerHTML;
		  var now_author = document.getElementById("author_name").innerHTML;
		  if(image == now_image){
		  var image = "nothing";
		  }
		  if(page+"ページ" == now_page){
		  var page = "nothing";
		  }
		  if(title == now_title){
		  var title = "nothing";
		  }
		  if(author == now_author){
		  var author = "nothing";
		  }
		  if(image == "nothing" && page == "nothing" && title == "nothing" && author == "nothing"){
		  document.getElementById("image_update_link").innerHTML = "更新データはありません";
		  }else{
		   if(image != "nothing"){
		   document.getElementById("book_image").src = image;
		   }
		   if(page != "nothing"){
		   document.getElementById("book_pages").innerHTML = page+"ページ";
		   }
		   if(title != "nothing"){
		   document.getElementById("title").innerHTML = title;
		   }
		   if(author != "nothing"){
		   document.getElementById("author_name").innerHTML = author;
		   }
		  document.getElementById("image_update_link").innerHTML = "データを更新しました！";
		  }
		}
		  function image_update(asin){
		  document.getElementById("image_update_link").innerHTML = "<img src='http://img.bookmeter.com/image/ajax-loader.gif'>";
		  sendRequest(image_update_res,'&asin='+asin,'POST','/action/image_update.php',true,true)
		}
		  function image_update2(asin){
		  sendRequest(image_update_res2,'&asin='+asin,'POST','/action/image_update.php',true,true)
		}
		  function image_update_res2(){
		}
		
		  function nice_res(oj){
		  var res = decodeURIComponent(oj.responseText);
		  var res = res.split("-");
		  if(res[0] == 'error'){
		  		alert(res[2]);
			  var book_no = res[1];
			  document.getElementById("nice_star_list_"+book_no).innerHTML = '';
			  document.getElementById("nice_"+book_no).innerHTML = '';
		  }else{
			  var star_list = res[0];
			  var book_no = res[1];
			  document.getElementById("nice_star_list_"+book_no).innerHTML = star_list;
		  }
		}
		  function nice(no,uid,buid,asin,res_type){
		  sendRequest(nice_res,'&book_no='+no+'&user_id='+uid+'&book_user_id='+buid+'&asin='+asin+'&res_type='+res_type+'&type=nice','POST','/action/nice.php',true,true)
		  var nice = "nice_"+no;
		  document.getElementById(nice).innerHTML = "<a href='javascript:kaijo("+no+","+uid+","+buid+",\""+asin+"\");'><img src='http://img.bookmeter.com/image/nice_del.gif' alt='解除' class='nice_button'></a>";
		  document.getElementById("nice_star_list_"+no).innerHTML = "<img src='http://img.bookmeter.com/image/loader_orange.gif' alt='解除' width='12px' height='12px'>";
		  twitter_post_nice(no,uid,buid);
		}
		  function kaijo(no,uid,buid,asin,res_type){
		  sendRequest(nice_res,'&book_no='+no+'&user_id='+uid+'&book_user_id='+buid+'&res_type='+res_type+'&type=kaijo','POST','/action/nice.php',true,true)
		  var nice = "nice_"+no;
		  document.getElementById(nice).innerHTML = "<a href='javascript:nice("+no+","+uid+","+buid+",\""+asin+"\");'><img src='http://img.bookmeter.com/image/nice_add.gif' alt='ナイス！' class='nice_button'></a>";
		  document.getElementById("nice_star_list_"+no).innerHTML = "<img src='http://img.bookmeter.com/image/loader_orange.gif' alt='ナイス！' width='12px' height='12px'>";
		}
		  function star_add_user_res(oj){
		  var res = decodeURIComponent(oj.responseText);
		  var res = res.split(",");
		  var id = res[0];
		  var user_info = res[1];
		  document.getElementById("star_add_user_"+id).innerHTML = user_info;
		  document.getElementById("star_add_user_"+id).style.display = "block";
		}
		  function star_add_user_open(no,user_id){
		  var user_info = document.getElementById("star_add_user_"+no+"_"+user_id).innerHTML;
		  if(user_info){
		  document.getElementById("star_add_user_"+no+"_"+user_id).style.display = "block";
		  }else{
		  sendRequest(star_add_user_res,'&book_no='+no+'&user_id='+user_id+'&type=open','POST','/action/star_add_user.php',true,true)
		  }
		}
		  function star_add_user_close(no,user_id){
		  document.getElementById("star_add_user_"+no+"_"+user_id).style.display = "none";
		}
		  function fumei_ch(){
		  var a = document.getElementById("read_date_y").disabled;
		  if(a == true){
		  document.getElementById("read_date_y").disabled = false;
		  document.getElementById("read_date_m").disabled = false;
		  document.getElementById("read_date_d").disabled = false;
		  }else if(a == false){
		  document.getElementById("read_date_y").disabled = true;
		  document.getElementById("read_date_m").disabled = true;
		  document.getElementById("read_date_d").disabled = true;
		  }
		}
		  function twitter_post_nice(no,uid,buid,nice_type){
		  sendRequest(twitter_post_nice_res,'&book_no='+no+'&user_id='+uid+'&book_user_id='+buid+'&nice_type='+nice_type,'POST','/action/twitter_post_nice.php',true,true);
		}
		  function twitter_post_nice_res(){
		}
		  function ShowLength(str,id,limit) {
		  if(!limit){
		  	limit = 255;
		  }
		  var nokori = limit - str.length;
		  document.getElementById("inputcommentlength_"+id).innerHTML = "あと" + nokori + "文字";
		}
		
		
		function netabare(type){
			if(type == 'off'){
				var change_color = '#444444';
				var change_bg = '#ebf2cc';
				var change_border = '#cbea98';
				var change_type = '';	
				var change_text = 'オン';			
			}else{
				var change_color = '#f9f9f9';
				var change_bg = '#7BC331';
				var change_border = '#72BE1F';
				var change_type = 'off';
				var change_text = 'オフ';		
			}
			
			for(var i = 0; true;i ++) {
				var element = document.getElementById('review_text_'+i);
				if(!element) {break}
				element.style.color = change_color;
			}
			document.getElementById('netabare_button_area').innerHTML = '<input type="button" value="ネタばれ防止'+change_text+'" class="submit" style="background:'+change_bg+';border-color:'+change_border+';" onclick="netabare(\''+change_type+'\')" />';
		}
		
		function delete_log(id,type){
			id2 = id;
			if(type == 13){
				confirm_text = 'つぶやきを削除しますか？';
			}else{
				confirm_text = 'ログを削除しますか？\r\n\r\n注意）ログを削除しても実際に登録した情報は削除されません。';
			}
			if(window.confirm(confirm_text)){
    		$('#log_list_box_'+id2).slideUp();
			sendRequest(delete_log_res,'&id='+id,'POST','/action/del_log.php',true,true);
			}
		}
		function delete_log_res(oj){
			var res = oj.responseText;
			if(res == 'error'){
				alert('エラーが発生しました。')
			}else{
    			//$('#log_list_box_'+id2).slideUp();
			}
		}
		
		function nice_status(id,tuid,type){
			var data = [];
			data['status_id'] = id;
			data['to_user_id'] = tuid;
			data['type'] = type;
			id2 = id;
			
			sendRequest(nice_status_res,data,'POST','/action/nice_status.php',true,true)
			var nice_status = "nice_status_"+id;
			if(type=='add'){
				document.getElementById(nice_status).innerHTML = "<a href='javascript:nice_status("+id+","+tuid+",\"del\");'><img src='http://img.bookmeter.com/image/nice_del.gif' alt='解除' class='nice_button'><span>解除</span></a>";
				twitter_post_nice(id,null,tuid,'status');
			}else{
				document.getElementById(nice_status).innerHTML = "<a href='javascript:nice_status("+id+","+tuid+",\"add\");'><img src='http://img.bookmeter.com/image/nice_add.gif' alt='ナイス！' class='nice_button'><span>ナイス!</span></a>";
			}
			now_nice_list = document.getElementById("nice_status_star_user_list_"+id).innerHTML;
			document.getElementById("nice_status_star_user_list_"+id).innerHTML = "<img src='http://img.bookmeter.com/image/loader_green2.gif' alt='解除' style=\"-webkit-box-shadow: none !important;-moz-box-shadow: none !important;box-shadow: none !important;margin:5px;\">";
		}
		
		function nice_status_res(oj){
			var res = oj.responseText;
			if(res){
	            var json = eval('(' + res + ')');
				$('#nice_status_star_user_list_'+id2).html(now_nice_list);
				if(json.type == 'add'){
					var add_nice_user = '<div class="nice_star_user" id="nice_star_user_'+id2+'_'+json.u+'"><a href="/u/'+json.u+'"><img src="'+json.u_user_image+'"></a></div>';
					$('#nice_status_star_user_list_'+id2).prepend(add_nice_user);
				}else{
					$('#nice_star_user_'+id2+'_'+json.u).remove();
				}
				if(json.nice_cnt > 0 ){
				$('#nice_cnt_'+id2).html(json.nice_cnt+'ナイス');
				}else{
				$('#nice_cnt_'+id2).html('');
				}
			}
		}
		
		function nice_response(no,tuid,type,target){
			var data = [];
			data['res_no'] = no;
			data['to_user_id'] = tuid;
			data['type'] = type;
			data['target'] = target;
			no2 = no;
			
			sendRequest(nice_response_res,data,'POST','/action/nice_res.php',true,true)
			var nice_res = "nice_res_"+no;
			if(type=='add'){
				document.getElementById(nice_res).innerHTML = "<a href='javascript:nice_response("+no+","+tuid+",\"del\",\""+target+"\");'><img src='http://img.bookmeter.com/image/nice_del.gif' alt='解除' class='nice_button'><span>解除</span></a>";
				twitter_post_nice(no,null,tuid,'res');
			}else{
				document.getElementById(nice_res).innerHTML = "<a href='javascript:nice_response("+no+","+tuid+",\"add\",\""+target+"\");'><img src='http://img.bookmeter.com/image/nice_add.gif' alt='ナイス！' class='nice_button'><span>ナイス!</span></a>";
			}
			now_nice_list = document.getElementById("nice_res_star_user_list_"+no).innerHTML;
			document.getElementById("nice_res_star_user_list_"+no).innerHTML = "<img src='http://img.bookmeter.com/image/loader_green2.gif' alt='解除' style=\"-webkit-box-shadow: none !important;-moz-box-shadow: none !important;box-shadow: none !important;margin:5px;\">";
		}
		
		function nice_response_res(oj){
			var res = oj.responseText;
			if(res){
	            var json = eval('(' + res + ')');
				$('#nice_res_star_user_list_'+no2).html(now_nice_list);
				if(json.type == 'add'){
					var add_nice_user = '<div class="nice_res_star_user" id="nice_res_star_user_'+no2+'_'+json.u+'"><a href="/u/'+json.u+'"><img src="'+json.u_user_image+'"></a></div>';
					$('#nice_res_star_user_list_'+no2).prepend(add_nice_user);
				}else{
					$('#nice_res_star_user_'+no2+'_'+json.u).remove();
				}
				if(json.nice_cnt > 0 ){
				$('#nice_res_cnt_'+no2).html(json.nice_cnt+'ナイス');
				}else{
				$('#nice_res_cnt_'+no2).html('');
				}
			}
		}
		
		function del_history_view_book(asin){
			document.getElementById('history_view_book_'+asin).style.display = "none";
			sendRequest(del_history_view_book_res,'&asin='+asin,'POST','/action/del_history_view_book.php',true,true);
		}
		function del_history_view_book_res(){
		}
		
		function quick_add_book(t,asin,b) {
			type = t;
			button_area = b;
			button_area_text = button_area.innerHTML;
			b.innerHTML = '<img src="http://img.bookmeter.com/image/loader_facebook.gif" alt="Loading...">';
			if(type){
				add_del_type = 'add';
				if(type == 'now'){
					type_text = '読んでる本に追加';
					if(button_area_text == type_text){
						change_text = '読んでる本から削除';
					}else{
						change_text = '読んでる本に追加';
						type = 'del_now'
						add_del_type = 'del';
					}
				}else if(type == 'pre'){
					type_text = '読みたい本に追加';
					if(button_area_text == type_text){
						change_text = '読みたい本から削除';
					}else{
						change_text = '読みたい本に追加';
						type = 'del_pre'
						add_del_type = 'del';
					}
				}else if(type == 'tun'){
					type_text = '積読本に追加';
					if(button_area_text == type_text){
						change_text = '積読本から削除';
					}else{
						change_text = '積読本に追加';
						type = 'del_tun'
						add_del_type = 'del';
					}
				}					
				add_asin = asin;
	     		var data_array = [];
	     		data_array['asin'] = add_asin;
	     		data_array['type'] = type;
	     		data_array['from_dialog'] = 1;
				sendRequest(quick_add_book_res,data_array,'GET','/add.php',true,true);
			}
		}
		function quick_add_book_res(oj){
			if(add_del_type == 'del'){
				button_area.style.color = 'green';
				button_area.style.backgroundColor = '#ffac8f';
			}else{
				button_area.style.color = '#bebebe';
				button_area.style.backgroundColor = '#ff815b';
			}
			button_area.innerHTML = change_text;
		}
		function update_page_open(t){
			var page = t.innerHTML;
			var asin = t.id;
			var form_name = 'update_page_form_'+asin;
			t.onclick = new Function();
			t.innerHTML = '<form name="'+form_name+'"><input type="text" name="page" size="4" value="'+page+'" onkeydown="update_page(event,this)"></form>';
			alert(2)
			alert(document.form_name);
			alert(1)
		}
		function update_page(e,t){
			var kc = e.keyCode;
			if(kc == 13){
			
			}
			
		}
		
		var book_status_first_loading;
		function get_book_status(asin,p){
			book_status_first_loading = true;
     		var data_array = [];
     		data_array['asin'] = asin;
     		data_array['p'] = p;
     		p2 = p;
     		asin2 = asin;
			$("#more_button").remove();
			$("#book_status_list").append('<div id="more_loading" align="center"><img src="http://img.bookmeter.com/image/loader_green2.gif" style="margin:15px 0 22px 0;"></div>');
			sendRequest(get_book_status_res,data_array,'POST','/action/get_book_status.php',true,true);
		}
		function get_book_status_res(oj){
			res = decodeURIComponent(oj.responseText);
			read_res();
		}
		function read_res(){
			if(res && res != 'undefined'){	
				$("#book_status_list").append(res);
				$("#more_loading").remove();
			}else{
				$("#more_loading").remove();
			}	
			if(p2 > 1){
				var analytics_path = '?review_type=status&p='+p2;
			}else{
				var analytics_path = '?review_type=status';
			}
			_gaq.push(
			 ['_setAccount', 'UA-2272188-10'],
			 ['_trackPageview', '/b/'+asin2+analytics_path]
			)
		}
		function open_book_status(asin){
			document.getElementById('book_review_list').style.display = 'none';
			document.getElementById('book_status_area').style.display = 'block';
			if(book_status_first_loading != true){
				get_book_status(asin,1);
			}
		}
		function open_book_review(){
			document.getElementById('book_status_area').style.display = 'none';
			document.getElementById('book_review_list').style.display = 'block';
		}
