var ball;

function initialize() {
	ball = document.getElementById("ball");
	ball.speed_x = 5;
	ball.speed_y = 3;
	
	YAHOO.util.Event.onDOMReady(function() {
		dd = new YAHOO.util.DD("business_card_hu");
		dd = new YAHOO.util.DD("business_card_en");
	});

	move_ball();
}

function move_ball() {
	var current_x = parseInt(ball.style.left.replace(/[^\-0-9]/g,''));
	var current_y = parseInt(ball.style.top.replace(/[^\-0-9]/g,''));
	var ball_width = parseInt(ball.style.width.replace(/[^\-0-9]/g,''));
	var ball_height = parseInt(ball.style.height.replace(/[^\-0-9]/g,''));
//	alert(ball.style.left + ", " + current_x);
	current_x += ball.speed_x;
	current_y += ball.speed_y;
	
	if ((((current_x + ball_width) > innerWidth) && (ball.speed_x > 0)) || ((current_x < 0) && (ball.speed_x < 0))) {
		current_x -= ball.speed_x;
		ball.speed_x = -ball.speed_x;
	}
	
	if ((((current_y + ball_height) > innerHeight) && (ball.speed_y > 0)) || ((current_y < 0) && (ball.speed_y < 0))) {
		current_y -= ball.speed_y;
		ball.speed_y = -ball.speed_y;
	}
	
	ball.style.left = current_x + 'px';
	ball.style.top = current_y + 'px';
	
	
	setTimeout('move_ball()', 30);
}

