global proc AEXfrogTransformTemplate( string $nodeName )
{
	editorTemplate -beginScrollLayout;
		
		editorTemplate -beginLayout "Xfrog HD" -collapse false;
				
			//Add the default controls for the Alternates-Handling
			string $newFuncAttrib = "xftAlternateNewAttrib";
			string $replaceFuncAttrib = "xftAlternateReplaceAttrib";
			editorTemplate -callCustom $newFuncAttrib $replaceFuncAttrib "outTranslation";	
								
		editorTemplate -endLayout;
		

		// Create an "Extras" section and also add controls for any
		// attributes we have not explicitly mentioned.
		editorTemplate -addExtraControls;
	editorTemplate -endScrollLayout;

	// Tell the attribute editor not to display the attributes we
	// don't care about.
	editorTemplate -suppress "caching";
	editorTemplate -suppress "nodeState";
}

global proc xftAlternateNewAttrib(string $attr)
{
	xftAlternateReplaceAttrib($attr);
}

global proc xftAlternateReplaceAttrib(string $attr)
{
	$type = `nodeType ($attr)`;
	string $altInput[];
	tokenize($attr, ".", $altInput);
	
	if(!`layout -exists ($type+"_alternate_layout")`) columnLayout ($type+"_alternate_layout");
	
	setParent ($type+"_alternate_layout");
	if(!`layout -exists ($type+"_alternate_line_layout")`) rowLayout -nc 3 ($type+"_alternate_line_layout"); //alternate
	if(!`text -exists ($type+"_alternate_text")`){
		setParent ($type+"_alternate_line_layout");
		text -label ("Connect to offset") ($type+"_alternate_text");
	}
	if(!`intField -exists ($type+"_alternate_offset")`){
		setParent ($type+"_alternate_line_layout");
		intField -ed 1 -min 0 -v 0 ($type+"_alternate_offset");
	}
	if(!`symbolButton -exists ($type+"_alternate_button")`){
			setParent ($type+"_alternate_line_layout");
			symbolButton -i "addy.xpm" -h 20 ($type+"_alternate_button");
	}
	
	setParent ($type+"_alternate_layout");
	if(!`layout -exists ($type+"_alternate_radio2")`){
		radioButtonGrp -numberOfRadioButtons 3 -label "Scale Setting" -ct3 "left" "left" "left" -labelArray3 "Scale" "Growth" "Thickness" -select 1 ($type+"_alternate_radio2");
	}
	
	setParent ($type+"_alternate_layout");
	if(!`layout -exists ($type+"_alternate_line3_layout")`) rowLayout -nc 3 ($type+"_alternate_line3_layout"); //alternate
	if(!`text -exists ($type+"_alternate_fill1")`){
		setParent ($type+"_alternate_line3_layout");
		text -label ("") ($type+"_alternate_fill1");
	}
	if(!`checkBox -exists ($type+"_alternate_radio1")`){
		setParent ($type+"_alternate_line3_layout");
		$actionCommand  = "if(`checkBox -q -v (\"" + $type + "_alternate_radio1\")`){																	\n";
		$actionCommand += "	radioButtonGrp -e -en 1 (\"" + $type + "_alternate_radio2\");																\n";
		$actionCommand += "} else {																														\n";
		$actionCommand += "	radioButtonGrp -e -en 0 (\"" + $type + "_alternate_radio2\");																\n";
		$actionCommand += "}																															";
		checkBox -label "Connect Scale" -cc $actionCommand -v 1 ($type+"_alternate_radio1");
	}
	if(!`text -exists ($type+"_alternate_fill2")`){
		setParent ($type+"_alternate_line3_layout");
		text -label ("") ($type+"_alternate_fill2");
	}
	
	$actionCommand  = "string $sel[]=`ls -selection`;																								\n";
	$actionCommand += "if(`size($sel)`==2 && `nodeType ($sel[0])` == \"transform\"){																\n";
	$actionCommand += " int $connectOffset = `intField -q -v (\"" + $type + "_alternate_offset\")`;													\n";
	$actionCommand += "	connectAttr ($sel[1]+\".outTranslation[\"+$connectOffset+\"]\") ($sel[0]+\".translate\");									\n";
	$actionCommand += "	connectAttr ($sel[1]+\".outRotation[\"+$connectOffset+\"]\") ($sel[0]+\".rotate\");											\n";
	$actionCommand += " if(`checkBox -q -v (\"" + $type + "_alternate_radio1\")`){																	\n";
	$actionCommand += "	 int $connectType = `radioButtonGrp -q -select (\"" + $type + "_alternate_radio2\")`;										\n";
	$actionCommand += "	 if($connectType == 1) connectAttr ($sel[1]+\".outScale[\"+$connectOffset+\"]\") ($sel[0]+\".scale\");						\n";
	$actionCommand += "	 else if($connectType == 2) connectAttr ($sel[1]+\".outGrowthScale[\"+$connectOffset+\"]\") ($sel[0]+\".scale\");			\n";
	$actionCommand += "	 else if($connectType == 3) connectAttr ($sel[1]+\".outThicknessScale[\"+$connectOffset+\"]\") ($sel[0]+\".scale\");		\n";
	$actionCommand += " }																															\n";
	$actionCommand += "}																															";
	symbolButton -e -command $actionCommand ($type+"_alternate_button");
}