void vmsDomHelper::GetElementParam(IHTMLElement *pElem, LPCWSTR pwszName, wstring &wstrResult)
{
	getElementAttribute (pElem, pwszName, wstrResult);
	if (!wstrResult.empty ())
		return;

	IDispatchPtr spDisp;
	pElem->get_children (&spDisp);

	IHTMLElementCollectionPtr spElems (spDisp);

	if (spElems != NULL)
	{
		long cElems = 0;
		spElems->get_length (&cElems);

		for (long i = 0; i < cElems; i++)
		{
			IDispatchPtr spDisp;
			spElems->item (CComVariant (i), CComVariant (i), &spDisp);
			IHTMLElementPtr spChildElem (spDisp);
			if (spChildElem == NULL)
				continue;
			wstring wstrName;
			getElementAttribute (spChildElem, L"name", wstrName);
			if (wcsicmp (wstrName.c_str (), pwszName) == 0)
			{
				getElementAttribute (spChildElem, L"value", wstrResult);
				break;
			}
		}
	}

	if (!wstrResult.empty ())
		return;

	IHTMLElementPtr spParentElem;
	pElem->get_parentElement (&spParentElem);

	if (spParentElem != NULL)
		GetElementParam (spParentElem, pwszName, wstrResult);
}
void Theme::updateTheme( Fl_Browser *o,
					Fl_Box * button,
					Fl_Box * button_icon,
					Fl_Box *tray,
					Fl_Box *activeW,
					Fl_Box *activeW2,
					Fl_Box *activeW_text,
					Fl_Box *inactiveW,
					Fl_Box *inactiveW2,
					Fl_Box *inactiveW_text,
					Fl_Box *active_min_button,
					Fl_Box *active_max_button,
					Fl_Box *active_close_button,
					Fl_Box *inactive_min_button,
					Fl_Box *inactive_max_button,
					Fl_Box *inactive_close_button,
					std::string filename,
					bool user){
	debug_out("void updateTheme(..."+filename+"...)");
	if(linuxcommon::test_dir(filename)){
		o->clear();
		populateANYThemes(o,filename,true);
		return;
	}
	const char* notNULL=o->text(o->value());
	if(notNULL!=NULL){
		std::string tempitem=notNULL;
		if(tempitem.compare("..")==0){
			//
			o->clear();
			if(user){populateUserThemes(o);}
			else{populateThemes(o);}
		}
	}
	/** Window buttons */
    std::string maxButton = getButton("ButtonMax",filename);
    std::string minButton = getButton("ButtonMin",filename);
    std::string closeButton = getButton("ButtonClose",filename);
	std::string WindowStyle="WindowStyle";
	std::string TrayStyle="TrayStyle";
	//debug_out("*************************************************\nMin="+minButton+"\nMax="+maxButton+"\nClose="+closeButton+"\n*************************************************\n");
    /**These should never be empty, unless it is NOT a file, or the tags do not exist*/
    if(minButton.compare("")!=0){
        if(!load(filename,false)){return;}
        makeWidgetIcon(minButton,active_min_button,25);
        active_min_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(minButton,inactive_min_button,25);
        inactive_min_button->redraw();
    }
    if(maxButton.compare("")!=0){
		if(!load(filename,false)){return;}
        makeWidgetIcon(maxButton,active_max_button,25);
        active_max_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(maxButton,inactive_max_button,25);
        inactive_max_button->redraw();
    }
    if(closeButton.compare("")!=0){
		if(!load(filename,false)){return;}
        makeWidgetIcon(closeButton,active_close_button,25);
        active_close_button->redraw();
        if(!load(filename,false)){return;}
        makeWidgetIcon(closeButton,inactive_close_button,25);
        inactive_close_button->redraw();
    }
/** Window styles */
    unsigned int active_color2=0;
    unsigned int activeWindowColorText = 0;
    unsigned int activeWindowColor = 0;
    std::string activeWC;
	std::string activeWCT;
	if(!load(filename,false)){return;}
    activeWC = getElementText(WindowStyle,"Active","Background");
    if(activeWC.compare("")==0){
		if(!load(filename,false)){return;}
		activeWC = getElementText(WindowStyle,"Active","Title");
	}
    if(!load(filename,false)){return;}
	activeWCT = getElementText(WindowStyle,"Active","Foreground");
	if(activeWCT.compare("")==0){
		if(!load(filename,false)){return;}
		activeWCT = getElementText(WindowStyle,"Active","Text");
	}
    /** modify the UI if needed */
    if(activeWC.compare("")!=0){
		activeWindowColor = flCOLOR(activeWC,active_color2);
		activeW->color(activeWindowColor);
		activeW2->color(active_color2);
		activeW->redraw();
		activeW2->redraw();
	}
	if(activeWCT.compare("")!=0){
		activeWindowColorText=flCOLOR(activeWCT);
		activeW_text->labelcolor(activeWindowColorText);
		activeW_text->redraw();
	}
    unsigned int inactive_color2=0;
    unsigned int windowColor = 0;
    unsigned int windowColorText = 0;
    if(!load(filename,false)){return;}
    std::string WC=getElementText(WindowStyle,"Background");
    if(WC.compare("")==0){
		if(!load(filename,false)){return;}
		WC=getElementText(WindowStyle,"Title");
	}
    if(!load(filename,false)){return;}
    std::string WCT=getElementText(WindowStyle,"Foreground");
    if(WCT.compare("")==0){
		if(!load(filename,false)){return;}
		WCT=getElementText(WindowStyle,"Text");
	}
    /** modify the UI if needed */
    if(WC.compare("")!=0){
		windowColor=flCOLOR(WC,inactive_color2);
		inactiveW->color(windowColor);
		inactiveW2->color(inactive_color2);
		inactiveW->redraw();
		inactiveW2->redraw();
	}
	if(WCT.compare("")!=0){
		windowColorText = flCOLOR(WCT);
		inactiveW_text->labelcolor(windowColorText);
		inactiveW_text->redraw();
	}
/** Panel */
	if(!load(filename,false)){return;}
    std::string label =getElementAttribute("Tray","TrayButton","label");
    unsigned int panelColor = 0;
    if(!load(filename,false)){return;}
    std::string PC = getElementText(TrayStyle,"Background");
    /** modify the UI if needed */
    if(PC.compare("")!=0){
		panelColor = flCOLOR(PC);
		tray->color(panelColor);
	}
    unsigned int panelColorText = 0;
    if(!load(filename,false)){return;}
    std::string PCT = getElementText(TrayStyle,"Foreground");
    if(PCT.compare("")!=0){
		panelColorText = flCOLOR(PCT);
		tray->labelcolor(panelColorText);
	}
    debug_out("LABEL: "+label+"\npanelColor: "+PC+"\npanelColorText: "+PCT);
	tray->redraw();
    //panel Button */
    unsigned int panelButtonColorText=panelColorText;
    unsigned int panelButtonColor=panelColor;
    
    /** New version */
    if(themeNewStyle(filename)<1){
		if(!load(filename,false)){return;}
		std::string tmp=getElementText("TrayButtonStyle","Background");
		if(tmp.compare("")!=0)
			panelButtonColor = flCOLOR(tmp);
		if(!load(filename,false)){return;}
		tmp = getElementText("TrayButtonStyle","Foreground");
		if(tmp.compare("")!=0)
			panelButtonColorText = flCOLOR(tmp);
    }/**END Dont do this IF new version*/
    else{
        panelButtonColor=panelColor;
        panelButtonColorText = panelColorText;
    }
    if(label.compare("")!=0)
		button->copy_label(label.c_str());
	
    button->color(panelButtonColor);
    button->labelcolor(panelButtonColorText);
    button_icon->color(panelButtonColor);
    if(!load(filename,false)){return;}
    std::string icon_file = getPanelButtonIcon();
    makeWidgetIcon(icon_file,button_icon,30);
    button->redraw();
    button_icon->redraw();
}