Pull image URL from gallery (ID = 1) created in NextGEN wordpress plugin [1], randomize & use as fullscreen background with jquery backstretch plugin [2]
$(document).ready(function() {
var bg = [
<?php
global $nggdb;
$gallery = $nggdb->get_gallery(1, 'sortorder', 'ASC', true, 0, 0);
foreach($gallery as $image) {
echo '"'.$image->imageURL.'",';
}
?>
];
var rdm = Math.floor(bg.length * Math.random());
$.backstretch( bg[rdm] );
});