        function SwitchColor(target) 
        {

            switch (target) {

                case 'granite':
                    //
                    choosecolorhlgranite.addClassName('active');
                    choosecolorhlwood.removeClassName('active');
                    choosecolorhlsoapstone.removeClassName('active');
                    //                    
                    showhidecolorstone.show();
                    showhidecolorwood.hide();
                    showhidecolorsoapstone.hide();
                    //                    
                    chooseedgehlgranite.addClassName('active');
                    chooseedgehlwood.removeClassName('active');
                    chooseedgehlsoapstone.removeClassName('active');
                    //                    
                    showhideedgestone.show();
                    showhideedgewood.hide();
                    showhideedgesoapstone.hide();
                    break;
                case 'wood':
                    //
                    choosecolorhlgranite.removeClassName('active');
                    choosecolorhlwood.addClassName('active');
                    choosecolorhlsoapstone.removeClassName('active');
                    //                    
                    showhidecolorstone.hide();
                    showhidecolorwood.show();
                    showhidecolorsoapstone.hide();
                    //
                    chooseedgehlgranite.removeClassName('active');
                    chooseedgehlwood.addClassName('active');
                    chooseedgehlsoapstone.removeClassName('active');
                    //                    
                    showhideedgestone.hide();
                    showhideedgewood.show();
                    showhideedgesoapstone.hide();
                    break;
                case 'soapstone':
                    //
                    choosecolorhlgranite.removeClassName('active');
                    choosecolorhlwood.removeClassName('active');
                    choosecolorhlsoapstone.addClassName('active');
                    //                    
                    showhidecolorstone.hide();
                    showhidecolorwood.hide();
                    showhidecolorsoapstone.show();
                    //
                    chooseedgehlgranite.removeClassName('active');
                    chooseedgehlwood.removeClassName('active');
                    chooseedgehlsoapstone.addClassName('active');
                    //                    
                    showhideedgestone.hide();
                    showhideedgewood.hide();
                    showhideedgesoapstone.show();                
                    break;            
            }
        
        }
    
        function RunSetPage()
        {
            setTimeout("SetPage()",1000);

        }

        function SetPage()
        {
            
            var tab = Cookie.get('tab');
            if (tab != null){
                SwitchColor(tab);
            }
            
            var scroll1Stored = Cookie.get('scroll1');
            if (scroll1Stored != null){
                scroll1.scrollLeft = scroll1Stored;
            }
            
            var scroll2Stored = Cookie.get('scroll2');
            if (scroll2Stored != null){
                scroll2.scrollLeft = scroll2Stored;
            }
        }

        function SetColor(current, hfid) { 
            for (i = 0; i < document.forms[0].elements.length; i++) { 
                elm = document.forms[0].elements[i];
                if (elm.type == 'radio') {
                    if ((elm.name.indexOf('rptColorStone') > -1) ||
                        (elm.name.indexOf('rptColorWood') > -1) || 
                        (elm.name.indexOf('rptColorStoneSoap') > -1) ) {
                        if (elm != current) { 
                            elm.checked = false; 
                        } 
                    }
                } 
            } 
            current.checked = true; 
            
            var hf = $(hfid).value.split('@');
            if (hf !=null)
            {
                countertopimage.writeAttribute('src','uploads/images/'+ hf[1] +'');
                backsplashimage.writeAttribute('src','uploads/images/'+ hf[1] +'');
                countertopimagename.update(hf[2]);
                backsplashimagename.update(hf[2]);
                hfcolorid.value = hf[0]; 
        
                Cookie.set('tab', hf[4], 24);
                Cookie.set('scroll1', scroll1.scrollLeft, 24);
                Cookie.set('colorid',hf[0], 24);

            }
        } 
        function SetEdge(current, hfid) { 
            for (i = 0; i < document.forms[0].elements.length; i++) { 
                elm = document.forms[0].elements[i]; 
                if (elm.type == 'radio') {
                    if ((elm.name.indexOf('rptEdgeStone') > -1) ||
                        (elm.name.indexOf('rptEdgeWood') > -1) ||
                        (elm.name.indexOf('rptEdgeStoneSoap') > -1)) {
                        if (elm != current) { 
                            elm.checked = false; 
                        } 
                    }
                } 
            } 
            current.checked = true;
            var hf = $(hfid).value.split('@');
            if (hf !=null)
            {
                edgeimage.writeAttribute('src','uploads/images/'+ hf[1] +'');
                edgeimagename.update(hf[3]);
                hfedgeid.value = hf[0];

                Cookie.set('scroll2', scroll2.scrollLeft, 24);
                Cookie.set('edgeid', hf[0], 24);
            }
        }    

