
var xmlhttp1 = false;
// except IE
if(window.XMLHttpRequest) {
  xmlhttp1 = new XMLHttpRequest();
// IE
} else if(window.ActiveXObject) {
  try {
    xmlhttp1 = new ActiveXObject("Msxml2.XMLHTTP");
  } catch(e) {
    xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  }
}



function Getkuchikomi(p,maxp,goods,count_board) {
	
	var count_no = count_board/maxp;
	var count_no = Math.ceil(count_no);
	var id1 = "k_mbody";
	var id2 = "k_header_right";
	var dofile1 = "/common/kuchi.php?page=";
	dofile1+= p;
	dofile1+= "&max=";
	dofile1+= maxp;
	dofile1+= "&goods=";
	dofile1+= goods;
	
	if(p == 1){
  	document.getElementById(id2).innerHTML = '<img src="../img/other/move_left.gif" width="25" height="13" alt="前" />';
	}
	else {
		var page_a = p;
		--page_a;
		var lb = "<a href=\"javascript:Getkuchikomi('";
		lb+= page_a;
		lb+="','";
		lb+= maxp;
		lb+="','";
		lb+= goods;
		lb+="','";
		lb+= count_board;
		lb+="');\"><img src=\"../img/other/move_left_a.gif\" width=\"25\" height=\"13\" alt=\"前\" /></a>";
		document.getElementById(id2).innerHTML = lb;
	}

		document.getElementById(id2).innerHTML+= "&nbsp;&nbsp;";
		document.getElementById(id2).innerHTML+= p;
		document.getElementById(id2).innerHTML+= "/";
		document.getElementById(id2).innerHTML+= count_no;
		document.getElementById(id2).innerHTML+= "&nbsp;&nbsp;";

	if(p == count_no){
  	document.getElementById(id2).innerHTML+= '<img src="../img/other/move_right.gif" width="25" height="13" alt="次" />';
	}
	else {
		var page_b = p;
		++page_b;
		var rb = "<a href=\"javascript:Getkuchikomi('";
		rb+= page_b;
		rb+="','";
		rb+= maxp;
		rb+="','";
		rb+= goods;
		rb+="','";
		rb+= count_board;
		rb+="');\"><img src=\"../img/other/move_right_a.gif\" width=\"25\" height=\"13\" alt=\"次\" /></a>";
		document.getElementById(id2).innerHTML+= rb;
	}



//	document.write(dofile1);
	
  if (!xmlhttp1) return;
  document.getElementById(id1).innerHTML = '<img src="/common/loading.gif" />';
  xmlhttp1.open('get', dofile1, true);
  xmlhttp1.onreadystatechange=function() {
    if (xmlhttp1.readyState==4 && xmlhttp1.status == 200) {
//			document.write(xmlhttp1.responseText);
      document.getElementById(id1).innerHTML = xmlhttp1.responseText;
    }
  }
  xmlhttp1.send(null)
}


