//requires jQuery //wait for the DOM to be loaded jQuery( document ).ready( function() { //ORDERED LIST //edit ordered list dom to allow styling jQuery( 'ol li' ).wrapInner( '' ); //activate ordered list styling via adding class - edit styles in stylesheet jQuery( 'ol' ).addClass( 'javaScriptStyled' ); //Style hero images. HeroImg.init(); //Style kitchen gallery images. KitGalleryImg.init(); SetColumnsList.init(); } ); SetColumnsList = { init : function() { $( 'dl.info' ).each( function( pmIndex ){ //Wrap dt/dd pairs with divs. var myLength = $(this).children('dt').size(); for( var i=0; i < myLength; i++ ) { $(this).children( "dt:eq(0),dd:eq(0)" ).wrapAll( '
' ); };//end for //Add clearing div to ensure height of each div. $(this).children( 'div' ).append( '' ); //Set class to initiate styling. $(this).addClass( 'columnsList' ); $(this).children( 'div:odd' ).addClass('odd'); $(this).children( 'div:even' ).addClass('even'); } ); } };//end SetColumnsList //Style hero images. HeroImg = { init : function() { jQuery( 'img.hero' ).each( function(){ jQuery( this ).wrap( '' ); var myString = jQuery( this ).attr( 'alt' ); jQuery( this ).after( '' + myString +'
' ); }); jQuery( 'img.heroRow' ).each( function(){ jQuery( this ).wrap( '' ); var myString = jQuery( this ).attr( 'alt' ); jQuery( this ).after( '' + myString +'
' ); }); } };//end object literal HeroImg //Style kitchen gallery images. KitGalleryImg = { init : function() { jQuery( 'ul#imageGallery li' ).each( function( pmIndex ){ jQuery( this ).click( function(){ KitGalleryImg.setGalleryByIndex( pmIndex ); } ); } ); KitGalleryImg.setGalleryByIndex( 0 ); } , setGalleryByIndex : function( pmIndex ) { jQuery( 'ul#imageGallery li' ).each( function( pmListIndex ){ if( pmIndex == pmListIndex ) //Major image { jQuery( this ).addClass( 'major' ); jQuery( this ).removeClass( 'minor' ); var myCurrentImgPath = jQuery( this ).children( 'img' ).attr( 'src' ); var myNewImgPath = myCurrentImgPath.replace( 'Minor', 'Major' ); //alert( myCurrentImgPath + " , " + myNewImgPath ); jQuery( this ).children( 'img' ).attr( 'src', myNewImgPath ); } else //Minor image { jQuery( this ).removeClass( 'major' ); jQuery( this ).addClass( 'minor' ); var myCurrentImgPath = jQuery( this ).children( 'img' ).attr( 'src' ); var myNewImgPath = myCurrentImgPath.replace( 'Major', 'Minor' ); //alert( myCurrentImgPath + " , " + myNewImgPath ); jQuery( this ).children( 'img' ).attr( 'src', myNewImgPath ); };//end if //jQuery( this ).click( function(){ alert( pmListIndex ); } ); } ); } };//end object literal KitGalleryImg