jQuery.extend({
	random: function(min, max) {
	  return Math.round(min + ((max - min)*(Math.random() % 1)));
	}
	});
function ajaxCars(cnt) {
	$.ajax({url: "randomocc.php", dataType: "html", success: function(html) {
		getCars(html,cnt);
	}
	});	
}
function getCars(html,cnt) {
		$("#randomocc div.cavResultPhoto").remove();
		html = $(html).find("div.cavResultPhoto");
		var randoms = new Array();
		for(var b=0; b < (cnt+1); b++) {
			randoms.push($.random(0,(html.length-1)));
		}
		var total = 0;
		for(var i=0; i < html.length; i++) {
			for(var c=0; c < randoms.length; c++) {
				if(i == randoms[c] && total < cnt) {
					$("#randomocc").append(html[i]);
					total += 1;
				}
			}
		}
		setTimeout(function(){
			$('.cavResultInfo a').fancybox({
				'type'			: 'iframe',
				'width'			: 680,
				'height'		: 600,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade',
				'padding'		: 10,
				'titlePosition'	: 'inside',
				'modal'			: false
			});	
		},100);	
}
