
	
// Load the Home page Flash
function loadHomePageFlash() {
		// ![CDATA[
		var homePageFlashHolder = new SWFObject("/lib/swf/homepage/homeAssets.swf", "Stock And Leader", 691, 414, "8", "");
		homePageFlashHolder.addParam("wmode", "transparent");
		homePageFlashHolder.addVariable("swfPath", "../lib/swf/homepage/homeAssets.swf");
		homePageFlashHolder.addVariable("xmlPath", "../lib/swf/homepage/xml/banners.xml");
		homePageFlashHolder.addVariable("imgPath", "../lib/swf/homepage/images/");
		homePageFlashHolder.write("mainFlash");
		// ]]>
}

// Load the Home page Flash
function loadAttorneySelectorFlash() {
		// ![CDATA[
		var attorneySelectorFlashHolder = new SWFObject("/lib/swf/attorneySelector/attorneys.swf", "Attorneys", 729, 320, "9", "");
		attorneySelectorFlashHolder.addParam("wmode", "transparent");
		attorneySelectorFlashHolder.addVariable("xmlPath", "../lib/swf/attorneySelector/xml/default.aspx");
		//attorneySelectorFlashHolder.addVariable("imgPath", "../lib/images/attorneyPhotos/");
		attorneySelectorFlashHolder.addVariable("imgPath", "../cms/uploads/attorneyUploads/");
		attorneySelectorFlashHolder.write("selectorFlash");
		// ]]>
}

// Switch out HTML content for the Alt Flash Text Headers
function loadSWFHeader(swfName, top, left, width, height, size, color, objId) {
		// ![CDATA[
		var swfName = new SWFObject("/lib/swf/flashHeader/flashHeader.swf", "Main Text Header", width, height, "9", "");
		swfName.addParam("wmode", "transparent");
		swfName.addVariable("headlineTop", top);         // put the top coords
		swfName.addVariable("headlineLeft", left);       // put the left coords
		swfName.addVariable("headlineWidth", width);     // put the width
		swfName.addVariable("headlineHeight", height);   // put the height
		swfName.addVariable("headlineSize", size);       // put the size
		swfName.addVariable("headlineColor", color);     // put the color
		
		// Catch & escpape all characters passed to Flash...Flash will use the unescape() to revert to HTML text
		var obj = document.getElementById(objId);
		if(obj){
			var html = obj.innerHTML;
			html = html.StripTabs();
			var htmlTag = html.substring(1,3);
			html = html.substring(4, (html.length-5));
				
			// Catch instances of "é" and convert to Hex code
			if (html.indexOf("\xe9") > -1) {	
				var str = html.split("\xe9");
				html = str[0] + "%C3%A9" + str[1];
			}
			
			// Catch instances of "+" and convert to Hex code
			if (html.indexOf("+") > -1) {	
				var str = html.split("+");
				html = str[0] + "%2B" + str[1];
			}
			swfName.addVariable("headlineText", escape(html));
			swfName.write(objId);
			
			// Create new a div to be printed in place of the flash
			var printableDiv = document.createElement("div");
			// Grab its current object
			var currObj = obj.id;
			// Set the new obj and it params
			printableDiv.id = "printText" + currObj.substring((currObj.length-3), currObj.length);
			printableDiv.className = "printFlashAlt";
			printableDiv.innerHTML = "<" + htmlTag + ">" + html + "</" + htmlTag + ">";
    		// Append the new div
			obj.parentNode.insertBefore(printableDiv, obj.nextSibling);
		}
		
		// ]]>
}

function flyOutMenuChange(menuName) {
	var id = menuName.substring(3);
	toggleDivGroupDisplay(menuPanes, "menuPanel"+ id);	
	changeAllBGPos(menu, menuName);
	changeAllBGColor(btns, menuName, "#535444", "#696853");
}


function flyOutMenuReset() {
	showDivDisplay('flyOutMenu');
	for (var i = 0; i < window.menuPanes.length; i++) {
		if (window.menuPanes[i] !== "Defaults") {
			var id = window.menuPanes[i].substring(8, window.menuPanes[i].length);
			changeBGColor("btn"+id, "#696853");
			changeBGImgXY("btn"+id, 20, 0);
			hideDivDisplay(window.menuPanes[i]);
		}
	}
}


var accordionSiteMap = function() {
	$(document).ready(function() {
		//$("#panels div:first").prev().addClass("active");
		//$("#panels div:first").slideDown("slow");
		
		$("#panels a").click(function(event) {
			$("#panels").find("a.story").each(function() {
				$(this).removeAttr("id");
			});
			
			$("#panels .pane").find("p").each(function() {
				$(this).css("color", "#FFF000");
			});
			
			var clicked = $(this);
			clicked.attr("id", "active");
			clicked.blur();
			
			$("#panels").find("div").each(function() {
				
				if (clicked.attr("class").indexOf("story") > -1) {
					if ($(this).prev().attr("id") == clicked.attr("id")) {
						if (clicked.next().css("display") !== "block") {
							clicked.removeClass("inactive");
							clicked.addClass("active");
							clicked.next().slideDown("slow");
						} else {
							clicked.removeClass("active");
							clicked.addClass("inactive");
							clicked.next().slideUp("slow");
						}
					} else {
						$(this).prev().removeClass("active");
						$(this).prev().addClass("inactive");
						$(this).slideUp("slow");
					}
					return false;
				}
			});
		});
	});
}

var formAgree = function() {
    $('input[id=disclaimer]').attr('checked', true);
}
var disclaimerMailtoModal = function(_aHref) {
    var disclaimerText = "<div id=\"box\"><p>";
        disclaimerText += "If you are not a current client of Stock and Leader (&#8220;current client&#8221; meaning we are actively working with you and presently providing you with counsel on a legal matter), please read and accept the following terms before communicating any information through this website:"
        disclaimerText += "</p>";
        disclaimerText += "<p>";

        disclaimerText += "I have read the &#8220;Terms of Use and Disclaimer&#8221; as set forth under the link at the bottom of the Home page of this website, I understand those terms and that disclaimer, understand that they are incorporated herein, and I agree to them. I understand that the ability to communicate with  Stock and Leader through this website is not provided as a means to submit confidential, private, sensitive, privileged, and/or case specific information of any kind. I acknowledge that any such information submitted through this website is not subject to an attorney-client privilege, and that Stock and Leader has no obligation to maintain the confidentiality of any such information, unless I have formally retained Stock and Leader for legal representation, and Stock and Leader has agreed to represent me. To the extent I have any questions or concerns, I will telephone Stock and Leader and discuss first before communicating through this website."
        
        disclaimerText += "</p></div><div id=\"box2\">&nbsp;</div>";
    
    var disclaimerLinks = "<div id=\"disclaimerLinks\">";
        disclaimerLinks += "<a href=\"#\" class=\"cancel\" id=\"cancel\" onclick=\"$.modal.close(); return false;\">Cancel</a>";
        if (_aHref.indexOf("FORMACCEPT") > -1) {
            disclaimerLinks += "<a href=\"\" class=\"accept\" onclick=\"$.modal.close(); formAgree(); return false\">I Accepton</a>";
         } else {
            disclaimerLinks += "<a href=\"" + _aHref + "\" class=\"accept\">I Accept</a>";

        }
        disclaimerLinks += "</div>";
        $.modal(disclaimerText + disclaimerLinks, { position:["50%", "50%"]});
}