jQuery(document).ready(function() {
	jQueryButtonStyles();
});

function jQueryButtonStyles() {
	jQuery('.button,.buttonsmall').each(function() {
	    if(jQuery(this).is("span") && (jQuery("#" + jQuery(this).find('a').attr('id') + '_button').length == 0 || jQuery(this).find('a').attr('id') == ''))
	    {
		    href  = jQuery(this).find('a').attr('href');
		    elmId  = jQuery(this).find('a').attr('id') + '_button';
		    if(href != null && !href.match(/^javascript:/))
			    href = "window.location='" + href + "';";
		    buttonClass = jQuery(this).attr('class');

		    label = jQuery(this).find('a').text();

		    jQuery('<button type="button" onclick="' + href + '" />').addClass('button ' + buttonClass).attr('title', label).attr('id', elmId).text(label).wrapInner('<span>').wrapInner('<span>').mouseover(function() { jQuery(this).addClass('btn-hover'); }).mouseout(function() { jQuery(this).removeClass('btn-hover'); }).click(function() { jQuery(this).toggleClass('btn-click') }).insertAfter(this);
		    jQuery(this).hide();
        }
	});
}

