/************************************************************************************/
/* Nineslice Border Styleing 														*/
/*  - Creates: Davide L Rizzo 20/06/2008											*/
/*  - Description: Wraps any element in 9 divs to supply border images via CSS 		*/							
/*  - Usage: Add the class "ninelsice" to an HTML element you wish to style			*/
/*		     add a "ref" attribute to that element and assign to it the class 		*/
/*			 name you wish reference the borders by.								*/
/*			 All borders can the be referenced in CSS 								*/
/*				eg: .classname .topleft { cssvalues } etc...						*/
/************************************************************************************/


//jQuery
$(function(){

	//Nine Slice background effect
	$("fieldset.nineslice").each(function (i) {
		var styleClass = $(this).attr("ref")
		$(this).wrapAll('<div class="'+styleClass+'"><div class="left"><div class="bottom"><div class="right"><div class="top"><div class="topleft"><div class="topright"><div class="bottomleft"><div class="bottomright"></div></div></div></div></div></div></div></div>');
	});
	
	// Legend fix for Safari only
	if( jQuery.browser.safari ) {
		$(".nineslice-form legend").css( "padding-top", "7px" );
	}
	
	// Legend fix for Safari only
	if( jQuery.browser.safari ) {
		$(".nineslice-form-black legend").css( "padding-top", "9px" );
	}
	
});