// JavaScript Document
$(document).ready(function(){
//	var adobeBtn;
//	adobeBtn = document.getElementById('adobeButton');
//	adobeBtn.onmouseover = highlight;
//	adobeBtn.onmouseout = unhighlight;	
//	$('#adobeinfo').hide();
	var browserName=navigator.appName; 

//	if (browserName!="Microsoft Internet Explorer"){
//		$('<li><input type="button"  class="mapBtn" id="mapButton" value="Get Map" /></li>')
//		.insertAfter('#munster');		
//	}
	
	$('a[href="#"]').click(function(){
		$.scrollTo(0,'slow');
		return false;
	});
	
	$('div#standard').hide();
	$('div#prices').hide();
	$('div#tech').hide();
	$('div#photo').hide();
//	$('div#duo').hide();
//	$('div#champion').hide();
//	$('div#comfort').hide();
//	$('div#master').hide();
//	$('div#portax').hide();
//	$('div#western').hide();
	$('div#brenderup').hide();
	
  	// hide all the Home page events panes when the page loads
  	$( '#news > ul' ).hide();
  	$( '#tow > ul' ).hide();
	
 	 // uncomment the next 4 lines if you'd like the first pane to be visible by default
//    $( '#news h6:first')
//		.removeClass('right_arrow')
//		.addClass('down_arrow');
//  	$('#news > ul:first').show();

 	$('#news h6').click(function() {
   	  $(this)
	  		.next()
	 		.animate( 
		    {'height':'toggle'}, 3000, 'easeOutBounce')
			;
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
    	.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
    	.addClass('right_arrow')		  
	  }
  	});

	$('#toggleButton').click(function(){
		if($(this).val()=='Hide All Comments'){
			$('.feedback').animate({ 
			  opacity: 'hide',
			  height: 'hide'
			}); 
			$(this).val('Show All Comments');
			$('#praise h6').removeClass('down_arrow')
			.addClass('right_arrow')				  
		} else { 
			$('.feedback').animate({ 
			  opacity: 'show',
			  height: 'show'
			}); 
			$(this).val('Hide All Comments'); 
			$('#praise h6').removeClass('right_arrow')
			.addClass('down_arrow')			  
		}
	  });
	
	// hide all the Testimonials content panes when the page loads
  	$( '#praise > div' ).hide();
	
 	 // uncomment the next 4 lines if you'd like the first pane to be visible by default
//    $( '#praise h6:first')
//		.removeClass('right_arrow')
//		.addClass('down_arrow');
//  	$('#praise > div:first').show();

 	$('#praise h6').click(function() {
   	  $(this)
	  		.next()
	 		.animate( 
		    {'height':'toggle'})
			;
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
    	.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
    	.addClass('right_arrow')		  
	  }
  	});	
	
	$('#standBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#standard').is(':visible')) {
		$('#standard').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#standard').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });	
	
	$('#priceBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#prices').is(':visible')) {
		$('#prices').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#prices').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });	
	
	$('#techBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#tech').is(':visible')) {
		$('#tech').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#tech').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });
	
	$('#inventoryButton').click(function(){
		if($(this).val()=='Hide All Models'){
			$('.invent_table').animate({ 
			  opacity: 'hide',
			  height: 'hide'
			}); 
			$(this).val('Show All Models');
			$('.expandBtn').removeClass('down_arrow')
			.addClass('right_arrow')				  
		} else { 
			$('.invent_table').animate({ 
			  opacity: 'show',
			  height: 'show'
			}); 
			$(this).val('Hide All Models'); 
			$('.expandBtn').removeClass('right_arrow')
			.addClass('down_arrow')			  
		}
	  });		
	
	$('#duoBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#duo').is(':visible')) {
		$('#duo').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#duo').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#championBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#champion').is(':visible')) {
		$('#champion').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#champion').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#comfortBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#comfort').is(':visible')) {
		$('#comfort').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#comfort').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#masterBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#master').is(':visible')) {
		$('#master').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#master').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#portaxBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#portax').is(':visible')) {
		$('#portax').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#portax').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#westernBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#western').is(':visible')) {
		$('#western').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#western').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });		
	
	$('#brenderupBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#brenderup').is(':visible')) {
		$('#brenderup').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#brenderup').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });	
	
	$('#galleryBtn').click(function(){			
	  if ($(this).hasClass('right_arrow')){
		$(this).removeClass('right_arrow')
		.addClass('down_arrow')
	  }else{
		$(this).removeClass('down_arrow')
		.addClass('right_arrow')		  
	  }
	if($('#photo').is(':visible')) {
		$('#photo').animate({ 
		  opacity: 'hide',
		  height: 'hide'
		}, 'slow'); 	  
	} else { 
		$('#photo').animate({ 
		  opacity: 'show',
		  height: 'show'
		}, 'slow');    
	}
  });
		
	$('#tabs').tabs();
	
//	$('#adobeButton').click(function(){
//		if($('#adobeinfo').is(':visible')) {
//			$('#adobeinfo').animate({ 
//			  opacity: 'hide',
//			  height: 'hide'
//			}, 'slow'); 
//			$(this).val('Get Adobe Reader');	  
//		} else { 
//			$('#adobeinfo').animate({ 
//			  opacity: 'show',
//			  height: 'show'
//			}, 'slow'); 
//			$(this).val('Hide');    
//		}
//	  });
	function highlight(){
	//we don't want to delete the other classname so we append ours
	// class="wide" becomes   class="wide highlighted"
	this.className = this.className + ' highlighted';
	}
	
	function unhighlight(){
		//find the starting position of " highlighted"
		var pos = this.className.indexOf(' highlighted');
		//alert("position is " + pos);	//the position where we found ' highlighted'
		//alert(this.className);			//the current class attribute value
		//alert(this.className.substring(0, pos));	//the new value - old one without ' highlighted'
		//change the classname to only go up to that point
		this.className = this.className.substring(0, pos);	
	}

});
