/*******************************************************************************/
//"Public" Methods and Properties that are meant to be alterable:
/*******************************************************************************/
        
        var tabIndex = new Array();
        var blankContentPage = "TabbedContent/blank.htm"; 
        var perClick         = "PerClick";
        var allAtOnce        = "AllAtOnce";
        var howToLoadTabs    = allAtOnce; //tell us how we are loading our tabs

        var recAllTabs = new Array();  //added to record all the DIV ID's when page load (Vikram 08/03)        
        var subtabLoaded = false;
        var index = 0;

        /**************************************************************
            Method: trackTabNavigation
            Description: This method is called when the content of a tab is shown.
                         This method can figure out what to based on the information given.
            Parameters:
                         tabType - will be one of the following 
                                   "sub" = the tab shown was a sub navigation tab.
                                   "main" = the tab shown was a main tab.
                         tabParm - the parameter specified by the tab (if any) for navigation tracking
                         tabUrl  - the Url specified by the tab for navigation tracking
        *************************************************************/
        function trackTabNavigation(tabType, tabUrl)
        {
            //alert("tabType: " + tabType);
            //alert("tabParm: " + tabParm);
            //alert("tabUrl: " + tabUrl);
           
            var tabTrackingIFrame;
            //NOTE: we have two seperate iframes and two seperate Url parms.  
            //      This is because the calls to the main tab and the sub tab 
            //      may come in very close to each other and need time to process both requests.
            //      They can go to the same page, but we have two different IFrames so 
            //      that a main tab and a subtab call can happen "simultaneously".
            //      They could also have their own page.  In fact, each tab could have it's own URL.
            if (tabType == "main") 
            {
                 tabTrackingIFrame = document.getElementById("mainTabTrackingIFrame"); 
            }
            if (tabType = "sub")
            {
                tabTrackingIFrame = document.getElementById("subTabTrackingIFrame"); 
            }
            if (tabTrackingIFrame != null)
            {
                //alert("here");
                var theUrl = "";
                if (tabUrl != null && tabUrl != "")
                {                    
                    window.status = ""; //so the user doesn't see what is going on;
                    tabTrackingIFrame.src = tabUrl;
                }                      
            }
            
        }
        
        
        
