// JavaScript Document

// tertiary navigation state selector script

$(document).ready(function(){
	nav3page = $("body").attr("page");
	$("#nav3").find("li").contains(nav3page).eq(0).addClass('nav3current');
	$("#colorBandTitle span.pageTitle").text(nav3page);
});

// printing style sheet script

$(document).ready(function(){
	$("div#pagetools span.printer_friendly").click(function(){
		window.print();
		return false;
	});
	
 });


// compliance number & copyright year

$(document).ready(function(){
	$('span#copyrightDate').html('2009');
	$("body#home").find("span#complianceNumber").html('(0309-8175)');
			$("body#home.nav2whyschwab").find("span#complianceNumber").html("(0309-8175)");
			$("body#home.nav2solutions").find("span#complianceNumber").html("(0309-8175)");
			$("body#home.nav2pressroom").find("span#complianceNumber").html("(0309-8175)");

		$("body#retirementplanservices").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").filter(".nav3partAdv").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").filter(".nav3partEd").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").filter(".nav3invest").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").filter(".nav3retSol").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2dc").filter(".nav3unbundled").find("span#complianceNumber").html("(0309-8175)") 
	/*I think it makes sense to call the above section aaff but eeee also works.  KA*/

			$("body#retirementplanservices.nav2db").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2sdba").find("span#complianceNumber").html("(0309-8175)");
			$("body#retirementplanservices.nav2nonqual").find("span#complianceNumber").html("(0309-8175)");




$("body#stockplanservices").find("span#complianceNumber").html("(0309-8175)");
			$("body#stockplanservices.nav2administrators").find("span#complianceNumber").html("(0309-8175)");
			$("body#stockplanservices.nav2employee").find("span#complianceNumber").html("(0309-8175)");
			$("body#stockplanservices.nav2executive").find("span#complianceNumber").html("(0309-8175)");
	$("body#designatedbrokerage").find("span#complianceNumber").html("(0909-10934)");
			$("body#designatedbrokerage.nav2technology").find("span#complianceNumber").html("(0909-10934)");
			$("body#designatedbrokerage.nav2support").find("span#complianceNumber").html("(0909-10934)");
	$("body#thirdpartyadmins").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2investments").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2technology").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2cstc").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2participanted").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2bizdev").find("span#complianceNumber").html("(0309-8175)");
			$("body#thirdpartyadmins.nav2schwabrt").find("span#complianceNumber").html("(0309-8175)");




});


// for phone numbers in colorbar.  Hey it WORKS!
//Experimental at this stage, only rps.
//Can eventually be merged with the above block.  KA

$(document).ready(function(){

$("body#retirementplanservices").find("span#rpsPh").html("877-456-0777");

});

/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/
function switchStylestyle(styleName)
{
	$('link[@rel*=style][@title]').each(function(i) 
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	createCookie('style', styleName, 365);
}

$(document).ready(function() {
	$("a.styleswitch").click(function()
	{
		switchStylestyle(this.getAttribute("rel"));
		return false;
	});
	var c = readCookie('style');
	if (c) switchStylestyle(c);
});



// cookie functions courtesy PPK and quirksmode
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
// /cookie functions
