//Declare Spry Panel Variables
var TabbedPanels1;
var TabbedPanels2;
var TabbedPanels3;
var TabbedPanels4;
var TabbedPanels5;
var TabbedPanels6;
var sp1;
var spmanagement;
var spclients;
var spdrift;
var spcorp;
var historypanel;
var timelinepanel;
var affiliatespanel;
var honorspanel;
var principalpanel;
var managementpanel;
var staffpanel;
var nascarpanel;
var stockcarpanel;
var shorttrackpanel;
var driftingpanel;
var corporatepanel;
var cs1panel;
var cs2panel;
var cs3panel;
var cs4panel;
var cs5panel;
var newspanel;
var innewspanel;
var honors2panel;
var contactpanel;
var prevcontent;


//no conflict jquery 
jQuery.noConflict();

jQuery(document).ready(function(){ 

	//If the User resizes the window, adjust the #container height
	jQuery(window).bind("resize", resizeWindow);
	function resizeWindow( e ) {	
		var newWindowWidth = jQuery(window).width();	
		jQuery(".SlidingPanelsContent").css("width", newWindowWidth );
	} 
	
	//Load Content for History Page - clicked Profile link from sub-menu
	jQuery('#li-history-top').click(function() {								 
	   jQuery('#' + prevcontent).empty();
	   jQuery("#profile-history").load("../Application/pageFunctions.php?pagename=profile-history");
	   prevcontent = "profile-history";
	});
	
	//Load Content for History Page - Clicked History Tab
	jQuery('#li-history').click(function() {								 
	   jQuery('#' + prevcontent).empty();
	   jQuery("#profile-history").load("../Application/pageFunctions.php?pagename=profile-history");
	   prevcontent = "profile-history";
	});
	
	//Load Content for Timeline Page - Clicked Timeline Tab
	jQuery('#li-timeline').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#profile-timeline").load("../Application/pageFunctions.php?pagename=profile-timeline");
	   prevcontent = "profile-timeline";
	});
	
	//Load Content for Affiliates Page - Clicked Affiliates Tab
	jQuery('#li-affiliates').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#profile-affiliates").load("../Application/pageFunctions.php?pagename=profile-affiliates");
	   prevcontent = "profile-affiliates";
	});
	
	//Load Content for Awards Page - Clicked Awards Tab
	jQuery('#li-awards').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#profile-awards").load("../Application/pageFunctions.php?pagename=awards");
	   prevcontent = "profile-awards";
	});
	
	//Load Content for Principal Page - Clicked Team link in sub-menu
	jQuery('#li-principal-top').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#team-principal").load("../Application/pageFunctions.php?pagename=team-principal");
	   prevcontent = "team-principal";
	});
	
	//Load Content for Principal Page - Clicked Principal Tab
	jQuery('#li-principal').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#team-principal").load("../Application/pageFunctions.php?pagename=team-principal");
	   prevcontent = "team-principal";
	});
	
	//Load Content for Management Page - Clicked Management Tab
	jQuery('#li-management').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#team-management").load("../Application/pageFunctions.php?pagename=team-management");
	   prevcontent = "team-management";
	});
	
	//Load Content for Staff Page - Clicked Staff Tab
	jQuery('#li-staff').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#team-staff").load("../Application/pageFunctions.php?pagename=team-staff");
	   prevcontent = "team-staff";
	});
	
	//Load Content for NASCAR Page - Clicked CLIENTS link in sub-menu
	jQuery('#li-nascar-top').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-nascar").load("../Application/pageFunctions.php?pagename=clients-nascar");
	   prevcontent = "clients-nascar";
	});
	
	//Load Content for NASCAR Page - Clicked NASCAR Tab
	jQuery('#li-nascar').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-nascar").load("../Application/pageFunctions.php?pagename=clients-nascar");
	   prevcontent = "clients-nascar";
	});
	
	
	//Load Content for Stockcar Page - Clicked Stockcar Tab
	jQuery('#li-stockcar').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-stockcar").load("../Application/pageFunctions.php?pagename=clients-stockcar");
	   prevcontent = "clients-stockcar";
	});
	
	//Load Content for Short Track Page - Clicked Short Track Tab
	jQuery('#li-shorttrack').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-shorttrack").load("../Application/pageFunctions.php?pagename=clients-shorttrack");
	   prevcontent = "clients-shorttrack";
	});
	
	//Load Content for Drifting Page - Clicked Drifting Tab
	jQuery('#li-drifting').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-drifting").load("../Application/pageFunctions.php?pagename=clients-drifting");
	   prevcontent = "clients-drifting";
	});
	
	//Load Content for Corporate Page - Clicked Corporate Tab
	jQuery('#li-corporate').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#clients-corporate").load("../Application/pageFunctions.php?pagename=clients-corporate");
	   prevcontent = "clients-corporate";
	});
	
	//Load Content for Case Study #1 Page - Clicked Case Studies Link in sub-menu
	jQuery('#li-cs1-top').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#cs-driver-management").load("../Application/pageFunctions.php?pagename=cs-driver-management");
	   prevcontent = "cs-driver-management";
	});
	
	//Load Content for Case Study #1 Page - Clicked Case Study #1 Tab
	jQuery('#li-cs1').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#cs-driver-management").load("../Application/pageFunctions.php?pagename=cs-driver-management");
	   prevcontent = "cs-driver-management";
	});
	
	//Load Content for Case Study #2 Page - Clicked Case Study #2 Tab
	jQuery('#li-cs2').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#cs-driver-development").load("../Application/pageFunctions.php?pagename=cs-driver-development");
	   prevcontent = "cs-driver-development";
	});
	
	//Load Content for Case Study #3 Page - Clicked Case Study #3 Tab
	jQuery('#li-cs3').click(function() {
	   jQuery('#' + prevcontent).empty(); 
	   jQuery("#cs-motorsports-consulting").load("../Application/pageFunctions.php?pagename=cs-motorsports-consulting");
	   prevcontent = "cs-motorsports-consulting";
	});
	
	//Load Content for Case Study #4 Page - Clicked Case Study #4 Tab
	jQuery('#li-cs4').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#cs-motorsports-consulting2").load("../Application/pageFunctions.php?pagename=cs-motorsports-consulting2");
	   prevcontent = "cs-motorsports-consulting2";
	});
	
	//Load Content for Case Study #5 Page - Clicked Case Study #5 Tab
	jQuery('#li-cs5').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#cs-case-study5").load("../Application/pageFunctions.php?pagename=cs-case-study5");
	   prevcontent = "cs-case-study5";
	});
	
	//Load Content for News Release Page - Clicked PRESS link in sub-menu
	jQuery('#li-newsrelease-top').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#news-releases").load("../Application/pageFunctions.php?pagename=news-releases");
	   prevcontent = "news-releases";
	});
	
	//Load Content for News Release Page - Clicked News Releases Tab
	jQuery('#li-newsrelease').live("click", function(){
	   jQuery('#' + prevcontent).empty();
	   jQuery("#news-releases").load("../Application/pageFunctions.php?pagename=news-releases");
	   prevcontent = "news-releases";
	});
	
	//Load Content for News Release Page - Clicked News Releases Tab
	jQuery('#caryhof').live("click", function(){
	   jQuery('#' + prevcontent).empty();
	   jQuery("#news-releases").load("../Application/pageFunctions.php?pagename=pr-cary-hof");
	   prevcontent = "news-releases";
	});
	
	//Load Content for In the News Page - Clicked In the News Tab
	jQuery('#li-inthenews').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#in-the-news").load("../Application/pageFunctions.php?pagename=in-the-news");
	   prevcontent = "in-the-news";
	});
	
	//Load Content for Honors Page - Clicked Case Honors Tab
	jQuery('#li-honors').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#awards").load("../Application/pageFunctions.php?pagename=awards");
	   prevcontent = "awards";
	});
	
	//Load Content for Contact Page - Clicked Contact link in sub-menu
	jQuery('#li-contact').click(function() {
	   jQuery('#' + prevcontent).empty();
	   jQuery("#contact").load("../Application/pageFunctions.php?pagename=contact");
	   prevcontent = "contact";
	});

});