// Copyright 2012 Adobe Macromedia Software LLC and its licensors. All rights reserved.

function receiveArguments()
{
	var itemId = arguments[0];
	var dom = dw.getDocumentDOM();
	
	if( !dom )
		return;
	
	switch( itemId )
	{
		case "jQueryAccordion":
			dom.insertObject("jQueryAccordion");
			break;
		case "jQueryTabs":
			dom.insertObject("jQueryTabs");
			break;
		case "jQueryDatepicker":
			dom.insertObject("jQueryDatepicker");
			break;
		case "jQuerySlider":
			dom.insertObject("jQuerySlider");
			break;
		case "jQueryAutocomplete":
			dom.insertObject("jQueryAutocomplete");
			break;
		case "jQueryButton":
			dom.insertObject("jQueryButton");
			break;
		case "jQueryProgressbar":
			dom.insertObject("jQueryProgressbar");
			break;
		case "jQueryDialog":
			dom.insertObject("jQueryDialog");
			break;
		case "jQueryButtonset":
			dom.insertObject("jQueryButtonset");
			break;	
		case "jQueryRadio":
			dom.insertObject("jQueryRadio");
			break;	
		case "jQueryCheckbox":
			dom.insertObject("jQueryCheckbox");
			break;	
	}
}

function canAcceptCommand()
{
	dom = dw.getDocumentDOM();
	
	return (	dw.getActiveWindow(true) != null && 
				dw.getActiveWindow(true).allowsEdits() &&
			 	dom != null && 
				!dom.getIsLibraryDocument() &&
				dom.getParseMode() == 'html' &&
                !(dom.getIsTemplateDocument() && dw.getFocus() == 'browser') && 
                (!dw.getActiveWindow(true).browser || (dw.getActiveWindow(true).browser && !dw.getActiveWindow(true).browser.isLiveEditingInProgress()))
           );

}