/*******************************************************************************/
//"Private" Methods and Properties that most probably don't have to be altered:
/*******************************************************************************/
        
        var currentSubPaneStyle = 0;
        var currentSubTab = 0;
        var numSubTabsOnPage = 0; //keep track of how many subpanes we have on the page so that we can keep the IDs unique
        var subTabSeperator;
        var initialSubLoaded = false;
        var initialLoaded = false;
        
        function theTabContentType() {
          this.HTMLString = "html";
          this.URLPath = "url";
        }
        var tabContentType = new theTabContentType();
        //alert(tabContentType.HTMLString);
        
        if (howToLoadTabs != perClick) //we are going to need to tracking IFrames
        {
            window.onload = createTrackingIFrames;
        }
        
        function createTrackingIFrames()
        {
            // create a new iframe element, define it's properteis and give it the content
            var newDiv = document.createElement("div");
            newDiv.id = "tabTrackingIFrameDiv";
            newDiv.setAttribute("class", "tabsTrackingDiv"); //works in Mozilla
            newDiv.setAttribute("className", "tabsTrackingDiv"); //but in IE you have to do this  Instead of browser sniffing and doing an if/else, I find it easier just to call both statements, since it does no harm (IE ignores the "class" setting, and Mozilla will have both a "class" and "classname" attribute defined).
            
            var newIFrame = document.createElement("iframe");
            newIFrame.id ="mainTabTrackingIFrame";
            newIFrame.src = blankContentPage
            newIFrame.setAttribute("class", "tabsTrackingIFrame"); //works in Mozilla
            newIFrame.setAttribute("className", "tabsTrackingIFrame"); //but in IE you have to do this  Instead of browser sniffing and doing an if/else, I find it easier just to call both statements, since it does no harm (IE ignores the "class" setting, and Mozilla will have both a "class" and "classname" attribute defined). 
            newDiv.appendChild(newIFrame);        
             
            newIFrame = document.createElement("iframe");
            newIFrame.id ="subTabTrackingIFrame";
            newIFrame.src = blankContentPage
            newIFrame.setAttribute("class", "tabsTrackingIFrame"); //works in Mozilla
            newIFrame.setAttribute("className", "tabsTrackingIFrame"); //but in IE you have to do this  Instead of browser sniffing and doing an if/else, I find it easier just to call both statements, since it does no harm (IE ignores the "class" setting, and Mozilla will have both a "class" and "classname" attribute defined). 
            newDiv.appendChild(newIFrame); 
            
            document.body.appendChild(newDiv);
        }
        
                        
        function tabClicked(div, tabType)
        {                       
            var trackingUrl = "";
            if (howToLoadTabs != perClick) //we are going to use the tracking IFrames
            {
                //Get the tracking url
                var trackingUrlHolder = document.getElementById(div.id + "_trackingUrl"); 
                if (trackingUrlHolder != null)
                {                
                    trackingUrl = trackingUrlHolder.value;
                }
                        
                if (tabType == "main") //this is a main tab
                {
                    //NOTE: the following variable can be used to determine how we "clicked" the tab
                    //if (initialLoaded = true) //will be true when the pain/tab that was "clicked" was shown because the page first loaded - can be used when needing to know if this occured because the page loaded, or because the tab was actually clicked                
                    //see if we have an external method to deal with the tracking
                    if (this.trackTabNavigation != undefined)
                    {
                        //the method exists, so move on
                        trackTabNavigation(tabType, trackingUrl);
                    } 
                    
                }
                else //this is a subtab
                {
                    //NOTE: the following variable can be used to determine how we "clicked" the subtab
                    //if (initialSubLoaded = true) //will be true when the subpain/subtab that was "clicked" was shown because the parent tab was shown - can be used when needing to know if this occured because the parent tab was shown, or because the subtab was actually clicked            
                    if (this.trackTabNavigation != undefined)
                    {
                        //the method exists, so move on
                        trackTabNavigation(tabType, trackingUrl);
                    }               
                }  
            }    
        }        
        
        function changeStatusOver()
        {
            window.status = "";
        } 
        
        function doNothing()
        {
            changeStatusOver();
        }       
        
        function setId(id)
        {
          this.id = id;
        }
        
        
        //---------------------------------------------
        //Sub Tab Methods
        
        function subTabStrip()
        {
           this.subTabs = new Array();
           this.add = addSubTab;
           this.write = writeSubTabStrip;
        }
        
        function subTab(caption, content, contentType, trackingURL)
        {
          this.setId = setId;
          this.caption = caption;
          this.content = content;
          this.contentType = contentType;
          this.write = writeSubTab;
          this.writeContent = writeSubPane;  
          this.blankContent = blankContentPage;        
          this.trackingUrl = trackingURL;
        }
        
        function addSubTab(subTab)
        {
          numSubTabsOnPage += 1; //incriment the subtabs
          subTab.setId("subTab_" + this.subTabs.length + "_" + numSubTabsOnPage);
          this.subTabs[this.subTabs.length] = subTab;
        }
       
        function initiate()
        {
          var div = document.getElementById("subTab0");
          showSubPane(div);
          initialSubLoaded = true;
        }
        
        function showSubPane(div)
        {            
            if(currentSubTab != 0)
            {                
                 //currentTab.style.backgroundColor = "#00ffff";
                 currentSubTab.className = "subTabsInactive";                 
            }
            //div.style.backgroundColor = "#ccccff";         
            currentSubTab = div;
            currentSubTab.className = "subTabsActive"; //set the className
            if(currentSubPaneStyle != 0)
                currentSubPaneStyle.display = "none";
            var subPaneID = "subPn_" + div.id;
            var objSubPaneStyle = document.getElementById(subPaneID).style;
            objSubPaneStyle.display = "block";
            currentSubPaneStyle = objSubPaneStyle;
            tabClicked(div, "sub"); //handles anything we want when the tab is shown on initial load or on "navigation" click
            
            var iFrame = document.getElementById("iFrame_" + div.id);
            if (iFrame != null)
            {                
                //Uncomment this code and change the default IFrame source in writeMainPane() to blank.htm in order to load the IFrame on demand.
                if (howToLoadTabs == perClick) //load the source as it is clicked
                {
                    var iFrameSrcObj = document.getElementById("iFrame_src_" + div.id);
                    if (iFrameSrcObj != null)
                    {
                        if (iFrameSrcObj.value != undefined && iFrameSrcObj.value != null && iFrameSrcObj.value != "")
                        {               
                            //alert(iFrameSrcObj.value);
                            iFrame.src = iFrameSrcObj.value;                        
                        }
                    }
                }
                resizeIframe(iFrame.id, 0);
            }
            initialSubLoaded = false; //reset the flag telling us that this tab was loaded with the page load.
                        
        }
        
        function showHideSubPane(subPaneId)
        {
            var stringToCutOut = "subPn_";
            var divID = subPaneId.substring(stringToCutOut.length);
            var div = document.getElementById(divID);
            showSubPane(div);
        }

        // Added for selecting the Sub Tab  (Vikram 08/03)    
        function showPaneByUrl()  
        {
         var myTabID = GetTabId("tabContent");
         var divA ;
         var subPaneID;
         var trackingUrlHolder ;
         var trackingUrl;
         for(var i=0;i<recAllTabs.length;i++)  {
           trackingUrlHolder = document.getElementById(recAllTabs[i] + "_contentUrl"); 
           trackingUrl = trackingUrlHolder.value;
             if(trackingUrl.indexOf(myTabID) >= 0 ) { 
               
               subtabLoaded = true; 
               showHideSubPane("subPn_" + recAllTabs[i]);
               break;
            }
          }  
        }


        function writeSubPane()
        {          
            var theSubPaneHtml = "<div class='subPane' id='subPn_" + this.id + "'>";
            theSubPaneHtml += "<input type='hidden' id='subPaneForMainPane_X' value='subPn_" + this.id + "'>";            
            if (this.contentType == tabContentType.URLPath) //this is a URL that we need to load in the IFrames
            {
                theSubPaneHtml += "<input type='hidden' id='iFrame_src_" + this.id + "' value='" + this.content + "'>";
                var theIFrameSrc = this.content;
                if (howToLoadTabs == perClick) //load the source as it is clicked
                {
                    theIFrameSrc = this.blankContent    
                }
                theSubPaneHtml += "<IFRAME id='iFrame_" + this.id + "'  class='tabbedContentIFrame' FRAMEBORDER='0px' scrolling='no' src='" + theIFrameSrc + "'></IFRAME>";            
            }
            else
            {
                theSubPaneHtml += "    " + this.content + " ";
            } 
            theSubPaneHtml += "</div>";
            return theSubPaneHtml;            
        }
        
        function writeSubTab()
        {
           var defaultCssClass = "subTabsInactive";
           subTabSeperator = "<td align='center' class='PageText' valign='top' nowrap>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</td>"; //set this and it gets used later on - both in this method and in the writeSubTabStrip() method;
           
           //alert("this.id: " + this.id);
           if (this.id.indexOf("subTab_0_") > -1) //then we are on the first subtab within this subtabstrip
           {
                defaultCssClass = "subTabsActive";
           }          
           
           recAllTabs[index] = this.id;  // records all the DIV ID's (Vikram 08/03)
           index = index + 1; 

           var theSubTabHtml = "<td nowrap align='center' valign='top'>";
           theSubTabHtml += "<div class='" + defaultCssClass + "' id='" + this.id + "' onclick='showSubPane(this)'>";
           theSubTabHtml += "<input type='hidden' name='" + this.id + "_trackingUrl' value='" + this.trackingUrl + "'>";
           theSubTabHtml += "<input type='hidden' name='" + this.id + "_contentUrl' id='" + this.id + "_contentUrl' value='" + this.content + "'>";
           theSubTabHtml += "<a href='javascript:doNothing();' onMouseOver='changeStatusOver();' id='" + this.id + "' class='subTabTitle'>";        
           theSubTabHtml += this.caption; 
           theSubTabHtml += "</a>";          
           theSubTabHtml += "</div>";
           theSubTabHtml += "</td>";
           theSubTabHtml += subTabSeperator;
           return theSubTabHtml
        }
        
        
        function writeSubTabStrip()
        {
            var theSubTabStripHtml = "<table id='spacertable' cellpadding='0' cellspacing='0' border='0'><tr><td colspan='2'></td></tr><tr><td width='12px' nowrap></td><td>"; //this is a "spacer table" and cell so that the subtab doesn't start all the way to the left
            theSubTabStripHtml += "<table cellpadding='0' cellspacing='0' border='0' class='subTabsTitleTable'><tr>";
            var tempHeader = "";
            
            for(var i = 0; i < this.subTabs.length; i++)
            {
                tempHeader = this.subTabs[i].write();
                if (i == this.subTabs.length - 1) //we are on the last one so get rid of the last seperator
                {
                   tempHeader = xReplace(tempHeader, subTabSeperator, "");
                }
                theSubTabStripHtml += tempHeader; //theSubTabStripHtml += this.subTabs[i].write();
                
            }
            theSubTabStripHtml += "</tr></table>";
            theSubTabStripHtml += "</td></tr></table>"; //close the spacer table
            theSubTabStripHtml += "<table width='100%' cellpadding='0' cellspacing='0'><tr><td height='12' background='/webdocuments/product_details_sub-tab_div.gif'><img src='/webdocuments/spacer.gif' height='12' border='0'></td></tr></table>";
            for(var k = 0; k < this.subTabs.length; k++)
            {
                //alert(this.subTabs[k].writeContent());
                theSubTabStripHtml += this.subTabs[k].writeContent();
            }
            return theSubTabStripHtml;
            
        }
        
        
       
        //---------------------------------------------
        //Main Tab Methods
        
           
        var currentPaneStyle = 0;
        var currentTab = 0;
        
        function tabstrip()
        {
           this.tabs = new Array();
           this.add = addTab;
           this.write = writeTabstrip;
        }
        
        function tab(caption, content, contentType, trackingURL)
        {
          this.setId = setId;
          this.caption = caption;
          this.content = content;
          this.contentType = contentType;
          this.write = writeTab;
          this.writeContent = writeMainPane;
          this.blankContent = blankContentPage;
          this.trackingUrl = trackingURL; 
        }
               
        function addTab(tab)
        {
          tab.setId("tab" + this.tabs.length);
          this.tabs[this.tabs.length] = tab;
        }
        
        function initiate()
        {
          var div = document.getElementById("tab0");
          showPane(div);
        }
        function showPane(div)
        {
            if(currentTab != 0)
            {                
                 //currentTab.style.backgroundColor = "#00ffff";
                 currentTab.className = "tabsInactive";                 
            }
            //div.style.backgroundColor = "#ccccff";         
            //TODO: depending on the div.id (aka tab #), swap out the document.getElementById("pnlTblContentTop_" + div.id).style.backgroundImage accordingly
            currentTab = div;
            currentTab.className = "tabsActive"; //set the className
            if(currentPaneStyle != 0)
                currentPaneStyle.display = "none";
            var paneId = "pn_" + div.id;
            var objPaneStyle = document.getElementById(paneId).style;
            objPaneStyle.display = "block";
            currentPaneStyle = objPaneStyle;
            tabClicked(div, "main") //handles anything we want when the tab is shown on initial load or on "navigation" click
            
            //alert("set the iFrame_subTab_0_1 = iFrame_" + divID);
            var iFrame = document.getElementById("iFrame_" + div.id);
            if (iFrame != null)
            {
                //alert("iFrame = " + iFrame);
                //alert("iFrame.document.body.scrollHeight = " + iFrame.document.body.scrollHeight);
                //Uncomment this code and change the default IFrame source in writeMainPane() to blank.htm in order to load the IFrame on demand.
                if (howToLoadTabs == perClick) //load the source as it is clicked
                {
                    var iFrameSrcObj = document.getElementById("iFrame_src_" + div.id);
                    if (iFrameSrcObj != null)
                    {
                        if (iFrameSrcObj.value != undefined && iFrameSrcObj.value != null && iFrameSrcObj.value != "")
                        {               
                            //alert(iFrameSrcObj.value);
                            iFrame.src = iFrameSrcObj.value;                            
                        }
                    }
                }
                resizeIframe(iFrame.id, 0);
            }
            
            //alert("here we need to figure out if we have any subTabs and if so, show the first one as active");
            var subPaneIdHolder = document.getElementById("subPaneForMainPane_" + div.id);
            if (subPaneIdHolder != null)
            {
                //showHideSubPane(subPaneIdHolder.value);
                showHideSubPane(subPaneIdHolder.value);
                //if(subtabLoaded) { 
                   //alert(subtabLoaded);
                //   showHideSubPane(subPaneIdHolder.value);               
                //}
                //else {
                // showPaneByUrl();
                //}
            }  
            initialLoaded = false; //resets the flag telling us that this tab was loaded.         
        }
        
                
        function writeMainPane()
        {          
            //alert(this.paneType);
            //alert(this.trackingParm);
            
            var pageSource = "/TabbedContent/overview.htm";
            
            document.write("<div class='pane' id='pn_" + this.id + "'>");
            document.write("<table border='0' cellspacing='0' cellpadding='0' class='tabsContentTables'>");    
            document.write("    <tr>");
            document.write("        <td id='pnlTblContentTop_" + this.id + "1' width='1' bgcolor='#CCCCCC'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='6'></td>");
            document.write("        <td id='pnlTblContentTop_" + this.id + "' width='*' style='background-image: url(/webdocuments/product_details_middle_middle.gif);background-repeat:repeat-x;'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='6'></td>");
            document.write("        <td id='pnlTblContentTop_" + this.id + "' width='5' style='background-image: url(/webdocuments/product_details_middle_corner_rt.gif);background-repeat:none;'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='6'></td>");
            document.write("    </tr>");
            document.write("</table>");
            document.write("<table border='0' cellspacing='0' cellpadding='0' class='tabsContentTables'>");
            document.write("    <tr>");
            document.write("        <td width='1' bgcolor='#CCCCCC'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='1' /></td>");
            document.write("        <td class='tabContentCell'>");
            if (this.contentType == tabContentType.URLPath)
            {
                document.write("             <input type='hidden' id='iFrame_src_" + this.id + "' value='" + this.content + "'>");
                var theIFrameSrc = this.content;
                if (howToLoadTabs == perClick) //load the source as it is clicked
                {
                    theIFrameSrc = this.blankContent    
                }
                document.write("             <IFRAME id='iFrame_" + this.id + "' class='tabbedContentIFrame' FRAMEBORDER='0px' scrolling='no' src='" + theIFrameSrc + "'></IFRAME>");                             
            }
            else
            {
                document.write("            " + xReplace(this.content, "subPaneForMainPane_X", "subPaneForMainPane_" + this.id) + " "); //The content gets written out here
                //document.write("            " + this.content + " "); //The content gets written out here
            }            
            document.write("        </td>");
            document.write("        <td width='1' bgcolor='#CCCCCC'>");
            document.write("                <img src='/webdocuments/spacer.gif' width='1' height='1'></td>");
            document.write("    </tr>");
            document.write("</table>");
            document.write("<table border='0' cellspacing='0' cellpadding='0' class='tabsContentTables'>");
            document.write("    <tr>");
            document.write("        <td height='8' width='5' style='background-image: url(/webdocuments/product_details_bottom_corner_lft.gif);background-repeat:none;'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='1'></td>");
            document.write("        <td height='8' width='*' style='background-image: url(/webdocuments/product_details_bottom_middle.gif);background-repeat:repeat-x;'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='1'></td>");
            document.write("        <td height='8' width='5' style='background-image: url(/webdocuments/product_details_bottom_corner_rt.gif);background-repeat:none;'>");
            document.write("            <img src='/webdocuments/spacer.gif' width='1' height='1'></td>");
            document.write("    </tr>");
            document.write("</table>");
            document.write("</div>");
        }
        function writeTab()
        {
           document.write("<td valign=\"top\"><div class=\"tabContainer\"><div class='tabsInactive' id='" + this.id + "' onclick='showPane(this)'><input type='hidden' name='" + this.id + "_trackingUrl' value='" + this.trackingUrl + "'>" + this.caption + "</div></div></td>");
        }
     
        function writeTabstrip()
        {
            document.write("<table cellpadding='0' cellspacing='0' border='0' class='tabsTitleTable'><tr>");
            for(var i = 0; i < this.tabs.length; i++)
            {
                this.tabs[i].write();
            }
            document.write("</tr></table>");
            for(var k = 0; k < this.tabs.length; k++)
            {
                this.tabs[k].writeContent();
            }
            
            initiate();
        }
        
        
        
        function xReplace(checkMe,toBeRep,repWith){
            var temp = checkMe;
            var i = temp.indexOf(toBeRep);
            //alert("here in replace, toBeRep: " + toBeRep);
            //alert("conent: " + checkMe);
            while(i > -1)
            {
                 temp = temp.replace(toBeRep, repWith);
                 i = temp.indexOf(toBeRep, i + repWith.length + 1);
            }
            return temp;
        }
        
        //This function will try to resize the content in the iFrame n times. 
        //It waits x number of milliseconds before calling itself again to give the content in the IFrame time to load.  
        //If it fails after n times it will just leave the content at the default height as specified in this function.
        function resizeIframe(id, numTimes) 
        {
          var errorString = "";
          var resizeHeight = 0;
          var fudgeFactor = 20 //I found Netscape needs no fudge, IE needs 4 and Opera needs 5... 
          var defaultHeight = 1600;
          //alert("here in resizeIframe numTimes = " + numTimes);
          if (numTimes*1 < 5) //to prevent an endless loop
          {
              try 
              {
                 frame = document.getElementById(id);
                 
                 // Get the document within the frame. This is where you will fail with 'permission denied'
                 // if the document within the frame is not from the same domain as this document.
                 // Note: IE uses 'contentWindow', Opera uses 'contentDocument', Netscape uses either.
                 innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
                 
                 // Resize the style object, if it exists. Otherwise, resize the frame itself.
                 objToResize = (frame.style) ? frame.style : frame;
                 
                 // Resize the object to the scroll height of the inner document body. You may still have 
                 // to add a 'fudge' factor to get rid of the scroll bar entirely. With a plain-vanilla 
                 // iframe, I found Netscape needs no fudge, IE needs 4 and Opera needs 5... 
                 // Of course, your mileage may vary.
                 resizeHeight = innerDoc.body.scrollHeight + fudgeFactor;
                 objToResize.height = resizeHeight + "px";
                 //alert("resizeHeight = " + resizeHeight);
              }
              catch (e) 
              {
                 errorString = e.message;
                 try
                 {
                    objToResize.height = defaultHeight + "px"; //set to default height right away
                 }
                 catch(e2)
                 {
                        resizeHeight = 0;
                 }
              }
              if (resizeHeight*1 < 250 && numTimes < 2) //probably have an issue, so throw an error
              {
                resizeHeight = 0;
              }
              if (errorString == "Object required" || resizeHeight*1 == 0 || resizeHeight*1 <= fudgeFactor*1)
              {
                //alert("here in error");
                //alert("errorString = " + errorString);
                //alert("resizeHeight = " + resizeHeight);
                //our IFrame content page may have not loaded yet, so wait a second and try again
                window.setTimeout('resizeIframe(\''+id+'\','+numTimes+1+')',5000);
                //window.setTimeout("resizeIframe("+ id + "," + numTimes+1 +")",1000);
                //resizeIframe(id, numTimes+1)                
              }
          }          
          else
          {
            //alert("done and never resized correctly");                
          }
        }
 
