window.addEvent('domready', function() {
	        $$(".scent").setStyle('display', 'none');
	        
	        $$(".startover").addEvents({   
                'click': function() {
                    setToDefault();
		            
		            //reset the tab
		            $$(".choose").set('text', '');
			        //Inject the new DOM elements into the results div.
			        $$(".choose").set("html", "<span></span><strong>CHOOSE A COLLECTION</strong>");    
			        runsIFR("#9bc66c;");
		            setClass("fc");
		               
	            }

            });   
	        
	        $$(".collection").addEvents({   
                'click': function() {
                
                    var elements = "." + this.id + "scent";
                    var collectionName = "<span>Collection:</span><strong>FRAIS ET PROPRE</strong>";
                    var theme = "fc";
                    var themecolor = "#9bc66c;";

                    if(this.id == "je")
                    {
                        collectionName = "<span>Collection:</span><strong>EXPRESSIONS DE JOIE</strong>";
                        theme = "je";
                        themecolor = "#fe8c16;";
                    }
                    else if(this.id == "ss")
                    {
                        collectionName = "<span>Collection:</span><strong>SENSATIONS APAISANTES</strong>";
                        theme = "ss";
                        themecolor = "#dc9ac3;";
                       
                    }
                
                    $$(".choose").set('text', '');
			        //Inject the new DOM elements into the results div.
			        $$(".choose").set("html", collectionName);
			        
			        runsIFR(themecolor);                    		        
                    setClass(theme);
                    
		            $$(".collection").setStyle("display", "none");
		            $$(elements).setStyle("display", "");		           
	            }

            });   
            
            $$(".scent").addEvents({   
                'click': function() {                
                    var elements = "." + this.id + "scent";
                    var reviews = "." + this.id;
                    
                    $$(".fan-collections").setStyle("display", "none");                    		                       
                    $$(".fan-collect-view").addClass("fan-collect-view-wide"); 
                    $$(".DFLT").setStyle("display", "none");
                    
                    $$(reviews).setStyle("display", "inline");
                    $$(".error").setStyle("display", "block");
                    
                    var scentName = "<span>Parfum:</span><strong>Fraîcheur originale</strong>";
                    var theme = "fc";
                    var themecolor = "#9bc66c;";
                    
                    if(this.id == "of-he")
                    {
                        scentName = "<span>Parfum:</span><strong>Fraîcheur originale</strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    else if(this.id == "fa")
                    {
                        scentName = "<span>Parfum:</span><strong>Éveils frais</strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    else if(this.id == "if")
                    {
                        scentName = "<span>Scent:</span><strong>Fraîcheur des îles</strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    else if(this.id == "toscf")
                    {
                        scentName = "<span>Scent:</span><strong>Touch of Softness Cotton Fresh</strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    else if(this.id == "tossf")
                    {
                        scentName = "<span>Parfum:</span><strong>  Avec un soupçon de douceur Simplement frais </strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    else if(this.id == "bs")
                    {
                        scentName = "<span>Parfum:</span><strong>Gain avec bicarbonate de soude </strong>";
                        theme = "fc";
                        themecolor = "#9bc66c;";
                    }
                    
                    //je
                    else if(this.id == "amt")
                    {
                        scentName = "<span>Parfum:</span><strong>Tango pomme et mangue</strong>";
                        theme = "je";
                        themecolor = "#fe8c16;";
                    }
                    else if(this.id == "mlf")
                    {
                        scentName = "<span>Parfum:</span><strong>Fusion mandarine-lime</strong>";
                        theme = "je";
                        themecolor = "#fe8c16;";
                    }
                    //ss
                     else if(this.id == "llm")
                    {
                        scentName = "<span>Parfum:</span><strong>Douceur vanille et orchidée</strong>";
                        theme = "ss";
                        themecolor = "#dc9ac3;";
                    }
                    else if(this.id == "mlf")
                    {
                        scentName = "<span>Parfum:</span><strong>Fusion mandarine-lime</strong>";
                        theme = "ss";
                        themecolor = "#dc9ac3;";
                    }
                    
                     $$(".choose").set('text', '');
			        //Inject the new DOM elements into the results div.
			        $$(".choose").set("html", scentName);
			        
			        runsIFR(themecolor);                    		        
                    setClass(theme);   
                 
                    
                }

            });   
            
           setToDefault();
	        
       });
       
       function setClass(newClass){
           $$(".choose").removeClass("je");
           $$(".choose").removeClass("ss");
           $$(".choose").removeClass("fc");
           $$(".choose").addClass(newClass);
           
       }
       
       function setToDefault()
       {
       
            //show the collection navigation
		    $$(".collection").setStyle("display", "");
		            
		    //hide the scent navigation
		    $$(".scent").setStyle("display", "none");	
       
            $$(".fan-collections").setStyle("display", "inline"); 
            $$(".fan-collect-view").removeClass("fan-collect-view-wide"); 
            $$(".review").setStyle("display", "none");
		    $$(".DFLT").setStyle("display", "inline");
		    $$(".startover").setStyle("display", "inline");
		    
       }
       
       function runsIFR(color)
       {
            if(typeof sIFR == "function"){
                sIFR.replaceElement("#content div.fan-video-links p span", named({sFlashSrc: "/fr_CA/common/swf/tarzanawide.swf", sColor: "#999999", sWmode: "transparent"}));
	            sIFR.replaceElement("#content div.fan-video-links p.choose strong", named({sFlashSrc: "/fr_CA/common/swf/tarzanawide.swf", sColor: color}));
	            
            }	
       }
       


