home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 118 / cdrom118.iso / internet / webaroo / WebarooSetup.exe / Webaroo.msi / _0857854F2B184AFC9817864B6183F57D < prev    next >
Encoding:
Text File  |  2006-03-28  |  37.6 KB  |  1,185 lines

  1. // i8n - Non-Compliant
  2. // Error Message
  3. var loading_string="Data Loading";
  4. // Construct the list of Choices in the Library Browser - For the Specific Device
  5.  
  6. // Need to verify if these global variables can be used ????
  7. var myPlacesXml, mySitesXml;
  8. var updateRequestXml;
  9. var storeID, subscriptions_found = 0;
  10. var checkingSubscriptionUpdates = 0;
  11. var pendingRequests = new Array();
  12.  
  13. var MyPlace = 1;
  14. var MySite = 2;
  15.  
  16. var NoContentSelectedMessage = "No content selected";
  17.  
  18. var subXml = null;
  19. var websiteXml = null;
  20.  
  21. function LoadLibraryPage()
  22. {
  23.     MM_preloadImages('/webaroo/e29f1fe6/images/webaroo_search_f2.gif','/webaroo/e29f1fe6/images/webaroo_contents_f2.gif','/webaroo/e29f1fe6/images/webaroo_prefs_f2.gif','/webaroo/e29f1fe6/images/webaroo_help_f2.gif');
  24.     // following lines for rounded corners script
  25.     if(NiftyCheck())
  26.     {
  27.         Rounded("div#leftMenuDiv","all","#FFAA44","#FFFFFF","smooth");//parameters in order: no. of corners rounded, corner colour, top and bottom colour, type of corner
  28.         Rounded("div#libraryBannerStatusDiv","all","#FFAA44","#E35201","smooth");
  29.         Rounded("div#storeBannerStatusDiv","all","#FFAA44","#E35201","smooth");
  30.         Rounded("div#deviceBannerStatusDiv","all","#FFAA44","#E35201","smooth");
  31.         Rounded("div#favoriteBannerStatusDiv","all","#FFAA44","#E35201","smooth");
  32.         Rounded("div#favoriteViewDiv","all","#FFAA44","#FFFFFF","smooth");
  33.     }
  34.     
  35.     // initialize the DHTML History framework
  36.     dhtmlHistory.initialize();   
  37.     // add ourselves as a DHTML History listener
  38.     dhtmlHistory.addListener(GetLibraryPage);
  39.     if(dhtmlHistory.isFirstLoad()) 
  40.     {
  41.         ShowMyLibrary(0);
  42.     }    
  43. }
  44.  
  45. function GetLibraryPage()
  46. {
  47.     var currentLocation = window.location.href.split("#");
  48.     if (currentLocation[0].indexOf("/webaroo/e29f1fe6/content") == -1)
  49.     {
  50.         return;
  51.     }
  52.     
  53.     if(currentLocation.length >1)
  54.     {
  55.         var pageType = currentLocation[1];
  56.         if (pageType == "")
  57.         {
  58.             ShowMyLibrary(0);
  59.         }
  60.         else if(pageType == "mylibrary")
  61.             ShowMyLibrary(0);
  62.         else if(pageType == "favorite")
  63.             ShowAddFavorite(0);
  64.         else if(pageType == "onlinestore")
  65.             ShowOnlineStore(0);
  66.         else 
  67.         {
  68.             pageType = pageType.split("=");
  69.             if(pageType[0]=="deviceIndex")
  70.             {
  71.                 var deviceindex = parseInt(pageType[1]);
  72.                 if(deviceNameList.length > deviceindex)
  73.                     ShowDeviceInfo(0,deviceindex);
  74.                 else // Most likely the device/store is removed
  75.                     ShowMyLibrary(0);
  76.             }
  77.         }
  78.     }    
  79.     else
  80.         ShowMyLibrary(0);
  81. }
  82.  
  83. // Displays My Library view
  84. function ShowMyLibrary(addToHistory)
  85. {
  86.     if(addToHistory)
  87.     {
  88.         dhtmlHistory.add("mylibrary","");
  89.     }
  90.     currentDeviceIndex = -1;
  91.     AdjustPageElements("library");
  92.     AbortPendingRequests();
  93.     subscriptions_found = 0;
  94.     ConstructDeviceChoiceTable();
  95.     showMyLibrarySizeDetails();
  96. }
  97.  
  98. function AbortPendingRequests()
  99. {
  100.     if (pendingRequests != null)
  101.     {
  102.         for (var i=0; i < pendingRequests.length; ++i)
  103.         {
  104.             if (pendingRequests[i] != null)
  105.             {
  106.                 pendingRequests[i].abort();
  107.                 pendingRequests[i] = null;
  108.             }
  109.         }
  110.     }
  111.  
  112.     pendingRequests = new Array();
  113. }
  114.  
  115. function AddEmptyRowsInSubscriptionTable()
  116. {
  117.     // Add some empty rows in the left nav
  118.     var rowkeys = new Array();
  119.     var rowvalues = new Array();
  120.     var keys = new Array();
  121.     var values = new Array();
  122.     // Add some empty rows in the Subscription table
  123.     // find out the current rows in the table 
  124.     var deviceTable = document.getElementById('device_choices_table');
  125.     var noOfRowsInSubscriptionTable = deviceTable.rows.length;
  126.     var limit = 8 - noOfRowsInSubscriptionTable;
  127.     for (var i =0; i < limit ; i++)
  128.     {
  129.         keys[0] = "innerHTML";
  130.         values[0] = " ";
  131.         keys[2] = "height";
  132.         values[2]="46";
  133.         var newRow = AddRowToTable('device_choices_table', rowkeys,rowvalues,keys, values);
  134.         // For getting the vertical lines    
  135.         AddCellToRow(newRow, keys, values);
  136.         AddCellToRow(newRow, keys, values);
  137.         AddCellToRow(newRow, keys, values);
  138.         AddCellToRow(newRow, keys, values);
  139.     }
  140.     AlternateTableRowStyle('device_choices_table');
  141. }
  142.  
  143. function AddEmptyRowsInLeftMenu()
  144. {
  145.     // Add some empty rows in the left nav
  146.     var rowkeys = new Array();
  147.     var rowvalues = new Array();
  148.     var keys = new Array();
  149.     var values = new Array();
  150.     
  151.     // First delete all the empty rows from the devicelist legth onwards
  152.     ClearTable('ExtraRowsInLeftNav');
  153.     //adding 5 rows now
  154.     var limit = 14 - deviceList.length;
  155.     for (var i =0; i < limit ; i++)
  156.     {
  157.         keys[0] = "innerHTML";
  158.         values[0] = " ";
  159.         AddRowToTable('ExtraRowsInLeftNav', rowkeys,rowvalues,keys, values);
  160.     }
  161. }
  162.  
  163. function CheckForSubscriptionUpdates()
  164. {
  165.     if ((checkingSubscriptionUpdates == 0) && (currentView == "library") && (currentDeviceIndex == -1) && (subscriptions_found > 0))
  166.     {
  167.         checkingSubscriptionUpdates = 1;
  168.         SendAsynchornousRequest("/webaroo/e29f1fe6/updatedsubs", "", ShowUpdatedSubscriptions, "");
  169.     }
  170. }
  171.  
  172. function ShowUpdatedSubscriptions(xmlStatus, data)
  173. {
  174.     var subIds = new Array();
  175.     var rowIndex;
  176.     
  177.     var listObject = xmlStatus.getElementsByTagName('ID');
  178.     for (var j=0;j<listObject.length;j++)
  179.     {
  180.         if (listObject[j].nodeType != 1) continue;
  181.         
  182.         subIds.push(listObject[j].firstChild.nodeValue);
  183.     }
  184.     
  185.     if ((currentView == "library") && (currentDeviceIndex == -1) && (subscriptions_found > 0))
  186.     {
  187.         for (var k=0;k < subIds.length; ++k)
  188.         {
  189.             rowIndex = GetRowIndex(subIds[k]);
  190.             if (rowIndex != -1)
  191.             {
  192.                 var updateImg = document.getElementById('uAval' + (rowIndex-1));
  193.                 if(updateImg != null)
  194.                 {
  195.                     updateImg.innerHTML = "<img src=\"/webaroo/e29f1fe6/images/webaroo_upd_available.gif\" border=\"0\" onMouseover=\"ddrivetip('Updates available.', 80)\"; onMouseout=\"hideddrivetip()\">";
  196.                 }
  197.             }
  198.         }
  199.     }
  200.  
  201.     checkingSubscriptionUpdates = 0;
  202. }
  203.  
  204. function ConstructDeviceChoiceTable()
  205. {    
  206.     //On slow systems this should give an intermediate "Loading..." screen.
  207.     document.getElementById('loading').style.display="block";
  208.  
  209.     //Constructing the table for the given store
  210.     SendDeviceChoiceTable(-1, "library");
  211.  
  212.     
  213. }
  214.  
  215. function AddNoContentTable()
  216. {
  217.     var htmlCode;
  218.     
  219.     htmlCode = "<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"620\"> \
  220.                     <tr> \
  221.                         <td style=\"vertical-align:middle; text-align:center; font:bold 12px verdana; color:#E35201; padding-top:10px; padding-bottom:10px;\" >You currently do not have any content downloaded to your library</td> \
  222.                     </tr> \
  223.                     <tr> \
  224.                         <td style=\"vertical-align:middle; text-align:left; font:normal 12px verdana; color:#003366;\" ><p><b>Add Web Pack</b></p>A Web Pack brings together relevant web content from multiple sources for a specific topic that you can download on your laptop or mobile devices. Currently available Web Packs include popular city destinations, news and sports - more will follow soon. To get started click on \"add web pack\" link as shown below.<br/></td> \
  225.                     </tr> \
  226.                     <tr> \
  227.                         <td style=\"vertical-align:middle; text-align:center;\"><img src=\"images/webaroo_add_packs.gif\" /><br/></td> \
  228.                     </tr> \
  229.                     <tr> \
  230.                         <td style=\"vertical-align:middle; text-align:left; font:normal 12px verdana; color:#003366;\" ><p><b>Add Web Site</b></p>You can also download your favorite web sites to your Library and have access to it all the time. You just need to specify the web URL and depth of pages you want to download. To add a Web Site click the \"add web site\" button as shown below.<br/> </td> \
  231.                     </tr> \
  232.                     <tr> \
  233.                         <td style=\"vertical-align:middle; text-align:center;\"><img src=\"images/webaroo_add_site.gif\" /><br/></td> \
  234.                     </tr> \
  235.                 </table>";
  236.     
  237.     return htmlCode;
  238. }
  239.  
  240. function renderNoContentDeviceChoiceTableData()
  241. {
  242.     ClearTable('device_choices_table');
  243.     AddHeaderRow('device_choices_table');
  244.     
  245.     var keys = new Array();
  246.     var values = new Array();
  247.     var rowkeys = new Array();
  248.     var rowvalues = new Array();
  249.     
  250.     // Need to add table in place of the cell
  251.     var htmlCode = AddNoContentTable();
  252.     
  253.     keys[0] = "innerHTML";
  254.     keys[2] = "colspan";
  255.     keys[3] = "align";
  256.     values[0] = htmlCode;
  257.     values[1] = "top";
  258.     values[2] = "5";
  259.     values[3] = "center";
  260.     AddRowToTable('device_choices_table', rowkeys,rowvalues,keys, values);
  261. }
  262.  
  263. function SendDeviceChoiceTable(deviceIndex, context)
  264. {
  265.     var cardName;
  266.     var cardId;
  267.     var cardType;
  268.     var url, request="";
  269.     var currentContext = new Array();
  270.     
  271.     if (deviceIndex != -1)
  272.     {
  273.         cardName = deviceNameList[deviceIndex];
  274.         cardId = deviceList[deviceIndex];
  275.         cardType = storeTypeList[deviceIndex];
  276.         request = "&storeID=" + cardId +"&cardName=" + cardName;
  277.     }
  278.     
  279.     ClearTable('device_choices_table');
  280.     // Generate the XMLHTTPRequest to get the XML response file 
  281.     // for the places for the Specific Store
  282.     url = "/webaroo/e29f1fe6/myplaces?resourceType=storeSubscriptionXml" + request;
  283.     currentContext[0] = deviceIndex;
  284.     currentContext[1] = context;
  285.     // This is asynchronous call
  286.     SendAsynchornousRequest(url,"",renderXMLDeviceChoiceTableData,currentContext);
  287. }
  288.  
  289. //Constructing the table for the given store
  290. function renderXMLDeviceChoiceTableData(webPackXml, originalContext)
  291. {
  292.     // Function has I18N issue
  293.     var htmlData="";
  294.     var cardName;
  295.     var cardId;
  296.     var cardType;
  297.     var url, request="";
  298.     var deviceIndex = originalContext[0];
  299.     var originalView = originalContext[1];
  300.     
  301.     // Make sure we are in same View and device index matches
  302.     if ((currentView == originalView) && (currentDeviceIndex == deviceIndex))
  303.     {
  304.         
  305.         if (deviceIndex != -1)
  306.         {
  307.             cardName = deviceNameList[deviceIndex];
  308.             cardId = deviceList[deviceIndex];
  309.             cardType = storeTypeList[deviceIndex];
  310.             request = "&storeID=" + cardId +"&cardName=" + cardName;
  311.         }
  312.         
  313.     
  314.         var currentSubscriptionID;
  315.         var currentChannelID;
  316.         var currentSubChannelID;
  317.         var currentTopic;
  318.         var currentDescription;
  319.         var currentSize;
  320.         var realSize;
  321.         var currentSizeUnit;
  322.         var realSizeUnit;
  323.         var currentImageCopyFlag;
  324.         var currentSubscriptionType;
  325.         var currentSiteID;
  326.         var currentSiteURL;
  327.         var currentSiteLinkLevel;
  328.         var currentSubscriptionLastUpdateDate;
  329.         
  330.         var newRow, newCell;
  331.         var keys = new Array();
  332.         var values = new Array();
  333.         var rowkeys = new Array();
  334.         var rowvalues = new Array();
  335.         
  336.         myPlacesXml = webPackXml;
  337.         subXml = webPackXml;
  338.         
  339.         url = "/webaroo/e29f1fe6/mysites?resourceType=xml" + request;
  340.         // This is also a synchronous call
  341.         processXMLData(url);
  342.         mySitesXml = xmlContent;
  343.         websiteXml = xmlContent;
  344.  
  345.  
  346.         var subListObject = subXml.getElementsByTagName('Subscription');
  347.         // Now get the listObject for mysites
  348.         var mysitesListObject = websiteXml.getElementsByTagName('Favorite');
  349.         // Clear the device_choice_table first
  350.         ClearTable('device_choices_table');
  351.         
  352.         if((deviceIndex==-1)&&(subListObject.length==0)&&(mysitesListObject.length==0))
  353.         {
  354.             AddHeaderRow('device_choices_table');
  355.             var updateButton = document.getElementById('updateButton');
  356.             updateButton.disabled = true;
  357.             var deleteButton = document.getElementById('deleteButton');
  358.             deleteButton.disabled = true;    
  359.             
  360.             // also disable the "Copy To.." drop down control
  361.             var copyToDropDownControl = document.getElementById('copyToDropDown');
  362.             copyToDropDownControl.disabled = true;
  363.             
  364.             renderNoContentDeviceChoiceTableData();
  365.             document.getElementById('loading').style.display="none";
  366.             document.getElementById('device_choices').style.display="block";        
  367.             return;        
  368.         }
  369.         else if((deviceIndex!=-1)&&(subListObject.length==0)&&(mysitesListObject.length==0))
  370.         {
  371.             var syncDeviceButton = document.getElementById('syncDevice');
  372.             syncDeviceButton.disabled = true;
  373.             var removeButton = document.getElementById('removeDevice');
  374.             removeButton.disabled = true;    
  375.             SetOperationStatus('deviceBanner', "No content found. Add content to your mobile device from <a href='javascript:ShowMyLibrary(1)'>my library</a>.");    
  376.             document.getElementById('loading').style.display="none";
  377.             document.getElementById('device_choices').style.display="none";        
  378.             return;
  379.         }
  380.         else if((subListObject.length!=0)||(mysitesListObject.length!=0))
  381.         {
  382.             AddHeaderRow('device_choices_table');
  383.             if(deviceIndex == -1) // enable the control 
  384.             {
  385.                 var updateButton = document.getElementById('updateButton');
  386.                 updateButton.disabled = false;
  387.                 var deleteButton = document.getElementById('deleteButton');
  388.                 deleteButton.disabled = false;    
  389.                 // also disable the "Copy To.." drop down control
  390.                 var copyToDropDownControl = document.getElementById('copyToDropDown');
  391.                 if(deviceList.length>1) // Atlease one device storage is connected
  392.                     copyToDropDownControl.disabled = false;
  393.             }
  394.             else // enable the controls for device view
  395.             {
  396.                 var syncDeviceButton = document.getElementById('syncDevice');
  397.                 syncDeviceButton.disabled = false;
  398.                 var removeButton = document.getElementById('removeDevice');
  399.                 removeButton.disabled = false;    
  400.             }
  401.         }
  402.         
  403.         // Increment the count while assigning the id to the checkbox
  404.         var checkboxindex = 0;
  405.         
  406.         for (var j=0;j<subListObject.length;j++)
  407.         {
  408.             if (subListObject[j].nodeType != 1) continue;
  409.             
  410.             subscriptions_found=1;
  411.             currentNodeObject=subListObject[j];
  412.             for (k=0;k<currentNodeObject.childNodes.length;k++)
  413.             {
  414.                 if (currentNodeObject.childNodes[k].nodeType != 1) continue;
  415.                 switch(currentNodeObject.childNodes[k].nodeName)
  416.                 {
  417.                     case 'SubscriptionID':
  418.                         currentSubscriptionID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  419.                         break;
  420.                     case 'ChannelID':
  421.                         currentChannelID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  422.                         break;
  423.                     case 'SubChannelID':
  424.                         currentSubChannelID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  425.                         break;
  426.                     case 'Topic':
  427.                         currentTopic=currentNodeObject.childNodes[k].firstChild.nodeValue;
  428.                         break;
  429.                     case 'Description':
  430.                         currentDescription=currentNodeObject.childNodes[k].firstChild.nodeValue;
  431.                         break;
  432.                     case 'Size':
  433.                         currentSize=currentNodeObject.childNodes[k].firstChild.nodeValue;
  434.                         break;
  435.                     case 'RealSize':
  436.                         realSize = currentNodeObject.childNodes[k].firstChild.nodeValue;
  437.                         break;
  438.                     case 'SizeUnit':
  439.                         currentSizeUnit=currentNodeObject.childNodes[k].firstChild.nodeValue;
  440.                         break;
  441.                     case 'RealSizeUnit':
  442.                         realSizeUnit=currentNodeObject.childNodes[k].firstChild.nodeValue;
  443.                         break;
  444.                     case 'ImageCopyFlag':
  445.                         currentImageCopyFlag=currentNodeObject.childNodes[k].firstChild.nodeValue;
  446.                         break;
  447.                     case 'LastUpdate':
  448.                         currentSubscriptionLastUpdateDate = currentNodeObject.childNodes[k].firstChild.nodeValue;
  449.                         break;
  450.                 }
  451.             }
  452.  
  453.             keys[0] = "innerHTML";
  454.             keys[1] = "width";
  455.             keys[2] = "valign";
  456.             keys[3] = "align";
  457.             
  458.             values[0] = "<input id=\"device_choice_checkbox" + checkboxindex +"\" name=\"device_choice_checkbox\" type=\"checkbox\" value=\""+currentSubscriptionID+"\"/>";
  459.             values[1] = "20";
  460.             values[2] = "top";
  461.             values[3] = "center";
  462.             newRow = AddRowToTable('device_choices_table', rowkeys,rowvalues,keys, values);
  463.  
  464.  
  465.             keys[3] = "";
  466.             
  467.             if(currentSubscriptionLastUpdateDate.indexOf("Not")==0)
  468.                 values[0] = "<font style=\"font-family:Verdana, 'Times New Roman', Times, serif; font-weight:normal; font-size:12px;\">" + currentTopic + "</font> <br />";        
  469.             else
  470.                 values[0] = "<font style=\"font-family:Verdana, 'Times New Roman', Times, serif; font-weight:normal; font-size:12px;\"><a href=\"/webaroo/e29f1fe6/search#/webaroo/e29f1fe6/topics?searcherid=" + doubleUrlEncode(currentSubscriptionID) +"&channelId=" + currentChannelID + "\">" + currentTopic + "</a></font> <br />";
  471.         
  472.             values[0] += "<input type=\"hidden\" value=\"" + MyPlace + "\" name=\"subscriptionType\">";
  473.             values[0] += "<image src=\"/webaroo/e29f1fe6/images/webaroo_webpack.gif\" />  <font class=\"itemType\">web pack</font>   ";
  474.             values[1] = "165";
  475.             AddCellToRow(newRow, keys, values);
  476.  
  477.             values[0] = "<font class=\"itemSize\">" + realSize + " " + realSizeUnit + "<br/> (" + currentSize + " " + currentSizeUnit + ")</font><br />"
  478.             values[1] ="80";
  479.             AddCellToRow(newRow, keys, values);
  480.             
  481.             // Truncating size of currentTopic to 100 chars
  482.             var regularExpr = /'/g
  483.             currentDescription = currentDescription.replace(regularExpr,'\\\'');
  484.             var intSize = currentDescription.length;
  485.             var truncatedDescription = currentDescription.substring(0, 100);
  486.             if(intSize > 100)
  487.             {
  488.                 truncatedDescription += "...";
  489.             }
  490.  
  491.             // I18N issue
  492.             values[0] = "<b onMouseover=\"ddrivetip('" + currentDescription + "', 300)\"; onMouseout=\"hideddrivetip()\">";
  493.             values[0] += "<font class=\"itemDes\">" + truncatedDescription + "</font></b>";
  494.             values[1] = "270";
  495.             AddCellToRow(newRow, keys, values);
  496.  
  497.  
  498.             
  499.             values[0] = (deviceIndex == -1) ? "<span id=\"uAval" + checkboxindex + "\" name=\"uAval" + checkboxindex + "\"><img name=\"umage" + checkboxindex +"\" src=\"images/webaroo_no_updates.gif\" border=\"0\"></span>" : "";
  500.             values[0] += "<font class=\"itemUpdate\">" + currentSubscriptionLastUpdateDate + "</font>";
  501.             values[1] ="85";
  502.             AddCellToRow(newRow, keys, values);
  503.             keys[1] = "";
  504.             checkboxindex++;
  505.         }
  506.  
  507.         for (j=0;j<mysitesListObject.length;j++)
  508.         {
  509.             if (mysitesListObject[j].nodeType != 1) continue;
  510.             
  511.             subscriptions_found=1;        
  512.             var currentNodeObject=mysitesListObject[j];
  513.             var currentSiteID;
  514.             var currentSiteName;
  515.             var currentSiteURL;
  516.             var currentSiteLinkLevel;
  517.             var originalSiteURL;
  518.             var catchedSiteUrl;
  519.             
  520.             for (var k=0;k<currentNodeObject.childNodes.length;k++)
  521.             {
  522.                 if (currentNodeObject.childNodes[k].nodeType != 1) continue;
  523.                 switch(currentNodeObject.childNodes[k].nodeName)
  524.                 {
  525.                     case 'ID':
  526.                         currentSiteID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  527.                         break;
  528.                     case 'SiteName':
  529.                         currentSiteName=currentNodeObject.childNodes[k].firstChild.nodeValue;
  530.                         // if siteURL is more than 20 chracters, trim and append ... to it
  531.                         // The below code is useless because we check for site length when we add a site
  532.                         // but it is kept here to override manual additions  -- pravin
  533.                         if(currentSiteName.length > 20)
  534.                         {
  535.                             currentSiteName = currentSiteName.substring(0,19) + "...";
  536.                         }
  537.                         break;
  538.                     case 'SiteURL':
  539.                         currentSiteURL=currentNodeObject.childNodes[k].firstChild.nodeValue;
  540.                         originalSiteURL = currentSiteURL;
  541.                         // if siteURL is more than 50 chracters, trim and append ... to it
  542.                         if(currentSiteURL.length > 40)
  543.                         {
  544.                             currentSiteURL = currentSiteURL.substring(0,39) + "...";
  545.                         }
  546.                         break;
  547.                     case 'SiteLinkLevel':
  548.                         currentSiteLinkLevel=currentNodeObject.childNodes[k].firstChild.nodeValue;
  549.                         break;
  550.                     case 'ChannelID':
  551.                         currentChannelID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  552.                         break;
  553.                     case 'SubChannelID':
  554.                         currentSubChannelID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  555.                         break;
  556.                     case 'Size':
  557.                         currentSize=currentNodeObject.childNodes[k].firstChild.nodeValue;
  558.                         break;
  559.                     case 'RealSize':
  560.                         realSize = currentNodeObject.childNodes[k].firstChild.nodeValue;
  561.                         break;
  562.                     case 'SizeUnit':
  563.                         currentSizeUnit=currentNodeObject.childNodes[k].firstChild.nodeValue;
  564.                         break;
  565.                     case 'ImageCopyFlag':
  566.                         currentImageCopyFlag=currentNodeObject.childNodes[k].firstChild.nodeValue;
  567.                         break;
  568.                     case 'LastUpdate':
  569.                         currentSubscriptionLastUpdateDate = currentNodeObject.childNodes[k].firstChild.nodeValue;
  570.                         break;
  571.                     case 'CachedUrl':
  572.                         if(currentNodeObject.childNodes[k].firstChild != null)
  573.                             catchedSiteUrl = currentNodeObject.childNodes[k].firstChild.nodeValue;
  574.                         else
  575.                             catchedSiteUrl = "";
  576.                         break;
  577.                 }
  578.             }
  579.  
  580.             keys[0] = "innerHTML";
  581.             keys[1] = "width";
  582.             keys[2] = "valign";
  583.             keys[3] = "align";
  584.             
  585.             values[0] = "<input id=\"device_choice_checkbox" + checkboxindex +"\" name=\"device_choice_checkbox\" type=\"checkbox\" value=\""+currentSiteID+"\"/>";
  586.             values[1] = "20";
  587.             values[2] = "top";
  588.             values[3] = "center";
  589.             newRow = AddRowToTable('device_choices_table', rowkeys,rowvalues,keys, values);
  590.  
  591.  
  592.             keys[3] = "";
  593.             
  594.             if((currentSubscriptionLastUpdateDate.indexOf("Not")==0)||(catchedSiteUrl==""))
  595.                 values[0] = "<font style=\"font-family:Verdana, 'Times New Roman', Times, serif; font-weight:normal; font-size:12px;\">" + currentSiteName + "</font><br />";
  596.             else
  597.                 values[0] = "<font style=\"font-family:Verdana, 'Times New Roman', Times, serif; font-weight:normal; font-size:12px;\"><a href=\""+ catchedSiteUrl +"\">" + currentSiteName + "</a></font><br />";
  598.         
  599.             values[0] += "<input type=\"hidden\" value=\"" + MySite + "\" name=\"subscriptionType\">";
  600.             values[0] += "<image src=\"/webaroo/e29f1fe6/images/webaroo_website.gif\" />  <font class=\"itemType\">web site</font>   ";
  601.             values[1] = "165";
  602.             AddCellToRow(newRow, keys, values);
  603.  
  604.  
  605.             values[0] = "<font class=\"itemSize\">" + currentSize + " " + currentSizeUnit + " <br/> </font><br />"
  606.             values[1] = "80";
  607.             AddCellToRow(newRow, keys, values);
  608.             
  609.             // I18N issue
  610.             values[0] = "<font class=\"itemSite\">" + currentSiteURL + "</font><br />";
  611.             values[0] += "<font class=\"itemSize\">Link Depth " + currentSiteLinkLevel + "</font>";
  612.             values[1] = "270";
  613.             AddCellToRow(newRow, keys, values);
  614.  
  615.  
  616.             
  617.             //keys[1] = "noWrap";
  618.             //values[1] = "true";
  619.             values[0] = (deviceIndex == -1) ? "<img name=\"umage" + checkboxindex +"\" src=\"images/webaroo_no_updates.gif\" border=\"0\" />" : "";
  620.             values[0] += "<font class=\"itemUpdate\">" + currentSubscriptionLastUpdateDate + "</font>";
  621.             values[1] = "85";
  622.             AddCellToRow(newRow, keys, values);
  623.             // increment the count
  624.             checkboxindex++;
  625.         }
  626.     
  627.         AlternateTableRowStyle('device_choices_table');
  628.         document.getElementById('loading').style.display="none";
  629.         document.getElementById('device_choices').style.display="block";
  630.     
  631.         // Add empty rows here
  632.         AddEmptyRowsInSubscriptionTable();        
  633.  
  634.         CheckForSubscriptionUpdates();
  635.  
  636.         // Asynchronous call to get real pack sizes
  637.         var packContext = new Array();
  638.         packContext[0] = currentDeviceIndex;
  639.         packContext[1] = currentView;
  640.         packContext[2] = 'Subscription';
  641.         url = "/webaroo/e29f1fe6/myplaces?resourceType=storeSubscriptionXml" + request + "&getRealPackSize=true";
  642.         var packRequest = SendAsynchornousRequest(url, "", RenderSizeInfo, packContext);
  643.         pendingRequests.push(packRequest);
  644.         
  645.         // Asynchronous call to get real site sizes
  646.         var siteContext = new Array();
  647.         siteContext[0] = currentDeviceIndex;
  648.         siteContext[1] = currentView;
  649.         siteContext[2] = 'Favorite';
  650.         url = "/webaroo/e29f1fe6/mysites?resourceType=xml" + request + "&getRealSiteSize=true";
  651.         var siteRequest = SendAsynchornousRequest(url, "", RenderSizeInfo, siteContext);
  652.         pendingRequests.push(siteRequest);
  653.     }
  654. }
  655.  
  656. function RenderSizeInfo(subSizeXml, originalContext)
  657. {
  658.     var deviceIndex = originalContext[0];
  659.     var originalView = originalContext[1];
  660.     
  661.     // Make sure we are in same View and device index matches
  662.     if ((currentView == originalView) && (currentDeviceIndex == deviceIndex))
  663.     {
  664.         var currentSubscriptionID;
  665.         var currentSize;
  666.         var realSize;
  667.         var currentSizeUnit;
  668.         var realSizeUnit;
  669.         var rowIndex;
  670.         
  671.         var deviceChoiceTable = document.getElementById('device_choices_table');
  672.         var sizeXml = subSizeXml;
  673.         var subListObject = sizeXml.getElementsByTagName(originalContext[2]);
  674.         
  675.         for (var j=0; j < subListObject.length; j++)
  676.         {
  677.             if (subListObject[j].nodeType != 1) continue;
  678.             
  679.             currentNodeObject=subListObject[j];
  680.             for (var k=0;k<currentNodeObject.childNodes.length;k++)
  681.             {
  682.                 if (currentNodeObject.childNodes[k].nodeType != 1) continue;
  683.                 switch(currentNodeObject.childNodes[k].nodeName)
  684.                 {
  685.                     case 'SubscriptionID':
  686.                         currentSubscriptionID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  687.                         break;
  688.                     case 'ID':
  689.                         currentSubscriptionID=currentNodeObject.childNodes[k].firstChild.nodeValue;
  690.                         break;
  691.                     case 'Size':
  692.                         currentSize=currentNodeObject.childNodes[k].firstChild.nodeValue;
  693.                         break;
  694.                     case 'RealSize':
  695.                         realSize = currentNodeObject.childNodes[k].firstChild.nodeValue;
  696.                         break;
  697.                     case 'SizeUnit':
  698.                         currentSizeUnit=currentNodeObject.childNodes[k].firstChild.nodeValue;
  699.                         break;
  700.                     case 'RealSizeUnit':
  701.                         realSizeUnit=currentNodeObject.childNodes[k].firstChild.nodeValue;
  702.                         break;
  703.                 }
  704.             }
  705.  
  706.             rowIndex = GetRowIndex(currentSubscriptionID);
  707.             if (rowIndex != -1)
  708.             {
  709.                 if (originalContext[2] == 'Subscription')
  710.                 {
  711.                     deviceChoiceTable.rows[rowIndex].cells[2].innerHTML = "<font class=\"itemSize\">" + realSize + " " + realSizeUnit + "<br/> (" + currentSize + " " + currentSizeUnit + ")</font><br />"
  712.                 }
  713.                 else
  714.                 {
  715.                     deviceChoiceTable.rows[rowIndex].cells[2].innerHTML = "<font class=\"itemSize\">" + currentSize + " " + currentSizeUnit + " <br/> </font><br />"
  716.                 }
  717.             }
  718.         }
  719.     }
  720. }
  721.  
  722. function RemoveSubscriptions(deviceIndex ,placeIDs, siteIDs)
  723. {
  724.     var url;
  725.     var confirmDelete;
  726.     
  727.     if(deviceIndex != -1)
  728.     {
  729.         confirmDelete = confirm('Are you sure you want to delete the selected content?')
  730.     }
  731.     else
  732.     {
  733.         confirmDelete = confirm('Are you sure you want to delete the selected content? Please note that the content will also be deleted from your mobile stores if they are connected right now.')
  734.     }
  735.     
  736.     if(confirmDelete)
  737.     {
  738.         var status="Processing delete request. Please wait...";
  739.         if (deviceIndex == -1)
  740.         {
  741.             SetOperationStatus('libraryBanner', status);
  742.         }
  743.         else
  744.         {
  745.             SetOperationStatus('deviceBanner', status);
  746.         }
  747.         
  748.         var deletedXml = '<XmlData>\n';
  749.         if (deviceIndex != -1)
  750.         {
  751.             deletedXml += '<storeID>' + deviceList[deviceIndex] + '</storeID>\n';
  752.             deletedXml += '<CardName>' + EncodeValue(deviceNameList[deviceIndex]) + '</CardName>\n';
  753.             deletedXml += '<CardType>' + storeTypeList[deviceIndex] + '</CardType>\n';
  754.             deletedXml += '<DeviceType>' + deviceTypeList[deviceIndex] + '</DeviceType>\n';
  755.         }
  756.         deletedXml += '<Response>\n';
  757.         if (placeIDs.length > 0)
  758.         {
  759.             deletedXml += CreateSubscriptionsXml(placeIDs, MyPlace);
  760.         }
  761.         if (siteIDs.length > 0)
  762.         {
  763.             deletedXml += CreateSubscriptionsXml(siteIDs, MySite);
  764.         }
  765.         deletedXml += '</Response>\n';
  766.         deletedXml += '</XmlData>\n';
  767.             
  768.         url = "/webaroo/e29f1fe6/savemysubs?request=delete";
  769.         SendAsynchornousRequest(url, "XMLData=" + deletedXml, ReturnMessageStatus, deviceIndex);
  770.     }
  771. }
  772.  
  773. // Called from My Library and Device view
  774. function SendDeleteRequestToServer(deviceIndex, subscriptionID)
  775. {
  776.     var subscriptionType = FindSubscriptionTypeFromID(subscriptionID);
  777.     if (subscriptionType != -1)
  778.     {
  779.         var placeIDs = new Array();
  780.         var siteIDs = new Array();
  781.         if (subscriptionType == MyPlace)
  782.         {
  783.             placeIDs[0] = subscriptionID;
  784.         }
  785.         else
  786.         {
  787.             siteIDs[0] = subscriptionID;
  788.         }
  789.         RemoveSubscriptions(deviceIndex, placeIDs, siteIDs);
  790.     }
  791.     else
  792.     {
  793.         // TODO: handle error
  794.     }
  795. }
  796.  
  797. function FindSubscriptionTypeFromID(subscriptionID)
  798. {
  799.     var libraryForm = document.device_choices_form;
  800.     var subscriptionsTable = document.getElementById('device_choices_table');
  801.     var j, k;
  802.     var type = -1;
  803.     
  804.     if (subscriptionsTable.rows.length == 2) // Table only has header + one row.
  805.     {   
  806.         if (subscriptionID == libraryForm.device_choice_checkbox.value)
  807.         {
  808.             type = libraryForm.subscriptionType.value;
  809.         }
  810.     }
  811.     else
  812.     {
  813.         for (j=0; j < libraryForm.device_choice_checkbox.length; ++j)
  814.         {
  815.             if (subscriptionID == libraryForm.device_choice_checkbox[j].value)
  816.             {
  817.                 type = libraryForm.subscriptionType[j].value;
  818.                 break;
  819.             }
  820.         }
  821.     }
  822.     
  823.     return type;
  824. }
  825.  
  826. function CreateSubscriptionsXml(subscriptionIDs, subscriptionType)
  827. {
  828.     var subscriptionsXml = "";
  829.     
  830.     if (subscriptionType == MyPlace)
  831.     {
  832.         subscriptionsXml += '<Subscriptions>\n';
  833.         subscriptionsXml += CreateMyPlacesXml(subscriptionIDs);
  834.         subscriptionsXml += '</Subscriptions>\n';
  835.     }
  836.     else if (subscriptionType == MySite)
  837.     {
  838.         subscriptionsXml += '<Favorites>\n';
  839.         subscriptionsXml += CreateMySitesXml(subscriptionIDs);
  840.         subscriptionsXml += '</Favorites>\n';
  841.     }
  842.     
  843.     return subscriptionsXml;
  844. }
  845.  
  846. function CreateMyPlacesXml(subscriptionIDs)
  847. {
  848.     var subscriptionList = myPlacesXml.getElementsByTagName('Subscription');
  849.     var i,j,k;
  850.     
  851.     var currentSubscription;
  852.     var currentSubscriptionID;
  853.     var currentChannelID;
  854.     var currentSubChannelID;
  855.     var currentTopic;
  856.     var currentSize;
  857.     var currentImageCopyFlag;
  858.     
  859.     var myPlacesXmlString = "";
  860.     
  861.     for (j=0; j < subscriptionList.length; ++j)
  862.     {
  863.         if (subscriptionList[j].nodeType != 1) continue;
  864.         
  865.         currentSubscription=subscriptionList[j];
  866.  
  867.         for (k=0; k < currentSubscription.childNodes.length; ++k)
  868.         {
  869.             if (currentSubscription.childNodes[k].nodeType != 1) continue;
  870.             
  871.             switch(currentSubscription.childNodes[k].nodeName)
  872.             {
  873.                 case 'SubscriptionID':
  874.                     currentSubscriptionID=currentSubscription.childNodes[k].firstChild.nodeValue;
  875.                     break;
  876.                 case 'ChannelID':
  877.                     currentChannelID=currentSubscription.childNodes[k].firstChild.nodeValue;
  878.                     break;
  879.                 case 'SubChannelID':
  880.                     currentSubChannelID=currentSubscription.childNodes[k].firstChild.nodeValue;
  881.                     break;
  882.                 case 'Topic':
  883.                     currentTopic='<![CDATA[' + escape(currentSubscription.childNodes[k].firstChild.nodeValue) + ']]>';
  884.                     break;
  885.                 case 'OriginalSize':
  886.                     currentSize=currentSubscription.childNodes[k].firstChild.nodeValue;
  887.                     break;
  888.                 case 'ImageCopyFlag':
  889.                     currentImageCopyFlag=currentSubscription.childNodes[k].firstChild.nodeValue;
  890.                     break;
  891.             }
  892.         }
  893.         
  894.         for (i=0; i < subscriptionIDs.length; ++i)
  895.         {
  896.             if (currentSubscriptionID == subscriptionIDs[i])
  897.             {
  898.                 myPlacesXmlString += '<Subscription>\n';
  899.                 myPlacesXmlString += '<SubscriptionID>' + currentSubscriptionID + '</SubscriptionID>\n';
  900.                 myPlacesXmlString += '<ChannelID>' + currentChannelID + '</ChannelID>\n';
  901.                 myPlacesXmlString += '<SubChannelID>' + currentSubChannelID + '</SubChannelID>\n';
  902.                 myPlacesXmlString += '<Topic>' + currentTopic + '</Topic>\n';
  903.                 myPlacesXmlString += '<Size>' + currentSize + '</Size>\n';
  904.                 myPlacesXmlString += '<ImageCopyFlag>' + currentImageCopyFlag + '</ImageCopyFlag>\n';
  905.                 myPlacesXmlString += '</Subscription>\n';
  906.                 
  907.                 break;
  908.             }
  909.         }
  910.     }
  911.  
  912.     return myPlacesXmlString;
  913. }
  914.  
  915. function CreateMySitesXml(siteIDs)
  916. {
  917.     var favoriteList = mySitesXml.getElementsByTagName('Favorite');
  918.     var i,j,k;
  919.     var mySitesXmlString = "";
  920.     
  921.     var currentFavorite;
  922.     var currentSiteID;
  923.     var currentSiteName;
  924.     var currentUrl;
  925.     var currentSiteLinkLevel;
  926.     var currentChannelID;
  927.     var currentSubChannelID;
  928.     var currentSize;
  929.     var currentImageCopyFlag;
  930.     
  931.     for (j=0; j < favoriteList.length; ++j)
  932.     {
  933.         if (favoriteList[j].nodeType != 1) continue;
  934.         
  935.         currentFavorite=favoriteList[j];
  936.  
  937.         for (k=0; k < currentFavorite.childNodes.length; ++k)
  938.         {
  939.             if (currentFavorite.childNodes[k].nodeType != 1) continue;
  940.             
  941.             switch(currentFavorite.childNodes[k].nodeName)
  942.             {
  943.                 case 'ID':
  944.                     currentSiteID=currentFavorite.childNodes[k].firstChild.nodeValue;
  945.                     break;
  946.                 case 'SiteName':
  947.                     currentSiteName='<![CDATA[' + escape(currentFavorite.childNodes[k].firstChild.nodeValue)+ ']]>';
  948.                     break;
  949.                 case 'SiteURL':
  950.                     currentUrl='<![CDATA[' + doubleUrlEncode(currentFavorite.childNodes[k].firstChild.nodeValue)+ ']]>';;
  951.                     break;
  952.                 case 'SiteLinkLevel':
  953.                     currentSiteLinkLevel=currentFavorite.childNodes[k].firstChild.nodeValue;
  954.                     break;
  955.                 case 'ChannelID':
  956.                     currentChannelID=currentFavorite.childNodes[k].firstChild.nodeValue;
  957.                     break;
  958.                 case 'SubChannelID':
  959.                     currentSubChannelID=currentFavorite.childNodes[k].firstChild.nodeValue;
  960.                     break;
  961.                 case 'Size':
  962.                     currentSize=currentFavorite.childNodes[k].firstChild.nodeValue;
  963.                     break;
  964.                 case 'ImageCopyFlag':
  965.                     currentImageCopyFlag=currentFavorite.childNodes[k].firstChild.nodeValue;
  966.                     break;
  967.             }
  968.         }
  969.  
  970.         for (i=0; i < siteIDs.length; ++i)
  971.         {
  972.             if (currentSiteID == siteIDs[i])
  973.             {
  974.                 mySitesXmlString += '<Favorite>\n';
  975.                 mySitesXmlString += '<ID>' + currentSiteID + '</ID>\n';
  976.                 mySitesXmlString += '<SiteName>' + currentSiteName + '</SiteName>\n';
  977.                 mySitesXmlString += '<SiteURL>' + currentUrl + '</SiteURL>\n';
  978.                 mySitesXmlString += '<SiteLinkLevel>' + currentSiteLinkLevel + '</SiteLinkLevel>\n';
  979.                 mySitesXmlString += '<ChannelID>' + currentChannelID + '</ChannelID>\n';
  980.                 mySitesXmlString += '<SubChannelID>' + currentSubChannelID + '</SubChannelID>\n';
  981.                 mySitesXmlString += '<Size>' + currentSize + '</Size>\n';
  982.                 mySitesXmlString += '<ImageCopyFlag>' + currentImageCopyFlag + '</ImageCopyFlag>\n';
  983.                 mySitesXmlString += '</Favorite>\n';
  984.                 
  985.                 break;
  986.             }
  987.         }
  988.     }
  989.  
  990.     return mySitesXmlString;
  991. }
  992.  
  993. // Called from My Library and Device view
  994. function SendUpdateRequestToServer(subscriptionID)
  995. {
  996.     var subs = new Array();
  997.     subs.push(subscriptionID);
  998.     var xmlData = CreateSyncUpdateSubscriptionsXml(subs, false);
  999.     // Internally this also follows in sync request
  1000.     url = "/webaroo/e29f1fe6/update";
  1001.     sendXMLData(url, "XMLData=" + xmlData);
  1002.     
  1003.     //Need to display status
  1004.     status = GetOperationStatus(xmlContent);
  1005.     SetOperationStatus('libraryBanner', status);
  1006. }
  1007.  
  1008. function UpdateSelectedSubscriptions()
  1009. {
  1010.     // find all the subscription ids for which checkboxes are checked
  1011.     var selectedSubscriptions= new Array();
  1012.     QuerySelectedCheckboxes(selectedSubscriptions)
  1013.  
  1014.     if (selectedSubscriptions.length > 0)
  1015.     {
  1016.         var xmlData = CreateSyncUpdateSubscriptionsXml(selectedSubscriptions, false);
  1017.         url = "/webaroo/e29f1fe6/update";
  1018.         SendAsynchornousRequest(url, "XMLData=" + xmlData, SetReturnMessageStatus, "");
  1019.         ClearAllCheckboxes();
  1020.     }
  1021.     else
  1022.     {
  1023.         SetOperationStatus('libraryBanner', NoContentSelectedMessage);
  1024.     }
  1025. }
  1026.  
  1027. function AddSubscriptionsToDevice(deviceIndex, placeIDs, siteIDs)
  1028. {
  1029.     var status = "";
  1030.     var url;
  1031.     
  1032.     var cardName = EncodeValue(deviceNameList[deviceIndex]);
  1033.     var cardId = deviceList[deviceIndex];
  1034.     var cardType = storeTypeList[deviceIndex];
  1035.     var deviceType = deviceTypeList[deviceIndex];
  1036.  
  1037.     var copyXml = '<XmlData>\n';
  1038.     copyXml += '<storeID>' + cardId + '</storeID>\n';
  1039.     copyXml += '<CardName>' + cardName + '</CardName>\n';
  1040.     copyXml += '<CardType>' + cardType + '</CardType>\n';
  1041.     copyXml += '<DeviceType>' + deviceType + '</DeviceType>\n';
  1042.     copyXml += '<Response>\n';
  1043.     if (placeIDs.length > 0)
  1044.     {
  1045.         copyXml += CreateSubscriptionsXml(placeIDs, MyPlace);
  1046.     }
  1047.     if (siteIDs.length > 0)
  1048.     {
  1049.         copyXml += CreateSubscriptionsXml(siteIDs, MySite);
  1050.     }
  1051.     copyXml += '</Response>\n';
  1052.     copyXml += '</XmlData>\n';
  1053.     
  1054.     url = "/webaroo/e29f1fe6/savemysubs?request=add";
  1055.     SendAsynchornousRequest(url, "XMLData=" + copyXml, SetCopyToDeviceStatus, deviceIndex);
  1056.     // i18n issue
  1057.     status = "Processing copy request. Check progress on <a href=\"javascript:ShowStatusWindow()\">status window</a>.";
  1058.     return status;
  1059. }
  1060.  
  1061. function SetCopyToDeviceStatus(xmlStatus, deviceIndex)
  1062. {
  1063.     var status = GetOperationStatus(xmlStatus);
  1064.     SetOperationStatus('libraryBanner', status);
  1065.     // Check device storage is Webaroo Storage or not
  1066.     if((deviceIndex >= 0) && (storeTypeList.length > deviceIndex) && (deviceList[deviceIndex] == deviceConfigMessage) && (storeTypeList[deviceIndex]=="nowebaroo"))
  1067.     {
  1068.         ShowSynchornousLeftMenu();
  1069.     }
  1070. }
  1071.  
  1072. // Called from My Library view
  1073. function SendCopyRequestToServer(deviceIndex, subscriptionID)
  1074. {
  1075.     var status = "";
  1076.     
  1077.     if (deviceList[deviceIndex] != deviceConfigMessage)
  1078.     {
  1079.         var subscriptionType = FindSubscriptionTypeFromID(subscriptionID);
  1080.  
  1081.         if (subscriptionType != -1)
  1082.         {
  1083.             var placeIDs = new Array();
  1084.             var siteIDs = new Array();
  1085.             if (subscriptionType == MyPlace)
  1086.             {
  1087.                 placeIDs[0] = subscriptionID;
  1088.             }
  1089.             else
  1090.             {
  1091.                 siteIDs[0] = subscriptionID;
  1092.             }
  1093.             status = AddSubscriptionsToDevice(deviceIndex, placeIDs, siteIDs);
  1094.             
  1095.             SetOperationStatus('libraryBanner', status);
  1096.             
  1097.             // Check device storage is Webaroo Storage or not
  1098.             if(storeTypeList[deviceIndex]=="nowebaroo")
  1099.             {
  1100.                 deviceList[deviceIndex] = deviceConfigMessage;
  1101.             }
  1102.         }
  1103.         else
  1104.         {
  1105.             // TODO: handle error
  1106.         }
  1107.     }
  1108.     else
  1109.     {
  1110.         //i18n issue
  1111.         status = "Copy can't be started as device configuration is in progress.";
  1112.         SetOperationStatus('libraryBanner', status);
  1113.     }
  1114. }
  1115.  
  1116. // Called from My Library view
  1117. function CopySelectedSubscriptionsToDevice(deviceIndex)
  1118. {
  1119.     var status = "";
  1120.  
  1121.     if (deviceList[deviceIndex] != deviceConfigMessage)
  1122.     {
  1123.         var selected = 0;
  1124.         
  1125.         // find all the subscription ids for which checkboxes are checked
  1126.         var selectedPlaces = new Array();
  1127.         var selectedSites = new Array();
  1128.  
  1129.         QuerySelectedCheckboxesBasedOnType(MyPlace, selectedPlaces)
  1130.         QuerySelectedCheckboxesBasedOnType(MySite, selectedSites)
  1131.  
  1132.         if ((selectedPlaces.length > 0) || (selectedSites.length > 0))
  1133.         { 
  1134.             status = AddSubscriptionsToDevice(deviceIndex, selectedPlaces, selectedSites);
  1135.             selected = 1;
  1136.         }
  1137.         else
  1138.         {
  1139.             SetOperationStatus('libraryBanner', NoContentSelectedMessage);
  1140.         }
  1141.  
  1142.         if (selected == 1)
  1143.         {
  1144.             SetOperationStatus('libraryBanner', status);
  1145.             ClearAllCheckboxes();
  1146.  
  1147.             // Check device storage is Webaroo Storage or not
  1148.             if(storeTypeList[deviceIndex]=="nowebaroo")
  1149.             {
  1150.                 deviceList[deviceIndex] = deviceConfigMessage;
  1151.             }
  1152.         }
  1153.     }
  1154.     else
  1155.     {
  1156.         //i18n issue
  1157.         status = "Copy can't be started as device configuration is in progress.";
  1158.         SetOperationStatus('libraryBanner', status);
  1159.     }
  1160. }
  1161.  
  1162. function SetReturnMessageStatus(xmlStatus, deviceIndex)
  1163. {
  1164.     var status = GetOperationStatus(xmlStatus);
  1165.     SetOperationStatus('libraryBanner', status);
  1166. }
  1167.  
  1168. function ReturnMessageStatus(xmlStatus,deviceIndex)
  1169. {
  1170.     var status = GetOperationStatus(xmlStatus);
  1171.     if (deviceIndex == -1)
  1172.     {
  1173.         // CHANGE to delete table row
  1174.         ShowMyLibrary(0);  
  1175.         SetOperationStatus('libraryBanner', status);
  1176.     }
  1177.     else
  1178.     {
  1179.         // CHANGE to delete table row
  1180.         ShowDeviceInfo(0,deviceIndex);        
  1181.         SetOperationStatus('deviceBanner', status);
  1182.     }
  1183. }
  1184.         
  1185.