/* 
 This file was generated by Dashcode and is covered by the 
 license.txt included in the project.  You may edit this file, 
 however it is recommended to first turn off the Dashcode 
 code generator otherwise the changes will be lost.
 */

// Note: Properties and methods beginning with underbar ("_") are considered private and subject to change in future Dashcode releases.


function CreateActivityIndicator(elementOrID, spec)
{
    var indicatorElement = elementOrID;
    if (elementOrID.nodeType != Node.ELEMENT_NODE) {
        indicatorElement = document.getElementById(elementOrID);
    }

	if (indicatorElement && !indicatorElement.loaded) {
		indicatorElement.loaded = true;
		indicatorElement.object = new ActivityIndicator(indicatorElement, spec);
		
		return indicatorElement.object;
	}
}

function ActivityIndicator(element, spec) {
	this.element = element;
    
    // set the animation CSS properties
    element.style.webkitAnimationName = 'dashcode-activity-indicator';
    element.style.webkitAnimationDuration = "1s";
    element.style.webkitAnimationIterationCount = "infinite";
    element.style.webkitAnimationTimingFunction = "linear";
    element.style.webkitAnimationPlayState = "paused";
    
    if (!dashcode.inDesign) {
        this.startAnimation();
    }
}

ActivityIndicator.prototype.startAnimation = function() {
    this.element.style.webkitAnimationPlayState = "running";
}

ActivityIndicator.prototype.stopAnimation = function() {
    this.element.style.webkitAnimationPlayState = "paused";
}

