function init(){
    //flag that init has fired
    if(initFired){
        return;
    } else {
        initFired = true;
    }
        
    /* Start Tabbed Area Support */
    //read cookie for tab state and test sessionID against current sessionID
    var currentTab = '0';
    var c_name='homePageTab=';
    var c_start=document.cookie.indexOf(c_name);
    if (c_start!=-1){
        c_start=c_start + c_name.length;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        var tabAndID = document.cookie.substring(c_start,c_end).split(',');
        if (tabAndID[0]==sessionID){
            currentTab = tabAndID[1];
            $('research-compare-tabs').setStyle({backgroundPosition:'0px ' + (currentTab * -39) + 'px'});
        }
    }
    
    // Build Tabber
    var tabber = new TabMaster("research-compare-tabs", "research-compare-content");
    if (currentTab=='0'){
        $('cpo-ad').update(cpoAd);
        tabber.addTab(new Tab(tabber, "Research Cars", "research-center").render().activate());
    } else {
        tabber.addTab(new Tab(tabber, "Research Cars", "research-center").render().deactivate());
    }
    if (currentTab=='1'){
        tabber.addTab(new Tab(tabber, "Reviews & Top Picks", "reviews-top-picks").render().activate());
    } else {
        tabber.addTab(new Tab(tabber, "Reviews & Top Picks", "reviews-top-picks").render().deactivate());
    }
    if (currentTab=='2'){
        $('new-car-paid-sponsor').update(newCarAd);
        tabber.addTab(new Tab(tabber, "New Car Info", "new-car-center").render().activate());
        resetMakeModelYear(); //in newCarSelection.js to reset the new car info form w a back button init. 
    } else {
        tabber.addTab(new Tab(tabber, "New Car Info", "new-car-center").render().deactivate());
    }
    if (currentTab=='3'){
        tabber.addTab(new Tab(tabber, "Buying Tools", "buying-tools").render().activate());
    } else {
        tabber.addTab(new Tab(tabber, "Buying Tools", "buying-tools").render().deactivate());
    }
    
    // each tab needs to change the class of the parent UL ~ All this to accomodate shadows on the tabs.
    $('research-compare-tabs').childElements().each(function(s, index) {
        var Binder = {
          _bind: function(event) {
            var spritePos = index * -39;
            $('research-compare-tabs').setStyle({backgroundPosition:'0px ' + spritePos + 'px'});
            //record session and tab for return tab preselect
            var exdate=new Date();
            exdate.setDate(exdate.getDate()+30);
            document.cookie="homePageTab=" + sessionID + "," + index;
            if(index == 2 && !$('newCar1Ad')){
                $('new-car-paid-sponsor').update(newCarAd);
            }else if(index == 0 && !$('cpo1Ad')){
                $('cpo-ad').update(cpoAd);
            }
            //fire asis to track tab clicks
            var tabAsisTags = new Array('homepage_research_tab_nocount.asis', 'homepage_reviews_tab_nocount.asis', 'homepage_newcar_tab_nocount.asis', 'homepage_buying_tab_nocount.asis');
            var asisCacheKillString = "/no_cache/vs/" + tabAsisTags[index];
            asisCacheKillString += "?cache_kill=" + new Date().getTime();
            var asisImg = new Image(1,1);
            asisImg.src = asisCacheKillString;
          }
        };
        Event.observe($(s), 'click', Binder._bind.bindAsEventListener(Binder));
        $(s).writeAttribute({'id':'research-tab-' + index});
    });
    
    //resest the radio button for reviews & top picks tab
    styleToggle($('consumerReviewRadio'));
    /* End Tabbed Area Support */
    
    /* Start FYC Support */
    // Remove "Any Make" from FYD form option value
    $('fyd_form_make_fieldset').down('select').down('option').writeAttribute({'value':''});

    var FormListener = Class.create({
        id:null,
        formFieldId:null,
        formElements: function() {
            return $$('#' + this.id + ' li');
        },
        initialize : function(id,formFieldId) {
            this.id = id;
            this.formFieldId = formFieldId;
            this.assignObservers();
            this.defaultActiveElement(formFieldId);
        },
        assignObservers: function() {
            this.formElements().each(function(el){
                el.observe('click', this.formFunction.bindAsEventListener(this, el));
            }.bind(this));
        },
        clearActiveElements: function () {
            this.formElements().each(function(el){
                el.removeClassName('active');
            })
        },
        defaultActiveElement: function (formFieldId) {
            this.clearActiveElements();
            this.formElements().each(function(el){
                if(el.getAttribute('title') == $(formFieldId).getAttribute('value')){
                    el.addClassName('active'); 
                }
            })
        },
        formFunction: function(context, el) {
            this.clearActiveElements();
            $(this.formFieldId).setAttribute('value',el.getAttribute('title'));
            el.addClassName('active');
        }
    });

    var formListener = new FormListener('fyc-form-radios', 'fyc-form-search-type');
    /* End FYC Support */
    
    /* Start Rollover Support */
    // Button Background Image Rollovers
    var bgMouseOvers = new Array('fyc-go-btn', 'syc-go-btn', 'new-car-form-submit', 'reviews-form-submit', 'find-a-dealer-submit', 'view-offers-submit', 'new-car-go');
    var bgMouseOversLen = bgMouseOvers.length;
    for(var i=0; i < bgMouseOversLen; i++){
        var Binder = {            
          _bindOver: function(event) {
            var element = Event.element(event);
            element.addClassName('over');
          },
          _bindOut: function(event) {
            var element = Event.element(event);
            element.removeClassName('over');
          }
        }
        Event.observe($(bgMouseOvers[i]), 'mouseover', Binder._bindOver.bindAsEventListener(Binder));
        Event.observe($(bgMouseOvers[i]), 'mouseout', Binder._bindOut.bindAsEventListener(Binder));
    }
    
    //Looks like we need the image on the page then add the source so IE7 doesn't abort the asis call at page load.
    var asisPageLoad=$('asis_on_pageload');
    asisPageLoad.setAttribute('src','/no_cache/ac/index_wwwautoconnectcom_ac.asis?cache_kill='+new Date().getTime());
    /* Start Reporting & Navigation Support */
    
    // Set the correct BKms Value in case the user used the back button twice from a search results page.
    var fixBKmsEls = new Array('main-nav-fyc-link', 'fyc_to_url', 'fyc-find-cars-link', 'fyc-form-link-1', 'fyc-form-link-2', 'reviews-top-pick-link-1', 'reviews-top-pick-link-2', 'reviews-top-pick-link-3', 'reviews-top-pick-link-4', 'reviews-top-pick-link-5', 'new-car-go','new-car-go1','new-car-lg-car-treatment', 'newcar-resources-list-item-5','fyc_target_url','promo_target_url');
    new fixBKms(fixBKmsEls);
    /* End Reporting & Navigation Support */
    
    //Create reviewSelector
    revSelector = new reviewSelector();
}
//test if init fired
initFired = false;
document.observe("dom:loaded", init);

