// START - add favicons //////////
document.writeln('<link rel="icon" type="image/icon" href="/en_ca/img/favicon.ico" />');
document.writeln('<link rel="Shortcut Icon" type="image/x-icon" href="/en_ca/img/favicon.ico" />');
// END - add favicons ////////////

// START - Google Analytics code ////////////
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-20735137-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

// Google Analytics - Social Media Icons //
function recordOutboundLink(link, category, action) {
	_gat._getTrackerByName()._trackEvent(category, action);
	setTimeout('document.location = "' + link.href + '"', 100);
}

// END - Google Analytics code ////////////

// START - function - set style for left menu ////////////
function setLeftMenu(currentSubMenuName){
	var currentSubMenuItem = document.getElementById(currentSubMenuName)
	if (currentSubMenuItem){
		// set class as "current" for the defined menu item
		currentSubMenuItem.className += " current"; 
		
		// loop through menu items and hide all sub menus that aren't under the "current" defined menu item
		if (currentSubMenuItem.hasChildNodes()){
			var arrayChildNodes = currentSubMenuItem.childNodes;
			alert(arrayChildNodes.length);
			for (i = 0; i < arrayChildNodes.length; i++){
				alert(arrayChildNodes.className);							
			}
		}
	}
}
// END - function - set style for left menu ////////////

// START - functions to swap images ////////////////////

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// END - function to swap images ////////////////////

// START - function for stock quote tool on homepage ///////////

	// ------------------------------------------------------------------------------------------------------------------------------------------

	// function:			getQuote()

	// purpose:			Used to obtain a quote for a stock symbol

	//

	// parameters:	(none)

	// return:				(none)

	// ------------------------------------------------------------------------------------------------------------------------------------------	

	function getQuote() 

	{

		var theForm = document.forms.QuoteForm;				// get the form that contains the quote information/fields

		var sSymbols = theForm["tbSymbols"].value;			// get the symbol that was entered into the text field
			
		var urlPath = "/cda/jsp/rjmktdata_popup.jsp?task=get_quote&source=opener&symbols=" + sSymbols;

		doPopup(urlPath);

	}

	

	// -----------------------------------------------------------------------------------------------------------------------------------------

	// function:			doSymbols()

	// purpose:			Used to open the popup allowing the user to lookup a symbol

	//

	// parameters:	(none)

	// return:				(none)

	// -----------------------------------------------------------------------------------------------------------------------------------------

	function doSymbols() 

	{

		//alert("doSymbols");

		var urlPath = "/cda/jsp/rjmktdata_popup.jsp";

		doPopup(urlPath);

	}

	

	// -----------------------------------------------------------------------------------------------------------------------------------------

	// function:			doPopup()

	// purpose:			Used to open a new window with the specified Url path

	//

	// parameters:	String containing the url for the popup window

	// return:				(none)

	// -----------------------------------------------------------------------------------------------------------------------------------------

	function doPopup(urlPath)

	{	

		window.open ("http://www.raymondjames.ca" + urlPath, '', 'width=672, height=465, scrollbars=1, top=0', true)
		// window.open ("http://www.raymondjames.ca" + urlPath, '', 'width=672, height=465, scrollbars=1, top=0', true)

	}	

	function getQuote() 

	{

		var theForm = document.forms.QuoteForm;				// get the form that contains the quote information/fields

		var sSymbols = theForm["tbSymbols"].value;			// get the symbol that was entered into the text field
			
		var urlPath = "/cda/jsp/rjmktdata_popup.jsp?task=get_quote&source=opener&symbols=" + sSymbols;
//alert(urlPath);
		doPopup(urlPath);

	}



// END - function for stock quote tool on homepage ///////////













