﻿function SetLogin(objClient)
        {
            document.getElementById(objClient).value = 1;
             
        }
        //Added by Arunachalam. K - workspace code
        var httpRequest = false;
        function AddtoWorkspaceCommon(contentElementId, groupType,sWebMetricsParams,sWebMetricsParamValues,sWebMetricsURL,prodOrFamilyID,entityName,contentElementCaption,groupId,groupName)
        {
             var currentTime = new Date();
             var browserUrl = window.location.href
             browserUrl = browserUrl.substring(0, browserUrl.toUpperCase().indexOf("MANUFACTURER")) + "Webpages/AddToWorkspace.aspx";
             var detailUrl = browserUrl + '?celId=' + contentElementId + '&groupType=' + groupType + '&pfid=' + prodOrFamilyID + '&entityName=' + entityName + '&celName=' + contentElementCaption + '&groupId=' + groupId + '&groupName=' + groupName + '&currentTime=' + currentTime
              httpRequest = false;
              
               
             //ADDED BY UJJWALA FOR WEBMETRICS DATED 24-JUL-2008
             if(sWebMetricsURL!=undefined)
                {
                    if (sWebMetricsURL != "") {
                        if (sWebMetricsParams.indexOf("|") != -1)
                            InsertWebMetricsDataCommon(sWebMetricsParams, sWebMetricsParamValues, sWebMetricsURL, '|')
                        else
                            InsertWebMetricsDataCommon(sWebMetricsParams, sWebMetricsParamValues, sWebMetricsURL, '')
                    }
                }
                //END
              
              if (window.XMLHttpRequest) { // Mozilla, Safari,...
                 httpRequest = new XMLHttpRequest();
                 if (httpRequest.overrideMimeType) {
         	        // set type accordingly to anticipated content type
                    httpRequest.overrideMimeType('text/html');
                 }
              } else if (window.ActiveXObject) { // IE
                 try {
                    httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                 } catch (e) {
                    try {
                       httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) {}
                 }
              }
              if (!httpRequest) {
                 alert('Cannot create XMLHTTP instance');
                 return false;
              }
	        
              httpRequest.onreadystatechange = handleAddToWorkspaceResponse_CPRT;
              httpRequest.open('GET', detailUrl, true);
              httpRequest.send(null);
        }
        //Added by Arunachalam. K - Handles the refresh response and redraws
        function handleAddToWorkspaceResponse_CPRT()
        {
            if(httpRequest.readyState==4)
            {
                if(httpRequest.responseText.indexOf("GuestUser")!=-1) alert("Please login to perform this operation.")
                else if(httpRequest.responseText.indexOf("PNW_0006")!=-1)
                {
	                __doPostBack('ctl00_upWS',"loadWS")
	                alert("Content Element saved to your workspace.")
                }
                else if(httpRequest.responseText.indexOf("PNW_0005")!=-1) alert("Maximum number of Elements already added for the user.")
                else if(httpRequest.responseText.indexOf("PNW_0004")!=-1) alert("This Content Element already added for the user.")
                else alert("Unable to add the element.")
            }
        }
        //Added by Arunachalam. K - Remove ContentElement
        function RemoveContent(contentElementId)
        {
            var currentTime = new Date();
            var param = contentElementId
            __doPostBack('ctl00_upWS',param)
        }
        
        //Code ends.