<toasteritem locale="english" version="1">
    <app>
        <id>
        aol.activeupdate
        </id>
        <desc>
        %s
        </desc>
    </app>
    <group>
        <id>
        %s
        </id>
        <desc>
        %s
        </desc>    
    </group>
    <subcategory>
        <id>
        %s
        </id>
        <desc>
        %s
        </desc>        
    </subcategory>
    <toasterid>
    %u%s
    </toasterid>
    <packageid version="%s">
    ee://aol/softwareUpdate/ActiveUpdate.zip
    </packageid>
    <type>
    %s
    </type>
    <expiretime>
    %s
    </expiretime>
    <flags>
    %s
    </flags>        
    <listicon>
    </listicon>
    <brandingicon>
    </brandingicon>    
    <brandingtext>
    %s
    </brandingtext>
    <itemdescshort>
    %s
    </itemdescshort>
    <contentwidth>
    %u
    </contentwidth>
    <contentheight>
    %u
    </contentheight>    
    <itemcontent contenttype="html">
    <![CDATA[  
    <html>
	<head>
	<title></title>
	<SCRIPT LANGUAGE="JavaScript">
    
    /* This page filters Updates based on their Importance and Status.
    However, the Importance and Status column values are used as specified in
    TRUpdate.h and TRUpdateTriggerEntry.h files. Incase of any change in these
    values in above said files, this template also would need a change. 
    enum EImportance is used for Type of Update, and enum EUpdateState for Status.
    The actual values are below.    
    enum EUpdateState                       enum EImportance
    {                                       {
        kDeclined = 16,                         kOptional = 0,
        kFailed   = 17,                         kRecommended = 1,
        kDisabled = 18                          kMandatory = 2,
                                                kCritical = 3,
                                                All = 4         // Added here
    }                                       }
    */
    var selectText 	        = "%s";
    var svcMgr              = toaster.serviceManager;
    var kSTICMoniker        = "ee://aol/softwareUpdate/controller";
    var kToasterMoniker = "ee://aol/toaster/controller";
    var kBasicsArrayMoniker = "ee://aol/basics/array";
    var emptyString         = "";

    var enumDeclined = 16;
    var enumFailed   = 17;
    var enumDisabled = 18;
    
    var enumOptional    = 0;
    var enumRecommended = 1;
    var enumMandatory   = 2;
    var enumCritical    = 3;
    var enumAll         = 4;
    var disableControls = false;
          
    function SendSelectedUpdates (optType)
    {
	    this.onClick    = null;
	    var params      = toaster.toasterParams;
	    var toastType   = svcMgr.selectNode (params, "/params/Toastertype").getValue ();
	    var sticToastId = svcMgr.selectNode (params, "/params/toastID").getValue ();
	    var arrayObj    = null;

	    try
	    {
		    arrayObj = svcMgr.createInstance (kBasicsArrayMoniker);
		    var sel = CheckValues (optType);
		    var strSel = "";
		    for (var item in sel)       
		    {
			    strSel = sel[item].value + "\n";
			    if (strSel)
			    arrayObj.addValue (strSel);
		    }		

		    var obj = svcMgr.createInstance (kSTICMoniker);
		    /* STIC_TODO ("The second parameter in the method below should be able to handle more than
		                   just processing the udpates") */
		    obj.onSendRecoveryUpdates (sticToastId, '1', arrayObj);
		    /* We need to take care of closing the toaster now */
		    CloseToast();

	    }
	    catch ( e )
	    {
		    arrayObj = null;
	    }
    }

    function CloseToast ()
    {                  
        var thisToasterId = toaster.toasterId;
        var curToaster    = svcMgr.createInstance (kToasterMoniker);
	    if (curToaster)
        {
            curToaster.destroyToast(emptyString, thisToasterId);
        } 
    }
    
    //Functions that load by Default (window.onload)
    window.onload = function () 
    {
	    UpdateSelected (selectText, enumAll);
        (document.all && !window.print) ? null : ShowDeclined ();
    }

    //Function to show Dropdown for the Combobox
    function ShowMenu (event)
    {
        if (!disableControls)
        {
			var nav= document.getElementById ('nav');
			nav.style.display="block";
	    }
    }

    //Update Text in the Combobox with the Selected Update Type
    function UpdateSelected (identifier, value)
    {
	    var selectedElem = identifier;
	    var obj = document.getElementById ('menutitle');
	    var a = document.createElement ('a');
	    a.href = "#";
	    a.id = "selected";
	    a.value = value;
	    a.onclick = ShowMenu;
	    var txt = document.createTextNode (selectedElem);
	    a.appendChild (txt);
	    obj.innerHTML = "";
	    obj.appendChild (a);
	    var nav= document.getElementById ('nav');
	    nav.style.display = "none";
	    UpdateOption (value);
    }

    // Function to show only Declined Updates
    function ShowDeclined ()
    {
	    document.getElementById ("show").checked = false;
	    if (document.getElementById)
	    {
		    var divTags = document.getElementById ("updates").getElementsByTagName ("div");
		    ShowAltRows ();
		    for (i=0; i<divTags.length; i++)
		    {
			    var newVal = divTags[i].getAttribute ("id").split ("-");
			    if (newVal[1] != enumDeclined)
			    {
				    divTags[i].style.display = "none";
			    }
		    }
		    document.getElementById ("show").value = 0;
		    ShowAltRows ();
	    }
    }

    // Function to show Updates (Failed and Disable) when the Checkbox is clicked
    function ShowCheckbox ()
    {
	    if (document.getElementById)
	    {
	        var selectorDefault = document.getElementById ('selected').value;
		    if (document.getElementById ("show").value == 0)
		    {
			    var divTags = document.getElementById ("updates").getElementsByTagName ("div");
			    for (i=0; i<divTags.length; i++)
			    {
				    divTags[i].style.display = "block";
				    if ((selectorDefault != "") && (selectorDefault != enumAll))
				    {
					    var newVal = divTags[i].getAttribute ("id").split ("-");
					    if (newVal[0] != selectorDefault)
					    {
						    divTags[i].style.display = "none";
					    }
				    }
			    }
			    document.getElementById ("show").value = 1;
		    }
		    else
		    {
			    ShowDeclined ();
		    }
		    ShowAltRows ();
	    }
    }

    //Function to display Updates as per the select option
	function UpdateOption (lcaseVal)
	{
		var updateDivTags = document.getElementById ("updates").getElementsByTagName ("div");
		for (i=0; i<updateDivTags.length; i++)
		{
			updateDivTags[i].style.display = "block";
		}
		if (document.getElementById ("show").value == 0)
		{
			ShowDeclined ();
		}
		if (lcaseVal != enumAll)
		{
			var divTags = document.getElementById ("updates").getElementsByTagName ("div");
			for (i=0; i<divTags.length; i++)
			{
				var newVal = divTags[i].getAttribute ("id").split ("-");
				if (newVal[0] != lcaseVal)
				{
					divTags[i].style.display = "none";
				}
			}
		}
		ShowAltRows ();
	}

    // Function to show alternate row colors for Updates
    function ShowAltRows ()
    {
	    var divTags = document.getElementById ("updates").getElementsByTagName ("div");
	    var justMod = true;
	    var visibleUpdateCount = 0;
		var totalUpdatesCount = divTags.length;
		
		/* We need to decide here, if we want to disable few controls, since there are no updates to display*/
		if (totalUpdatesCount <= 0)
		{
			disableControls = true;
			document.getElementById ("show").disabled = true;
			document.getElementById ("startButton").disabled = true;
		}
		
	    for (i=0; i<totalUpdatesCount; i++)
	    {
		    if (divTags[i].style.display == "block")
		    {
			    if (justMod)
			    {
				    divTags[i].className = "odd";
				    justMod = false;
    		    }
			    else
			    {
	       		    divTags[i].className = "even";
	       		    justMod = true;
			    }
			    visibleUpdateCount++;
		    }
	    }
	    
	    if (visibleUpdateCount <= 0) 
	    {
			ShowStatusMessage(true);
	    }
	    else
	    {
			ShowStatusMessage(false);
	    }
    }

	function ShowStatusMessage (option)
	{
		var statusArea = document.getElementById("status");
		var updatesArea = document.getElementById("updates");
		
		if (option)
		{
			statusArea.style.display="block";
			updatesArea.style.display="none";
		}
		else
		{
			updatesArea.style.display="block";
			statusArea.style.display="none";		
		}
	}
	
    // Function to retrive all checked values
    function CheckValues (optType)
    {
	    var selected = new Array ();
	    var index = 0;
	    
	    for (var intLoop = 0; intLoop < optType.length; intLoop++) 
	    {
		    if (optType[intLoop].checked) 
		    {
			    index = selected.length;
			    selected[index] = new Object;
			    selected[index].value = optType[intLoop].value;
			    selected[index].index = intLoop;
			}
		}
	    return selected;
    }

</SCRIPT>
<link rel = "stylesheet" type = "text/css" href = "updater.css">	
</head>
<body style="overflow:auto">
<div id = "main">
<form action = "#" method = "post" id = "frmupdater" name = "frmupdater">
<div id = "container">
<p class = "desc">%s<strong>%s</strong>.</p>
<div class = "showupdatestxt"><strong>%s</strong></div>
<div class = "formright">
	<dl id = "selector" class = "menu">
				<dt id = "menutitle"><a href = "#" onclick = "ShowMenu ();" id = "selected">%s</a></dt>
				<dd id = "nav">
					<ul>
						<li><a href = "#" id = "All Updates" value = "4" onclick = "UpdateSelected (this.innerHTML, value);">%s</a></li>
						<li><a href = "#" id = "Critical Updates" value = "3" onclick = "UpdateSelected (this.innerHTML, value);">%s</a></li>
						<li><a href = "#" id = "Mandatory Updates" value = "2" onclick = "UpdateSelected (this.innerHTML, value);">%s</a></li>
						<li><a href = "#" id = "Optional Updates" value = "0" onclick = "UpdateSelected (this.innerHTML, value);">%s</a></li>
					</ul>
			</dd>
	</dl>
<br class = "clear" />
<div class = "checkright"><input type = "checkbox" id = "show" onclick = "ShowCheckbox ()" value = "0" />%s</div>
</div>
<br class = "clear" />
<hr />
<div id = "status">
%s
</div>
<div id = "updates">
%s
</div>
<p class = "center">
<input type = "image" id="startButton" src = "start.gif" value = "submit" onclick = "SendSelectedUpdates (this.form.updatetype);" />&nbsp;<input type = "image" id="closeButton" src = "close.gif" onClick = "CloseToast ();" />
</p>
</div><!-- Container Ends -->
<input type = "checkbox" id = "updatetype" name = "updatetype" value = "" class = "checkbox" style = "display:none;" />
</form>
</div><!-- Main Ends -->
</body>
</html>    
]]>
</itemcontent>
</toasteritem>