// This is to force Firefox to always rerun JavaScript on back button
window.onunload = function(){};

    
/*Start ASIS image creation. This needs to be ripped out after new BI tagging has been finalized.*/
hpASISSupport = Class.create({        
    asisCacheKillString:null,
    asisImg:null,
    initialize : function(asisSRC) {
        this.asisCacheKillString = asisSRC;
        this.asisCacheKillString += "?cache_kill=" + new Date().getTime();
        this.asisImg = new Image(1,1);
        this.asisImg.src = this.asisCacheKillString;
    }
});
/*End ASIS image creation.*/

/* FYC Browse By and Find Links Update with FYC Form Info */

    function fyc_formToLink(h,el){
        var zip = '';
        var make='';
        var searchType = '&search_type=' + $('fyc-form-search-type').value;
        if($('fyc-form-zip').value != ''){zip= '&address=' + $('fyc-form-zip').value;}
        if($('make')){ make= '&make=' + $('make').value; }
        var newHref = h + zip +make+ searchType;
        $(el).writeAttribute({'href':newHref});
    }
   
    /* Used to clear out the zip value */
    function cleanZip(form){
        var val = form.address.value;
        val = val.replace(/[^a-zA-Z0-9]/g,'');
        form.address.value = val;

        return true;
    }
    
// Ad Support
function expandSuperLinerContainer(superLinerIndex) {
    if (superLinerIndex == 1) {
        $("tier1").style.display='block';
    }
    if (superLinerIndex == 6) {
        $("ad-300-links").style.display='block';
    }
    if (superLinerIndex == 2) {
        $("cpo-ad").style.display='block';
    }
    if (superLinerIndex == 3) {
        $("tier2").style.display='block';
    }
    if (superLinerIndex == 4) {
        $("new-car-sponsor-place-holder").style.display='none';
        $("new-car-paid-sponsor").style.display='block';
    }
    if (superLinerIndex == 5) {
        $("newCarTextAd").style.display='block';
    }
    // style type altopen return the iframe id of the ad to display the alternate non-ad state
    if (superLinerIndex == 'cpo1Ad') {
        $("cpo-promo").style.display='block';
    }
    if (superLinerIndex == 'newCar1Ad') {
        $("new-car-sponsor-place-holder").style.display='none';
        $("new-car-no-sponsor").style.display='block';
        new hpASISSupport('/no_cache/ac/HP_NEWCAR_AD_UNSOLD.asis');
    }
}

// IE7 hangs for an unknown reason.
function ie7HungFix(){
    if(initFired || !(/MSIE (7)/.test(navigator.userAgent))){return;}
    if ($('atc-footer')) {
        init();
    }else{
        var timer = setTimeout('ie7HungFix()',100);
    }
}
timer = setTimeout('ie7HungFix()',5000);