jQuery(document).ready(function() {
	
	window.setInterval(logosTimer, 1000); // miliseconds
	//alert(jQuery('.mark_logos').get().length);
	
});

function logosTimer() {
	//var products = jQuery("#productsearchresults").children("li");
	var products = jQuery(".result-set");
	for (var i=0; i < products.length; i++) {
		var listOfLogos = jQuery(products[i]).find(".listOfLogos").children("img");
		var currentLogo = jQuery(products[i]).find(".mark_logo");
		var currentUrl = jQuery(currentLogo).attr("src");
		
		var index = 0;
		for (var j=0; j < listOfLogos.length; j++) {
			if (jQuery(listOfLogos[j]).attr("src") == currentUrl) {
				index = j;
			}
		}
		
		index = index + 1;
		if (index == listOfLogos.length) {
			index = 0;
		}
		
		jQuery(currentLogo).attr("src", jQuery(listOfLogos[index]).attr("src"));
		jQuery(currentLogo).attr("alt", jQuery(listOfLogos[index]).attr("alt"));
	}
}