//script for compare functionality function doCount(el, elName){ var count = 0; var cBoxes = document.aspnetForm.elements[elName]; for (var i=0;i < cBoxes.length;i++){ if (cBoxes[i].checked) { count++; } } if (count > 5) { var alertMsg = "You may compare up to five items at a time.\n\nThe last selection will be ignored."; alert(alertMsg); el.checked = false; } } function doBaseCompare(url, alertMessage, elName) { var count = 0; var strVars = ""; var cBoxes = document.aspnetForm.elements[elName]; for (var i=0;i < cBoxes.length;i++){ if (cBoxes[i].checked) { count++; if (strVars != "") { strVars = strVars + "&"; } strVars = strVars + "id=" + cBoxes[i].value; } } if (count > 1) { window.location = url + strVars; } else { alert(alertMessage); } } // Does a comparison based on the product type. The only legal product type values are: // desktop, opteron, notebook, embedded, gpu, motherboard function doCompare(productType) { switch (productType) { case "desktop": doDesktopCPUCompare(); break; case "notebook": doNotebookCPUCompare(); break; case "opteron": doOpteronCPUCompare(); break; case "embedded": doEmbeddedCPUCompare(); break; case "motherboard": doMotherboardCompare(); break; case "gpu": doGraphicCardCompare(); break; case "workstationGpu": doWorkstationGraphicCardCompare(); break; case "mobilityGpu": doMobilityGPUCompare(); case "TVTuner": doTVTunerCompare(); default: break; } } function doDesktopCPUCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('DesktopCPUSideBySide.aspx?', alertMsg, 'chkOpnDesktop'); } function doNotebookCPUCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('NotebookCPUSideBySide.aspx?', alertMsg, 'chkOpnNotebook'); } function doOpteronCPUCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('OpteronCPUSideBySide.aspx?', alertMsg, 'chkOpnOpteron'); } function doEmbeddedCPUCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('EmbeddedCPUSideBySide.aspx?', alertMsg, 'chkOpnEmbedded'); } function doMotherboardCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('MotherboardSideBySide.aspx?', alertMsg, 'chkOpnMotherboard'); } function doGraphicCardCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('GraphicCardSideBySide.aspx?', alertMsg, 'chkOpnGraphicsCard'); } function doWorkstationGraphicCardCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('WorkstationGraphicCardSideBySide.aspx?', alertMsg, 'chkOpnWorkstationGraphicsCard'); } function doMobilityGPUCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('MobilityGPUSideBySide.aspx?', alertMsg, 'chkOpnMobilityGPU'); } function doTVTunerCompare(){ var alertMsg = "Please select two to five products to compare."; doBaseCompare('TVTunerSideBySide.aspx?', alertMsg, 'chkOpnTVTuner'); }