$(document).ready(function() 
{
	imageSpace();
	$('.tooltext').parent().each (function()
	{	
		$(this).wTooltip({			
			content: $('.tooltext', this).html()}
		);		
	});
});

function imageSpace() 
{
	$('img').each(function ()
	{
		var vspace = $(this).attr('vspace');		
		if(vspace>0)
		{			
			$(this).removeAttr('vspace');
			$(this).css('marginTop', vspace)	
			$(this).css('marginBottom', vspace)
		}
		var hspace = $(this).attr('hspace');
		if(hspace>0)
		{
			$(this).removeAttr('hspace');
			$(this).css('marginLeft', hspace)	
			$(this).css('marginRight', hspace)
		}		
		var align = $(this).attr('align');
		switch (align)
		{
			case 'left':
			case 'right':
				$(this).css('float', align);break;
			case 'absBottom':
				$(this).css('vertical-align', 'bottom');break;
			case 'absMiddle':
				$(this).css('vertical-align', 'middle');break;
			case 'baseline':
				$(this).css('vertical-align', 'baseline');break;
			case 'bottom':		
				$(this).css('vertical-align', 'bottom');break;
			case 'middle':
				$(this).css('vertical-align', 'middle');break;
			case 'textTop':
				$(this).css('vertical-align', 'text-top');break;
			case 'top':		
				$(this).css('vertical-align', 'top');break;
		}				
	}) 	
}