//Unobtrusive / initilization of the Tabbed Panels.
//Created by: Dan Martins

//Declare the varibale name outside the function so it is global. 
var TabbedPanels1;

function InitPage()
{
	TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: params.tab ? params.tab : 0}) ;
    //Declare the event listeners to reveal the appropriate panel.
    //Initilize the Framework ->TargetID->Handler Type->Function/Function Name->Return?->End
	//These are almost generic so that they arent listening for specific ID's so you can add / remove panels from the HTML structure without problems here...You will get problems with the animation mind..
	Spry.Utils.addEventListener("one", "click", function(){TabbedPanels1.showPanel(0);}, false);
	Spry.Utils.addEventListener("two", "click", function(){TabbedPanels1.showPanel(1);}, false);	
	Spry.Utils.addEventListener("three", "click", function(){TabbedPanels1.showPanel(2);}, false);
	Spry.Utils.addEventListener("four", "click", function(){TabbedPanels1.showPanel(3);}, false);
	Spry.Utils.addEventListener("five", "click", function(){TabbedPanels1.showPanel(4);}, false);
    Spry.Utils.addEventListener("six", "click", function(){TabbedPanels1.showPanel(5);}, false);
    Spry.Utils.addEventListener("seven", "click", function(){TabbedPanels1.showPanel(6);}, false);
	Spry.Utils.addEventListener("eight", "click", function(){TabbedPanels1.showPanel(7);}, false);
	
    //Start the even listeners for the animation.
	Spry.Utils.addEventListener("sectorHome", "click", fadeSectorHome, false);
    Spry.Utils.addEventListener("procurementSolutions", "click", fadeProcurementSolutions, false);
    Spry.Utils.addEventListener("effienciesSavings", "click", fadeEffienciesContent, false);
    Spry.Utils.addEventListener("ourBusinesses", "click", fadeOurBusinessesContent, false);
    Spry.Utils.addEventListener("currentPartnerships", "click", fadeCurrentPartnerships, false);
    Spry.Utils.addEventListener("procurementNews", "click", fadeProcurementNews, false);
	Spry.Utils.addEventListener("futureSchools", "click", fadeFutureSchools, false);
    Spry.Utils.addEventListener("ourTeam", "click", fadeOurTeam, false);	
	Spry.Utils.addEventListener("caseStudies", "click", fadeCaseStudies, false);
	
}

function fadeSectorHome(){
	// Initilize the Framework ->TargetID->From Opacity -> To Opacity -> Duration -> Toggled
	Spry.Effect.DoFade('sectorHomeContent',{from: 0, to: 100, duration: 1000, toggle:false});
	}

function fadeProcurementSolutions(){
    Spry.Effect.DoFade('procurementContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeEffienciesContent(){
    Spry.Effect.DoFade('effienciesContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeOurBusinessesContent(){
    Spry.Effect.DoFade('ourBusinessesContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeCurrentPartnerships(){
    Spry.Effect.DoFade('currentPartnershipsContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeProcurementNews(){
    Spry.Effect.DoFade('procurementNewsContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeFutureSchools(){
	Spry.Effect.DoFade('futureSchoolsContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeOurTeam(){
    Spry.Effect.DoFade('ourTeamContent',{from: 0, to: 100, duration: 1000, toggle: false});
}

function fadeCaseStudies(){
	Spry.Effect.DoFade('caseStudiesContent',{from: 0, to: 100, duration: 1000, toggle: false});
	}
	
//Done, load the page
Spry.Utils.addLoadListener(InitPage);

