micscr, многовато как-то всего. Проще так:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Wrap test</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 0.18.1.1" />
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(function(){
var i = 0,
perpage = 3,
items = $('.item span').get();
while (items.length) {
$(items.splice(0, perpage)).wrapAll('<div class=item-' + ++i + '></div>');
}
});
</script>
<style type="text/css">
span {
width:100px;
height:100px;
margin:5px;
border:3px double #369;
}
div {
border:3px solid #369;
padding: 5px;
}
</style>
</head>
<body>
<div class='item'>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>10</span>
<span>11</span>
<span>12</span>
<span>13</span>
</div>
</body>
</html>