var scrollint;

function imgscrollup() {
	imgscroll('+');
}
function imgscrolldown() {
	imgscroll('-');
}

function imgscroll(direction, speed) {
	speed = speed || 5;
	$('#imgscroll-imgs').scrollTo(direction+'='+speed+'px');
}

$(document).ready(function(){
	
	$('#imgscroll-imgs a').click(function(){
		if (!$(this).hasClass('current')) {
			$('#imgscroll-imgs .current').removeClass('current');
			$(this).addClass('current');
			var newpath = $(this).attr('href');
			$('#phoneswap img').remove();
			var newimg = $('<img />').attr('src',newpath).appendTo('#phoneswap');
			
			/*
			var oldimg = $('#phoneswap img');
			var newimg = $('<img />').attr('src',newpath).css('opacity',0).appendTo('#phoneswap');
			oldimg.animate({opacity:0.0}, 200, function(){
				$(this).remove();
			});
			newimg.animate({opacity:1.0}, 200);
			*/
			
			var key = $('#imgscroll-imgs a').index(this);
			$('#textswap .active').removeClass('active');
			$('#textswap div:eq('+key+')').addClass('active');
		}
		return false;
	});
	
	$('textswap a').click(function(){
		window.open($(this).attr('href'),'_blank');
		return false;
	});
	
});