//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}

$(function(){
    $images = $('#collectionImages li').hide();
    var isset = function(x, y){
        for(j in x){
            if(x[j] == y) return true;
        }
        return false;
    }
    
    var randoms = new Array();
    var newrand;
    var i = 0;
    
    if($images.length){
        do{
            newrand = Math.floor(Math.random() * $images.length);
            if(!isset(randoms, newrand)) randoms[i++] = newrand;
        } while(randoms.length < 6);

        for(r in randoms){
            $images.eq(randoms[r]).appendTo($images.parent()).show();
        }
    }
});
