
	
	
	var hover = false;
	var moving = false;
	var profileByRow = 1; //number of images to rotate each time
	var profileWidth = 225;
	var cntr = 0;
	var speed = 20;
	var delay = 8000;
	var ads = '';
	var loadedImage = new Array();
	
	$(document).ready(function(){		
		cnt_locations = $('.ads img').size();
		ads = $(".floating_container");		
		$('.ads img').each(function(){	
				cntr++;
				img = $(this).attr("src");
				loadedImage[img] = new Image();
    			loadedImage[img].src = img;				
			if(cntr == cnt_locations){
				setTimeout("slideAds()", delay);		
			}
		});		
		
		$(".profile").hover(function(){
			$(this).find(".user_info, .user_info2").animate({'marginTop': 75, 'height': 50}, 'fast');				
		}, function(){			
			$(this).find(".user_info, .user_info2").animate({'marginTop': 110 , 'height': 15 }, 'fast');
		})	
	});

	function slideAds(){	
		moving = true;
		if(hover) return ;
		var curWidth = parseInt(ads.css("marginLeft").replace("px", ""));
		var newWidth = curWidth - (profileWidth * profileByRow);
		newWidth =  newWidth;
		ads.hide("slow");
		ads.animate({marginLeft: newWidth}, speed, wait);	
		ads.show("slow");
	}
		
	
	function wait(){
		moving = false;		
		ads.css({marginLeft:0});
		ads.find(".profile:lt(" + profileByRow + ")").appendTo(ads);			
		setTimeout("slideAds()",delay);		
	}
		
