// hide office locator if not from raymondjames.com
if (location.href.indexOf("?rfrl=rj.com")== -1){
	document.getElementById("u_contact").style.display = "none"
}
else{
	document.getElementById("logo").childNodes[0].href = document.getElementById("logo").childNodes[0].href + "?rfrl=rj.com"
	document.getElementById("button_ll").childNodes[0].childNodes[0].href = document.getElementById("button_ll").childNodes[0].childNodes[0].href + "?rfrl=rj.com"
	document.getElementById("button_l").childNodes[0].childNodes[0].href = document.getElementById("button_l").childNodes[0].childNodes[0].href + "?rfrl=rj.com"
	document.getElementById("button_r").childNodes[0].childNodes[0].href = document.getElementById("button_r").childNodes[0].childNodes[0].href + "?rfrl=rj.com"
	document.getElementById("button_rr").childNodes[0].childNodes[0].href = document.getElementById("button_rr").childNodes[0].childNodes[0].href + "?rfrl=rj.com"

	//change wording on bottom link to return to raymondjames.com instead of visit
	if (document.getElementById("footer_cell")){
		document.getElementById("footer_cell").innerHTML = document.getElementById("footer_cell").innerHTML.replace("Click here to visit RaymondJames.com", "Click here to return to RaymondJames.com")
	}
}



//begin horizontal nav hightlight
function navHighlight (horiz_bkg){
	var id
	if (horiz_bkg == "ma"){id = "b_manage"}
	else if (horiz_bkg == "pr"){id = "b_protect"}
	else if (horiz_bkg == "bu"){id = "b_build"}
	else if (horiz_bkg == "ab"){id = "b_discover"}
	else {return false;}
	document.getElementById(id).src = "images/buttons/" + id + "_.gif"
	document.getElementById(id).onmouseout = function(){
		document.getElementById(id).src = "images/buttons/" + id + "_.gif"
	}
}
//check if horiz_bkg exists and run the function if true
if(window.horiz_bkg && document.getElementById){navHighlight(horiz_bkg)}
// end horizontal nav hightlight

//make sure the top lines in the content area align on interior pages
if (document.getElementById("right_top_spacer") && document.getElementsByTagName("h2")[0] && document.getElementsByTagName("h2")[0].offsetHeight > 40) {
	document.getElementById("right_top_spacer").style.height = document.getElementsByTagName("h2")[0].offsetHeight - 14 + "px"
}

// set right vertical bar height
if (document.getElementById("body_content") && document.getElementById("body_content").offsetHeight < 358)
document.getElementById("body_content").style.height = "343px" // 15px less because of padding-bottom in style sheet

if (document.getElementById("body_content_wide") && document.getElementById("body_content_wide").offsetHeight < 358)
document.getElementById("body_content_wide").style.height = "343px" // 15px less because of padding-bottom in style sheet

//safari scroll bar - html { min-height: 100%; margin-bottom: 1px; }



/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
// give alternating colors to tables with the regTbl class
if(document.getElementsByTagName){
	var el = document.getElementsByTagName("TR");
	for(var i=0; i < el.length; i++){
		if(el[i].parentNode.parentNode.className.indexOf("regTbl") != -1){
			if(i%2 == 1){el[i].className = "tblon";} 
			else {el[i].className = "tbloff";}
		}
	}
}


/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
/*change on master*/
//begin image viewer
function imageViewer (image_path) {
	
	//var close_window = "<p style='margin-top: 10px; margin-bottom: 0px; text-align: center;'><a href='Close window' onclick='document.getElementById(\"image_viewer\").style.visibility = \"hidden\"; return false;'>Close window</a></p>"
	
	

	document.getElementById("image_viewer").innerHTML = "<p style='margin-top: 10px; margin-bottom: 0px; text-align: center;'><a href='Close window' onclick='hideLayer(\"image_viewer\"); return false;'><img src=images/" + image_path + " border=\"0\"><br />Close window</a></p>"
	//above code uses hide layer from top of document js file
	//document.getElementById("image_viewer").style.visibility = "visible"
	showLayerOp("image_viewer") //use fade-in from top of document js file

}

if(document.getElementById){
	document.write ("<div id='image_viewer' style='position: absolute; top: 50px; left: 297px; visibility: hidden; background: #ddd9d5; padding: 10px; border: 1px solid #999490'></div>")
}
//end image viewer



// check file name and highlight if it matches a link

var file_name = location.href
// get rid of query string
if (file_name.indexOf('?')!= -1){
		var query = true
		var ques_loc = file_name.indexOf('?')
		var query_string = file_name.substring(ques_loc, file_name.length)
		file_name=file_name.substring(0,ques_loc)
}

// get rid of bookmarks
if (file_name.indexOf('#')!= -1){
		var bm = true
		var bm_loc = file_name.indexOf('#')
		var bookmark = file_name.substring(bm_loc, file_name.length)
		file_name=file_name.substring(0,bm_loc)
}

// loop through all the links
for (check_links = 0; check_links < document.links.length; check_links++) {
	var link_name = document.links[check_links].href	
	// highlight link if it matches filename
	// exclude nn4 and others
		if(document.getElementById){
			if (link_name == file_name) {
				document.links[check_links].style.color='#236fdc';
			}
		}
}