/* Ukuleles image swap function
 **************************************************/
 function smallImageClick( imgUrl_Large, imgUrl_Pop, title )
 {
	 var anchorTag = document.getElementById( 'a_MainImage' );
	 var imageTag = document.getElementById( 'img_MainImage' );
	 
	 if( anchorTag )
	 {
		 anchorTag.href = imgUrl_Pop;
		 anchorTag.title = title;
	 }
	 
	 if( imageTag )
	 {
		 imageTag.src = imgUrl_Large;
		 imageTag.alt = title;
	 }
 }
 
 function showSubMenu( sender )
 {
	 sender.getElementsByTagName('div')[0].style.left='auto';
 }
 
 function hideSubMenu( sender )
 {
	 sender.getElementsByTagName('div')[0].style.left='-999px';
 }
 
 /**
  *	modelIndex = index of top level item to be expanded
  * subModelIndex = index of 2nd level item to be highlighted
  **/
 function ukuleleModelMenuSelect( modelIndex, subModelIndex )
 {
	 var accordionOptions = {
		 show: modelIndex,
		 onBackground: function()
		 {
		 },
		 onBackgroundEnd: function()
		 {
		 	if( document.compatMode && document.all )		// for ie6.0
				$$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', 'hidden'); });
		 },
		 onActive: function()
		 {
			 $$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', 'hidden'); });
		 },
		 onActiveEnd: function()
		 {
			 $$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', ''); });
		 }
	 };

	 new Accordion( $$( '.modelList img' ), $$( '.subListContainer' ), accordionOptions );
	 var subListContainer = $$( '.subListContainer' )[modelIndex];
	 var subModelList = subListContainer.getElements( 'li' );
	 if( subModelIndex >= 0 && subModelIndex < subModelList.length )
	 	subModelList[subModelIndex].addClass( 'selected' );
		
	 if( !( document.compatMode && document.all ) )		// for non-ie
	 {
		 $$( '.subListContainer' ).each( function( el, i ){
					el.setStyle( 'overflow', '' );
				});
	 }
	 
	 $$( '.modelList ul').each( function( el, i ) {
				el.removeClass( 'modelSubListPreInit' );
			});
 }
 
  function dealersMenuSelect( modelIndex, subModelIndex )
 {
	 var accordionOptions = {
		 show: modelIndex,
		 onBackground: function()
		 {
		 },
		 onBackgroundEnd: function()
		 {
		 	if( document.compatMode && document.all )		// for ie6.0
				$$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', 'hidden'); });
		 },
		 onActive: function()
		 {
			 $$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', 'hidden'); });
		 },
		 onActiveEnd: function()
		 {
			 $$( '.subListContainer' ).each(function(el, i){ el.setStyle('overflow', ''); });
		 }
	 };

	 new Accordion( $$( '.modelList h3' ), $$( '.subListContainer' ), accordionOptions );
	 var subListContainer = $$( '.subListContainer' )[modelIndex];
	 var subModelList = subListContainer.getElements( 'li' );
	 if( subModelIndex >= 0 && subModelIndex < subModelList.length )
	 	subModelList[subModelIndex].addClass( 'selected' );
		
	 if( !( document.compatMode && document.all ) )		// for non-ie
	 {
		 $$( '.subListContainer' ).each( function( el, i ){
					el.setStyle( 'overflow', '' );
				});
	 }
	 
	 $$( '.modelList ul').each( function( el, i ) {
				el.removeClass( 'modelSubListPreInit' );
			});
 }
 
 function add_to_cart(){
	document.getElementsByTagName("form")[0].submit(); 
 }
