$(document).ready(function(){
	
	$('.extendingMenu').each(function(){
		$(this).animate({
			width: '+=180'
		}, 500,function(){

		});

	});
	

	
	$('.extendingMenu').each(function(){
		$(this).mouseleave(function(){
			$(this).addClass("extendingMenu");
			$(this).removeClass("extendingSelected");
		}).mouseenter(function(){
			$(this).addClass("extendingSelected");
			$(this).removeClass("extendingMenu");
		});
	});
	
	$('.navselection').each(
			function(){
				var originalId = this.id;
				if(this.id != 'index'){
					$(this).mouseleave(function(){
						var src = $(this).attr("src").replace("hover", ""); 
						$(this).attr("src", src);
					}).mouseenter(function(){
						var src = $(this).attr("src").replace(originalId, originalId+"hover"); 
			            $(this).attr("src", src); 
	
					});
				}
				
				$(this).click(function(){
					$.get('pages/'+this.id+'.php',function(msg){
						$('#col2').html(msg);
					});
					var left = $.get('pages/columns/left/'+this.id+'left.php',function(msg){
						$('#col1bottom').html(msg);
					}).error(function() { 
						$.get('pages/columns/left/default.php',function(msg){
							$('#col1bottom').html(msg);
						})
					});
					var right = $.get('pages/columns/right/'+this.id+'right.php',function(msg){
						$('#col3').html(msg);
					}).error(function() { 
						$.get('pages/columns/right/default.php',function(msg){
							$('#col3').html(msg);
						})
					});

				});
				
			});
	
	$('.sponsorFlip').bind("click",function(){
		
		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):
		
		var elem = $(this);
		
		// data('flipped') is a flag we set when we flip the element:
		
		if(elem.data('flipped'))
		{
			// If the element has already been flipped, use the revertFlip method
			// defined by the plug-in to revert to the default state automatically:
			
			elem.revertFlip();
			
			// Unsetting the flag:
			elem.data('flipped',false)
		}
		else
		{
			// Using the flip method defined by the plugin:
			
			elem.flip({
				direction:'lr',
				speed: 350,
				onBefore: function(){
					// Insert the contents of the .sponsorData div (hidden from view with display:none)
					// into the clicked .sponsorFlip div before the flipping animation starts:
					
					elem.html(elem.siblings('.sponsorData').html());
				}
			});
			
			// Setting the flag:
			elem.data('flipped',true);
		}
	});
});

function reloadpage(theTab){
	
}

function closeDiv(divId){
	
}



