        // object will be the Providers Account Number, Group Name and Practitioner 
        // separated by a pipe  ie. 12345|Tom Smith Group|Dr Frank Jones

//Grab the "product" value from the s_code.js and put it here into the _SCproduct variable
var _SCproduct = product;

		/* Initialize the "s" properties.  You may give each page an identifying name, server, and channel on the next lines. */
        SC_ClearEvents();
        //var g_QueryString = new QueryString_Object(); // in case we are dealing with a QueryString


        /* PUBLIC FUNCTIONS*/
        function SC_logSearch_FindByZipCode(zipCode, radius) {
            SC_logSearch_Generic(zipCode, radius);
        }

        function SC_logSearch_FindByCityState(city, state) {
            SC_logSearch_Generic(null, null, city, state);
        }

        function SC_logSearch_FindByDrName(firstName) {
            SC_logSearch_Generic(null, null, null, null, firstName);
        }


        function SC_logDisplayPractitioners(accountNumber, displayName, practitionerName, product) 
        {
            var s = null;
            product = product.toLowerCase();
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar27 = accountNumber;
            s.eVar22 = displayname;
            s.eVar25 = practitionerName;
            s.eVar1 = product;
            s.eVar28 = accountNumber;
            s.events = "event27";
            s.t();
        }

        function SC_logBioDetail(accountNumber, displayName) {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar1 = _SCproduct;
            s.eVar22 = displayName;
            s.eVar28 = accountNumber;
            s.events = "event24";
            s.t();
        }

        function SC_logTelephone(accountNumber, product, telephone) {
            var s = null;
            product = product.toLowerCase();
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar1 = product;
            s.eVar26 = telephone;
            s.eVar28 = accountNumber;
            s.events = "event22";
            s.t();
        }

        function SC_logEmailSubmitted(accountNumber, displayName, product, email) {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            product = product.toLowerCase();
            s.eVar1 = product;
            s.eVar24 = email;
            s.eVar25 = displayName;
            s.eVar28 = accountNumber;
            s.events = "event29";
            s.t();
        }

        function SC_logConsultationSubmitted(accountNumber, displayName, product) {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            if (!product) product = "";
            product = product.toLowerCase();
            s.eVar1 = product;
            s.eVar27 = accountNumber;
            s.eVar25 = displayName;
            s.eVar28 = accountNumber;
            s.events = "event31";
            s.t();
        }

        function SC_logDirectionsSubmitted(accountNumber, displayName, product) {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            if (!product) product = "";
            product = product.toLowerCase();
            s.eVar1 = product;
            s.eVar25 = DisplayName;
            s.eVar28 = accountNumber;
            s.events = "event30";
            s.t();
        }
        function SC_logNewSearch() {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar1 = _SCproduct;
            s.events = "event33";
            s.t();
        }

        function SC_logDrWebSite(accountNumber, displayName, product, webSite) {
            var s = null;
            if (!product) product = "";
            product = product.toLowerCase();
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar22 = displayName;
            s.eVar1 = product;
            s.eVar23 = webSite;
            s.eVar28 = accountNumber;
            s.events = "event25";
            s.t();
        }

        function SC_logWebPage() {
            var s = null;
            s = s_gi(s_account);
            SC_ClearEvents();
            s.eVar1 = _SCproduct;
            s.events = "event32";
            //alert(s.eVar23);
            s.t();
        }

        function SC_logSearchPanelLoad() {
            s.eVar1 = _SCproduct;
            s.events = "event32";
            s.t();
        }

        function SC_logDocListPanelLoad(accounts, accountsPerPage) {
            s.eVar1 = _SCproduct;
            s.eVar34 = accountsPerPage;
            s.events = "prodView,event28";
            s.products = SC_formatAccountNumbers(accounts, _SCproduct);
            s.t();
        }






        /* INTERNAL FUNCTIONS*/

        function SC_formatAccountNumbers(accounts, product) {
            var formattedAccounts = "";
            var isFirst = true;
            for (var i = 0; i < accounts.length; i++) {
                var divider = ",";
                if (isFirst) {
                    divider = "";
                    isFirst = false;
                }
                formattedAccounts += format("{0}{1};{2};;", divider, product, accounts[i]);
            }
            return formattedAccounts;
        }
        
        function SC_logSearch_Generic(zipCode, radius, city, state, firstName, lastName) {
            var s = s_gi(s_account);
            SC_ClearEvents(); //?????


            if (!SC_isNullOrBlank(city)) {
                s.prop2 = city;
            }
            if (!SC_isNullOrBlank(zipCode)) {
                s.prop3 = zipCode;
            }
            if (!SC_isNullOrBlank(state)) {
                s.prop4 = state;
            }
            if (!SC_isNullOrBlank(radius)) {
                s.prop6 = radius;
            }
            if ((!SC_isNullOrBlank(firstName)) && (!SC_isNullOrBlank(lastName))) {
                s.prop5 = firstName + ' ' + lastName;
            }
            else if ((!SC_isNullOrBlank(firstName)) && (SC_isNullOrBlank(lastName))) {
                s.prop5 = firstName;
            }
            else if ((SC_isNullOrBlank(firstName)) && (!SC_isNullOrBlank(lastName))) {
                s.prop5 = lastName;
            }

            
            
            s.prop1 = s.prop2 + "|" + s.prop3 + "|" + s.prop4 + "|" + s.prop6 + "|" + firstName + "|" + lastName;
            s.state = ""
            s.zip = ""
            s.eVar22 = s.prop5;
            s.eVar29 = s.prop3;
            s.eVar30 = s.prop6;
            s.eVar31 = s.prop2;
            s.eVar32 = s.prop4;
            s.eVar33 = "";
            s.events = "event20"
            s.products = ""
            s.purchaseID = ""
            s.t();
        }

        function SC_isNullOrBlank(testValue) {
            var rtnValue = false;
            if (testValue == null) { rtnValue = true; }
            if (testValue == '') { rtnValue = true; }
            return rtnValue;
        }

        function SC_ClearEvents() {

            s.pageName = document.location.href.substring(document.location.href.lastIndexOf('/') + 1,
			    document.location.href.length).split('.')[0].split('#')[0]; //<--   This Variable will change on each page and should equal the html file name. 
            s.server = "";
            s.channel = "";
            s.pageType = "";
            s.events = "";
            s.products = "";
            s.purchaseID = "";
            s.eVar1 = "";
            s.eVar22 = "";
            s.eVar23 = "";
            s.eVar24 = "";
            s.eVar25 = "";
            s.eVar26 = "";
            s.eVar27 = "";
            s.eVar28 = "";
            s.eVar29 = "";
            s.eVar30 = "";
            s.eVar31 = "";
            s.eVar32 = "";
            s.eVar33 = "";
            s.eVar34 = "";
            s.state = "";
            s.zip = "";
            s.prop1 = "";
            s.prop2 = "";
            s.prop3 = "";
            s.prop4 = "";
            s.prop5 = "";
            s.prop6 = "";
        }































 







        function QueryString_Object(URL)
        {
            if(!URL){URL = location.href;} // If no argument, use the document URL
            this.raw = URL.substring(URL.indexOf('?')+1,URL.length); // Grab and store QueryString after the "?"
            this.Name = Array();
            this.Value = Array();
            QueryString_Object.prototype.Get = QueryString_Object_Get;
        	
            var args = this.raw.split('&'); // Parse out the parameters separated by "&"
        	
            for (var i=0;i<args.length;i++)
            { // Split out and store each name/value pair
	            var pair = args[i].split('=');
        	
	            temp = unescape(pair[0]).split('+'); // Fix broken unescaping
	            temp0 = temp.join(' ');
        		
	            temp = unescape(pair[1]).split('+');
	            temp1 = temp.join(' ');
        		
	            this.Name[i] = temp0;
	            this.Value[i] = temp1;
            }
        }

        function QueryString_Object_Get(what)
        {                                        // Get the value based on the parameter name
            for (var i=0;i<this.Name.length;i++)
            {
                if(this.Name[i] == what)
                {
                    return this.Value[i];
                }
            }
            return false; // return false if parameter doesn't exist
        }	
        

        function launchWindow(url, object)
        {                
            window.open(url + '?url=' + object.href);
        }
        




