var rotation = new Array();
var rotation2 = new Array();
$(document).ready(function(){
	var r = 0;
	var i = 0;
	var scroller = 158;
	var scroll2;
	var times = 0;
	$.ajax({
		type: "GET",
		url: "http://"+window.location.host+"/exhibitorRotation/exhibitors.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('exLink').each(function() {rotation2.push($(this).text())});
			 $(xml).find('exhibitor').each(function(){
				rotation.push($(this).text());
				$('#imgCont').append("<a href="+rotation2[i]+" target='_blank'><img src="+$(this).text()+" border='0' /></a>");
				i++;
			 });
			 $('#imgCont').css({'width' : rotation.length * 300});
			 $("#image").scrollTo({ top:0, left:158}, 800);
			 r = 1;
		}
	});
	
	$(document).everyTime(6000, function(i) {
		if (rotation[r] == undefined){r=0; scroller = 0;}
		scroller += 158;
		scroll2 = scroller+'px';
		$("#image").scrollTo({ top:0, left:scroll2}, 800);
		r++;
	});
});