jQuery(document).ready(function($){
	
	if( 'undefined' == typeof(skins) )
		return;
		
	var settings = { fx: { opacity: 'toggle' } };
	$( '#tabs-1' ).tabs(settings);
	
	$('select[name="post-ui-tabs_settings[skin]"]').bind('click', switch_ui_style ).bind('keypress', switch_ui_style );
	
	function switch_ui_style(e) {
		if( 'undefined' == skins[this.selectedIndex+1] )
			return false;
		
		var styletag = $('link#jquery-ui-tabs-css');
		
		if( 'undefined' == styletag )
			return false;
		
		var style = skins.skin_dir + '/' + skins[this.selectedIndex+1] + '/jquery.ui.all.css';
		if( styletag.attr('href') !== style )
			styletag.attr('href', style );
	}
	
});

