/* scroll */
$(document).ready(function() {
 $(".pagetop a").click(function() {
 var targetOffset = $("#wrap").offset().top;
 $("html,body").animate({scrollTop: targetOffset}, 500);
 return false;
 });
}); 

/* window */
$(document).ready(function() {
//target_blank
	$('a[href^="http"]').not('[href*="http://www.antwerp-inc.net/"]').click(function() {
		window.open(this.href, '');
		return false;
	});
	$('a[href^="http"]').not('[href^="http://www.antwerp-inc.net/"]').addClass("exLink");
}); 

/* top image */
$(document).ready(function(){
	$.preload = function(){
		for(var i = 0; i <arguments.length; i++){
			$("<img>").attr("src", arguments[i]);
			console.log( "Preloading: " + arguments[i] );
		}
	}
	$('ul.cycle').each(function() {
		var cycleTimeout = ( $(this).attr('timeout') !== undefined ) ? parseInt($(this).attr('timeout')) * 1000 : 8000
		$(this).cycle({
			fx: 'fade',
			speed: 800,
			// speedIn: 800,
			// speedOut: 1600,
			pause: 0,
			easing: 'linear',
			timeout: cycleTimeout,
			manualTrump: true,
			pager: '.cycle-control'
		});
	});
	var numOfSlides = $('ul.cycle').children().size()*16+10+"px";
	$('.cycle-control').css("width",numOfSlides);//should be number of slides * 16, but for some reason it needs more...
});
