global proc int xraySkinExportOptions( string $parent,
								   string $action,
								   string $initialSettings,
								   string $resultCallback )
{
	int		$bResult;
	string	$currentOptions;
	string	$optionList[];
	string	$optionBreakDown[];
	int		$index;

	if ($action == "post") {
		setParent $parent;

		setUITemplate -pushTemplate DefaultTemplate;

		formLayout -e -vis false optionsBoxForm;

		columnLayout -adj true objTypeCol;

			frameLayout
				-cll true
				-cl false
				-bv true
				-bs "etchedIn"
				-l "Export Options"
				xrayExportFrame;

				columnLayout -adj true xrayExpOptions;

				rowLayout -nc 2 -cw2 210 200 -rat 1 "top" 0 -cal 1 "left";
					text -al "left" -l "Select skin cluster to export:";
					textScrollList -nr 5 -ams false xrayClusterList;
					string $clusters[] = `ls -typ skinCluster`;
					int $i;
					for ($i = 0; $i < `size($clusters)`; $i++)
					{
						textScrollList -e -append $clusters[$i] xrayClusterList;
					}
				setParent ..;
			setParent ..;
		setParent ..;

		frameLayout
			-cll true
			-cl false
			-bv true
			-bs "etchedIn"
			-l "About"
			xrayAboutFrame;

			columnLayout -adj true;

			text -al "left" -l "Maya -> X-Ray Skin Exporter ver. 1.0";
                				
		// Now set to current settings.
		$currentOptions = $initialSettings;
		if (size($currentOptions) > 0) {
			tokenize($currentOptions, ";", $optionList);
			for ($index = 0; $index < size($optionList); $index++) {
				tokenize($optionList[$index], "=", $optionBreakDown);

				// Frame settings

                if ( $optionBreakDown[0] == "exportFrame") {
                    $intVal = $optionBreakDown[1];
                    if ( $intVal == 1 ) {
                        frameLayout -e -cl true xrayExportFrame;
                    } else {
                        frameLayout -e -cl false xrayExportFrame;
                    }
                }

				if ($optionBreakDown[0] == "SkinCluster") {
					if (`size($optionBreakDown)` > 1) {
						textScrollList -e -si $optionBreakDown[1] xrayClusterList;
					}
			    }
			}
		}
		$result = 1;

		formLayout -e -vis true optionsBoxForm;

		setUITemplate -popTemplate;
	
	} else if ($action == "query") {

		$intVal = `frameLayout -q -cl xrayExportFrame`;
		$currentOptions = $currentOptions + "exportFrame=" + $intVal + ";";

		string $listSelection[] = `textScrollList -q -si xrayClusterList`;
		$currentOptions = $currentOptions + ";SkinCluster=" + $listSelection[0];

		eval($resultCallback+" \""+$currentOptions+"\"");
		$result = 1;
	} else {
		$bResult = 0;
	}
	
	return $bResult;
}
