﻿//names of all of the catalog div id's that contain the catalog cover image
var catalogCoverDivIds = ['catalogFallUpholsterySaleCover','catalogFallCollectionCover','catalogAccentTablesCover','catalogDiningCover','catalogAccentTablesCover','catalogDiningCover','catalogLightingCover','catalogRugsCover','catalogBedroomCover','catalogHomeOfficeCover','catalogMediaStorageCover','catalogUpholsteryCover','springCollectionCover','catalogBestBuysCover']; // coma seperated list: 'catalogBestBuysCover','catalogFurnitureCover, 'outdoorFurnitureCover',,'catalogAccessoryTablesCover','catalogBedroomCover','catalogDiningCover','catalogHomeOfficeCover','catalogLampsCover','catalogMediaStorageCover','catalogRugsCover','catalogUpholsteryCover'

function hideCatalogCovers(){

	$('catalogContentTD').className="catalogContentFlash";
	    
    //loop through all catalog covers and hide em
	for(i=0; i<catalogCoverDivIds.length; i++)
	{
	    if($(catalogCoverDivIds[i]))
	        $(catalogCoverDivIds[i]).className="catalogNoDisplay";
	}
}

function onWindowResize(){
	mainDim = main.getCoordinates();
	reposRem();
	initSubNav(mainDim);
}

window.addEvent('resize', function(){
	onWindowResize();
});

window.addEvent('load', function() {
	initCommon("catalogue");
	$$('.subNav')[2].addClass('selected');  //replaced with Mootool equivalent, Prototype approach conflicted
	onWindowResize();
});

window.addEvent('domready', function() {

       if($('catalogFallUpholsterySaleCover'))
       {
            //pass in anonymous method to handle the click on the catalog
            $('catalogFallUpholsterySaleCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogFallUpholsterySaleMain').className="catalogDisplay";
                }
            );
        }
       
       if($('catalogFallCollectionCover'))
       {
            //pass in anonymous method to handle the click on the catalog
            $('catalogFallCollectionCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogFallCollectionMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogBestBuysCover'))
            {
                //pass in anonymous method to handle the click on the catalog
                $('catalogBestBuysCover').addEvent('click', function (){
                    // Hide all the covers
                    hideCatalogCovers();

                    // Show the Catalog
                    $('catalogBestBuysMain').className="catalogDisplay";
                    }
                );
        }
        
        if($('catalogAccentTablesCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogAccentTablesCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogAccentTablesMain').className="catalogDisplay";
                }
            );
        }
        
         if($('catalogDiningCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogDiningCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogDiningMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogAccentTablesCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogAccentTablesCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogAccentTablesMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogDiningCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogDiningCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogDiningMain').className="catalogDisplay";
                }
            );
        }
       
        if($('catalogLightingCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogLightingCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogLightingMain').className="catalogDisplay";
                }
            );
        }
        
        
        if($('catalogRugsCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogRugsCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogRugsMain').className="catalogDisplay";
                }
            );
        }
        
        
        if($('catalogBedroomCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogBedroomCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogBedroomMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogHomeOfficeCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogHomeOfficeCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogHomeOfficeMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogMediaStorageCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogMediaStorageCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogMediaStorageMain').className="catalogDisplay";
                }
            );
        }
        
        if($('catalogUpholsteryCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('catalogUpholsteryCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('catalogUpholsteryMain').className="catalogDisplay";
                }
            );
        }
        
        if($('springCollectionCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('springCollectionCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('springCollectionCover').className="catalogDisplay";
                }
            );
        }
        
         if($('springCollectionCover'))
        {
            //pass in anonymous method to handle the click on the catalog
            $('springCollectionCover').addEvent('click', function (){
                // Hide all the covers
                hideCatalogCovers();

                // Show the Catalog
                $('springCollectionCover').className="catalogDisplay";
                }
            );
        }
        
// end window load
});