
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2011 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
*
* $DateTime: $
*
* Adobe Output Module 4.0
*
* MediaGallery Originally Written by Quality Process Incorporated, Enhanced by
* Adobe Systems China. Contact Sheet written by Adobe Systems China.
* 
*
**************************************************************************/

AOM.CustomRadioButton = function(radioButton) {
	this.initialize(radioButton);
}

AOM.CustomRadioButton.prototype.initialize = function(radioButton) {
	if (radioButton == undefined)  {
		return false;
	}

	//add mouse event listener
    radioButton.addEventListener ('mousedown', AOM.CustomRadioButton.doDown, false);
     
    // Change the text width
    if (radioButton.text != undefined)
    {
        var agfx = radioButton.graphics;
        var textSize = agfx.measureString(radioButton.text,  agfx.font);
        radioButton.preferredSize.width = textSize.width + AOM.BOX_WIDTH + AOM.BOX_SPACE;
    }
    
	return true;
}

AOM.CustomRadioButton.doDown = function(event) {
     var radioButton = event.target;
     if (!radioButton.enabled) return;
     if (radioButton.value == true) return;
     
     if(radioButton.value == undefined || radioButton.value == false)
		radioButton.value = true;
        
     radioButton.onMouseDown();
}

