$(document).ready(function () {
	//alert("d");
	animateImgsInDiv("banner", "animateDiv", "spinner", "span", "noShow");
})

function animateImgsInDiv(loaderDiv, animateDiv, preLoader, imgWrapper, hideClassName){
	var pathArr = new Array();
	var imgArr = new Array();
	var imgs;
	//var result;
	try{

		$("#" + loaderDiv +"  " + imgWrapper).not("." + hideClassName).each(function(){
			pathArr.push($(this).html());
		})
		
		$("#" + loaderDiv + " img").each(function(){
			imgArr.push($(this).attr("src"));
		})
		
		imgs = "[\'" + imgArr.join("\', \'") + "\']";	
		
		//preload the images
		//append to div and cycle
		$("#" + loaderDiv).imageLoader({
		   images: eval(imgs)
		}, function(){
			$("." + preLoader).hide("fast", function(){
				$("#" + animateDiv).append(pathArr.join(" "));
				$("#" + animateDiv).cycle({
					delay:  2000, 
					speed:  500
				});
			});
		});
		//result = 1; //imgArr
	}catch(err){
		console.log(err.description)
	}
	//return result;
}
