function initWidgets()
{
	initStyledButtons();
}

function initStyledButtons()
{
	$(".stylebutton").each(function(){
		var bDiv=$('<span class="styledButtonContainer"></span>').insertAfter(this);
		$('<span class="styledButtonCapLeft"></span>').appendTo(bDiv);
		$('<span class="styledButtonMain">'+$(this).html()+'</span>').appendTo(bDiv);
		$('<span class="styledButtonCapRight"></span>').appendTo(bDiv);
		if($(this).attr("onclick")) $(bDiv).bind("click",$(this).attr("onclick"));
		
		switch($(this).attr("href"))
		{
			case "submit":
				$(bDiv).bind("click",function(){					
					if($(bDiv).parent().get(0).tagName.toLowerCase()=="form")
					{
						$(bDiv).parent().submit();
					}
					else
					{
						$(bDiv).parentsUntil('form').parent().submit();	
					}					
				})
				break;			
		}
		
		// remove the original thing
				
		$(this).remove();
		
	})	
}

