// apply inline-box only for mozilla
if( jQuery.browser.mozilla ) {
	// do when DOM is ready
	$( function() {
		// search form, hide it, search labels to modify, filter classes nocmx and error
		$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
			var $this = $(this);
			var labelContent = $this.html();
			var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
			// create block element with width of label
			var labelSpan = $("<span>")
				.css("display", "block")
				.width(labelWidth)
				.html(labelContent);
			// change display to mozilla specific inline-box
			$this.css("display", "-moz-inline-box")
				// remove children
				.empty()
				// add span element
				.append(labelSpan);
		// show form again
		}).end().show();
	});
};


$(function(){
	// Accordion
//	$("#accordion").accordion({ header: "h3" });
	// Tabs
//	$('#tabs').tabs();
	
	
	// Dialog			
	$('#dialog1').dialog({
		bgiframe: true,
		autoOpen: false,
		width: 600,
		modal: true,
		buttons: {
			"close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
	// Dialog			
	$('#dialog2').dialog({
		autoOpen: false,
		width: 600,
		modal: true,
		buttons: {
			"close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
		// Dialog			
	$('#dialog3').dialog({
		autoOpen: false,
		width: 600,
		modal: true,
		buttons: {
			"close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});	
		// Dialog			
	$('#dialog4').dialog({
		autoOpen: false,
		width: 600,
		modal: true,
		buttons: {
			"close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
			// Dialog			
	$('#dialog5').dialog({
		autoOpen: false,
		width: 600,
		modal: true,
		buttons: {
			"close": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
	// Dialog Link
	$('#dialog_link1').click(function(){
		$('#dialog1').dialog('open');
		return false;
	});
	// Dialog Link
	$('#dialog_link2').click(function(){
		$('#dialog2').dialog('open');
		return false;
	});
	// Dialog Link
	$('#dialog_link3').click(function(){
		$('#dialog3').dialog('open');
		return false;
	});
	// Dialog Link
	$('#dialog_link4').click(function(){
		$('#dialog4').dialog('open');
		return false;
	});	
		// Dialog Link
	$('#dialog_link5').click(function(){
		$('#dialog5').dialog('open');
		return false;
	});	
	/*
	// Datepicker
	$('#datepicker').datepicker({
		inline: true
	});
	// Slider
	$('#slider').slider({
		range: true,
		values: [17, 67]
	});
	// Progressbar
	$("#progressbar").progressbar({
		value: 20 
	});
	//hover states on the static widgets
	$('#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); }, 
		function() { $(this).removeClass('ui-state-hover'); }
	);
	*/
});