rendered paste body/**
* After the document has finished loading
*/
$(document).ready(function() {
loadBlock('/mothersclick.com/front/qa', '#front-qa');
loadBlock('/mothersclick.com/front/group', '#front-group');
});
function loadBlock(path, id) {
$.getJSON(path, function(json) {
qa = json;
var newIndex;
var lastIndex;
interval = Math.floor(Math.random() * 2000 + 2000);
setInterval(function() {
do {
newIndex = Math.floor(Math.random() * qa.length);
}
while (newIndex == lastIndex);
$(id +' li:last').hide('slow', function(){
$(this).remove();
});
$(qa[newIndex]).hide().prependTo(id).show('slow');
lastIndex = newIndex;
}, interval);
});
}