$.attachAtlas=function(actionId){
	try{
	    var axel = Math.random()+"";
		var a = axel * 10000000000000;
		$('body').append($('<iframe src="http://view.atdmt.com/iaction/'+ actionId + '?'+a+'" width="1" height="1" frameborder="0" scrolling="No" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0"></iframe>'));
		console.log('attachAtlas("'+actionId+'")');
	}catch (e) {}
};

function slide() {
		var nextSlide = $(lastBlock).parents(".panel-outer").next().find(".panel-inner");
		if ($(nextSlide).length == 0) 
		    nextSlide = $("#a1");
  		$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
		$(nextSlide).animate({width: maxWidth+"px"}, { queue:false, duration:400});
		lastBlock = nextSlide;
}

var int = self.setInterval(function(){},10000)

$(document).ready(function() {
    $('#logo A').click(function(){$.attachAtlas('cbnafr_HomepageButton_1');});
	$('DIV.Save > A').click(function() {
		$.attachAtlas('cbnafr_Save2BUTTON_1');
	});
	
	lastBlock = $("#a1");
	maxWidth = 630;
	minWidth = 20;	

	$(".panel-slider .panel-inner").click(
		function(){
			clearInterval(int);
			$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:400 });
			$(this).animate({width: maxWidth+"px"}, { queue:false, duration:400});
			lastBlock = this;
		}
	);
	
});

window.onload = function() {
	int=self.setInterval("slide()",3500);
}
