function do_select(obj){
  var obj1=obj.innerHTML;
  document.getElementById("contentersl").innerHTML=obj1;
  //document.getElementById("idsubmenu").style.display="none";  
}
function onlock_none(){
  //document.getElementById("idsubmenu").style.display="block";  
}


function show_box(objid,w,h){
  var obj=document.getElementById(objid);
  var marks=document.getElementById("marks");
  obj.style.display="block";  
  marks.style.display="block"; 

}

function close_box(objid){
  var obj=document.getElementById(objid);
  var marks=document.getElementById("marks");
  obj.style.display="none";
  marks.style.display="none";
}


function change_tab(id,allnums,str1,str2,cname){
  for(i=1;i<=allnums;i++){
	  document.getElementById(str1+i).className="";
	  document.getElementById(str2+i).style.display="none";
  }	
  document.getElementById(str1+id).className=cname;
  document.getElementById(str2+id).style.display="block";
}

function post(){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/test/fajax",
		   data: "name=John&location=Boston",
		   success: function(msg){
		     alert( "Data Saved: " + msg );
		   }
		 });
}

function addBook(uid, isbn, title, author, confirm){
//	alert(uid);
//	alert(isbn);
//	alert(title);
//	alert(author);
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/add",
		   data: "uid="+uid+"&isbn="+isbn+"&book_name="+title+"&book_author="+author+"&confirm="+confirm,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     
		     var conf = json.confirm;
		     
		     if(conf == "1"){
		    	 if(window.confirm(json.msg+"")){
		    		 //alert("确定共享");
		    		 addBook(uid, isbn, title, author, "1");
		    	 }
		     }else {
		    	 alert(json.msg);
		     }
		   }
		 });

	return false;
}

function addBook11(uid, isbn, title, author){
//	alert(uid);
//	alert(isbn);
//	alert(title);
//	alert(author);
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/add",
		   data: "uid="+uid+"&isbn="+isbn+"&book_name="+title+"&book_author="+author,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		   }
			//,error: function() { alert("error");}
		 });

	return false;
}


function requestBook(uid, isbn, title, author){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/request",
		   data: "uid="+uid+"&isbn="+isbn+"&book_name="+title+"&book_author="+author,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		   }
			//,error: function() { alert("error");}
		 });
	
	return false;
}


function cancleRequest(reqId, title){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/cancleRequest",
		   data: "reqId="+reqId+"&book_name="+title,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		     //alert(reqId+"|"+title);
		     //$("#bookdetail_"+reqId).hide();
		     $("#bookstatus_"+reqId).load("http://www.sharebk.com/index.php/book/bookWantedStatus?reqId="+reqId);
		   }
			//,error: function() { alert("error");}
		 });
	
	return false;
}


function gotReqedBook(reqId, title){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/gotReqedBook",
		   data: "reqId="+reqId+"&book_name="+title,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		     //alert(reqId+"|"+title);
		     //$("#bookdetail_"+reqId).hide();
		     $("#bookstatus_"+reqId).load("http://www.sharebk.com/index.php/book/bookWantedStatus?reqId="+reqId);
		   }
			//,error: function() { alert("error");}
		 });
	
	return false;
}

function canShare(bid, uid){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/canShare",
		   data: "bid="+bid+"&uid="+uid,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		     $("#bookstatus_"+bid).load("http://www.sharebk.com/index.php/book/bookSharedStatus?bid="+bid+"&uid="+uid);
		   }
			//,error: function() { alert("error");}
		 });
	
	return false;
}

function hasDelivered(bid, uid){
	$.ajax({
		   type: "POST",
		   url: "http://www.sharebk.com/index.php/book/hasDelivered",
		   data: "bid="+bid+"&uid="+uid,
		   success: function(result){
		     //alert( "add a book: " + result );
		     var json = eval("(" + result + ")");
		     alert(json.msg);
		     $("#bookstatus_"+bid).load("http://www.sharebk.com/index.php/book/bookSharedStatus?bid="+bid+"&uid="+uid);
		   }
			//,error: function() { alert("error");}
		 });
	
	return false;
}