// Added by Rudi for showing proper tab onload
                    /// <summary>
                    /// ShowTabOnLoad Determines if a tabid was passed in and if so, it will show it.
                    /// This passed-in parameter will be the word "tab" with the zero-based tab index appended.
                    /// The tabid is zero based and will look something like the following:
                    ///       If we wanted to show the third tab, we would need to pass in the second index (zero-based):
                    ///       product_details.htm?mainTab=tab2
                    /// </summary>
                    function ShowTabOnLoad()
                    {
                        var myTabID = GetTabId("tabContent");
                        if (myTabID != "")
                        {
                            var myTabIndex = "";
                            for(var x=0;x<tabIndex.length;x++)
                            {
                                strTemp = new String(tabIndex[x]);
                                if (strTemp.indexOf(myTabID) >= 0)
                                {
                                    myTabIndex = "tab" + x;
                                } 
                            }
                            if (myTabIndex != "")
                            {
                                var mainDiv = document.getElementById(myTabIndex);
                                if (mainDiv != undefined && mainDiv != null)
                                {
                                    showPane(mainDiv);
                                    showPaneByUrl();                               
                                } 
                            }
                        }   
                    }
                    
                    /// <summary>
                    /// GetTabId returns the value for the querystring parameter that is passed in
                    /// </summary>
                    /// <param name="?">The name of the querystring parm to find</param>
                    function GetTabId(pRequestParm)
                    {
                        var myURL = self.parent.document.location + "";
                        var myTabID = "";
                        //alert(myURL);
                        //alert(myURL.indexOf("?"));
                        var aQsParm = pRequestParm + "=";
                        var pos1 = myURL.indexOf(aQsParm);
                        if (pos1 > -1)
                        {
                            //alert(myURL);
                            pos1 += aQsParm.length;
                            myTabID = myURL.substr(pos1);
                            //see if we have other querystring parms in our parsed querystring parm
                            //alert(myTab);
                            pos1 = myTabID.indexOf("&")
                            if (pos1 > -1)
                            {                
                                myTabID = myTabID.substr(0, pos1);
                            }                            
                        }
                        return myTabID;
                    }