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

//	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;
	});
	$('#newsButton').click(function(){
		if($(this).val()=='Hide All News'){
			$('.news_item').animate({ 
			  opacity: 'hide',
			  height: 'hide'
			}); 
			$(this).val('Show All News');
			$('#news_items h6').removeClass('down_arrow')
			.addClass('right_arrow')				  
		} else { 
			$('.news_item').animate({ 
			  opacity: 'show',
			  height: 'show'
			}); 
			$(this).val('Hide All News'); 
			$('#news_items h6').removeClass('right_arrow')
			.addClass('down_arrow')			  
		}
	  });	

  	// hide all the Home page events panes when the page loads
  	$( '#news_items > ul' ).hide();
	
 	 // uncomment the next 4 lines if you'd like the first pane to be visible by default
    $( '#news_items h6:first')
		.removeClass('right_arrow')
		.addClass('down_arrow');
  	$('#news_items > ul:first').show();

 	$('#news_items h6').click(function() {
   	  $(this)
	  		.next()
	 		//.animate({'height':'toggle'}, 3000, 'easeOutBounce');
	 		.animate({'height':'toggle'}, 2000);
	  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')			  
		}
	  });
	

	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);	
	}

});
