var o_swiff = null;
var o_container = null;
var o_doggy = null;

// Add the SWF
window.addEvent('domready', function() {
	 o_swiff = new Swiff('/PublishingImages/Flash/dog.swf', {
			container: $('doggy_container')
			,id: 'doggy_replaced'
			,width:290
			,height:365
		});
	
	// The flash object
	o_doggy = $('doggy_replaced');

	// The div container for the flash
	o_container = $('doggy_container');
});

// Add the mouse event listener
document.addEvent('mousemove', function(oEvent) {
	try {
		var o_size = o_container.getSize();
		var o_doc_size = document.getSize();
		var i_w = o_doc_size.x / 3;
		var i_h = o_doc_size.y / 3;
		var i_face_x = Math.floor(oEvent.client.x / i_w);
		var i_face_y = Math.floor(oEvent.client.y / i_h);
		var s_face = i_face_x +"" +i_face_y;
		set_face(s_face);
	}
	catch (oEx) {
		return false;
	}
});

// Callback to flash
function set_face(sFace) {
	try {
		Swiff.remote(o_swiff, 'set_face', sFace);
		return true;
	}
	catch (oEx) {
		return false;
	}
}

