$('input[type=text]:not(.typetext)').addClass('typetext');
$('input[type=password]:not(.typetext)').addClass('typetext').addClass('typepassword');
$('input[type=checkbox]:not(.typecheckbox)').addClass('typecheckbox');
$('input[type=radio]:not(.typeradio)').addClass('typeradio');

$('input[type=submit], input[type=button], button').each(function(index, Element){
	var title = $(this).val();
	var form = $(this).get(0).form;
	var button = $().add('<a>')
		.addClass('sn-button').addClass($(this).attr('class'))
		.attr('href', './')
		.html('<span>'+title+'</span>');
	if($(this).attr('type')=='submit') button.click(function(){
			if(form) form.submit();
			return false;
			});
	else button.click($(this).get(0).onclick);
	$(this).replaceWith(button);
	});

if($('.tabs').length>0){
	$('.tabs .tab').hide(); // Hide all tab divs
	$('.tabs .tab:first').show(); // Show the first div
	$('.tabs ul li:first').addClass('active'); // Set the class for active state
	$('.tabs ul li a').click(function(){ // When link is clicked
		$('.tabs ul li').removeClass('active'); // Remove active class from links
		$(this).parent().addClass('active'); //Set parent of clicked link class to active
		var currentTab = $(this).attr('href'); // Set currentTab to value of href attribute
		$(currentTab).fadeIn(); // Show div with id equal to variable currentTab
		$('.tabs .tab:not('+currentTab+')').hide(); // Hide all tab divs
		return false;
		});
	};
