
// 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

// 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";}
		}
	}
}

//begin image viewer
function imageViewer (image_path,top,left) {
	if ((top == "") || (top == null)) {
		top = "50";
	}
	
	if ((left == "") || (left == null)) {
		left = "250";
	}
	
	//onclick in below uses function from top JS file.
	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=" + image_path + " border=\"0\"><br />Close window</a></p>";

	document.getElementById("image_viewer").style.top = top + "px";
	
	document.getElementById("image_viewer").style.left = left + "px";
	
	//use fade-in from top of document js file
	showLayerOp("image_viewer")

}

if(document.getElementById){
	document.write ("<div id='image_viewer' style='position: absolute; top: 50px; left: 250px; 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 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';
		}
	}
}

//Array of Images to loop through on the home page.
var bannerArray = new Array();
bannerArray["WMOBanner"] = "<a href=\"http://www.raymondjames.com/branches/library/features/year_end_wealth_management_update\" target=_blank><img onmouseover=\"this.src = 'http://www.raymondjames.com/branches/library/banners/yep2010_.gif';\" style=\"BORDER-RIGHT: #cecece 1px solid; BORDER-TOP: #cecece 1px solid; BORDER-LEFT: #cecece 1px solid; BORDER-BOTTOM: #cecece 1px solid\" onmouseout=\"this.src = 'http://www.raymondjames.com/branches/library/banners/yep2010.gif';\" src=\"http://www.raymondjames.com/branches/library/banners/yep2010.gif\"></a>"
bannerArray["econOutlook2011"] = "<a href=\"/branches/library/features/economic_outlook\" target=\"_blank\"><img src=\"/branches/library/banners/economic_outlook.png\" border=\"0\" onmouseover=\"this.src='/branches/library/banners/economic_outlook_.gif'\" onmouseout=\"this.src='/branches/library/banners/economic_outlook.gif'\"></a>"
//bannerArray["rjstrength"] = "<a href=\"/branches/library/features/rj_strength/index.htm\" target=\"_blank\"><img src=\"/branches/library/banners/strength_banner.gif\" onmouseover=\"this.src='/branches/library/banners/strength_banner_.gif'\" onmouseout=\"this.src='/branches/library/banners/strength_banner.gif'\" border=\"0\"></a>";
bannerArray["sdc09"] = "<a href=\"/advisorchoice/library/2009_sdc\" target=\"_blank\" onclick=\"window.opwn(this.href,'_blank','width=990,height=700,resizable,menu'); return false;\"><img src=\"/advisorchoice/images/buttons/100129_sdc09_tall.gif\" width=\"144\" height=\"183\" id=\"100129_sdc09_tall\" border=\"0\"></a>";
//bannerArray["powerofindependence"] = "<a href=\"/branches/library/power_of_independence.htm\" target=\"_blank\" onclick=\"window.opwn(this.href,'_blank','width=800,height=750,resizable,menu'); return false;\"><img src=\"/images/power_of_independence_thumb.gif\" width=\"131\" height=\"96\" id=\"Power of Independence\" border=\"0\"></a>";
bannerArray["regRep"] = "<a href=\"/pdfs/reprints/1112_registeredrep.pdf\" target=\"_blank\"><img src=\"http://www.raymondjames.com/advisorchoice/images/buttons/111221_regrep.gif\" border=\"0\" id=\"111221_regrep\" onmouseover=\"this.src = '/advisorchoice/images/buttons/111221_regrep_.gif';\" onmouseout=\"this.src = '/advisorchoice/images/buttons/101230_regrep_best2010.gif';\" /></a>";

if(document.getElementById("imgBlock3") != null) {
	var obj = document.getElementById("imgBlock3");
	var num1 = Math.floor(Math.random() * 6);
	var imgBlock;

	switch (num1) {
		case 0:
			imgBlock = bannerArray["econOutlook2011"];
			break;
        case 1:
            imgBlock = bannerArray["sdc09"];
            break;
	    case 2:
        	imgBlock = bannerArray["regRep"];
            break;		
		case 3:
			imgBlock = bannerArray["econOutlook2011"];
            break;	
		default:
			imgBlock = bannerArray["econOutlook2011"];
			break;
	}

	obj.innerHTML = imgBlock;
}

if (document.getElementById("staticBanner") != null) {

    var obj = document.getElementById("staticBanner");

    obj.innerHTML = bannerArray["regRep"];
}

if (document.getElementById("disclosuresLegalBlock")) {
    var html = document.getElementById("disclosuresLegalBlock").innerHTML;
    if (html.indexOf("2010") > -1) {
        var d = new Date();
        var year = d.getUTCFullYear();
        html = html.replace("2010", year);
        document.getElementById("disclosuresLegalBlock").innerHTML = html;
    }
}
