// BEGIN - Revised Global Navigation Logic

var thisOmNavObj = new omNavObj2();

function omNavObj2(){
	this.instance = "thisOmNavObj";
	this.timer;
	this.timerDuration = 400;
	this.timerPauseShow;
	this.timerPauseShowDuration = 150;
}

omNavObj2.prototype.initNav = function(strCurLoc,strLang){
	this.curLoc = (typeof(strCurLoc) == "string") ? strCurLoc : "home";
	this.curLang = (typeof(strLang) == "string") ? strLang : "en-us";
	
	this.objMainContainer = document.getElementById('mainnav_v2');
	this.addCssClass(this.objMainContainer,(" " + this.curLoc));
	this.addCssClass(this.objMainContainer,(" " + this.curLang));
	
	this.initExtendNavAs();
	this.addFlyout('practices','flyout_practices');
	this.addFlyout('lawyers','flyout_lawyers');
	this.addFlyout('careers','flyout_careers');
	this.addFlyout('offices','flyout_offices');
	this.addFlyout('news','flyout_newsroom');
	this.addFlyout('about','flyout_aboutus');
	this.hasActiveSelect = false;
	this.cleanUp();

	//Do some other navigation tasks.
	try{
		if (!(navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { 
			document.getElementById('footer_bookmarklink').style.display = 'none';
		}
	}catch(e){}

}

omNavObj2.prototype.initExtendNavAs = function(){
	var holder = this.getChildElementsByNodeName(this.objMainContainer, 'A');
	this.navAs = new Array();
	for(i=0;i<holder.length;i++){
		this.navAs[i] = holder[i];
		this.navAs[i].hasFlyout = false;
		this.navAs[holder[i].name] = holder[i];
	}
}

omNavObj2.prototype.addFlyout = function(strAName,strFlyoutDivID){
	this.navAs[strAName].flyoutDiv = document.getElementById(strFlyoutDivID);
	this.navAs[strAName].hasFlyout = true;
	this.navAs[strAName].strAName = strAName;
	this.navAs[strAName].hasNested = false;
	eval("this.navAs[strAName].onmouseover = function(){" + this.instance + ".hasActiveSelect = false;" + this.instance + ".startFlyoutWithPause('" + strAName + "')}")
	eval("this.navAs[strAName].onmouseout = function(){" + this.instance + ".startTimer()}")
	eval("this.navAs[strAName].flyoutDiv.onmouseover = function(){" + this.instance + ".cancelTimer();" + this.instance + ".cancelFlyoutWithPause()}")
	eval("this.navAs[strAName].flyoutDiv.onmouseout = function(){" + this.instance + ".startTimer()}")

	var containedSelects = this.navAs[strAName].flyoutDiv.getElementsByTagName('SELECT');
	if(containedSelects.length>0){
		for(s=0;s<containedSelects.length;s++){
			eval("containedSelects[s].onfocus = function(){" + this.instance + ".hasActiveSelect = true}")
			eval("containedSelects[s].onblur = function(){" + this.instance + ".hasActiveSelect = false}")
		}
	}

	if(this.navAs[strAName].flyoutDiv.className.indexOf('flyout_nested')!=-1){
		this.navAs[strAName].hasNested = true;
		this.navAs[strAName].nestedRootUL = this.getChildElementsByNodeName(this.navAs[strAName].flyoutDiv, 'UL')[0];
		this.navAs[strAName].nestedLIs = new Array();
		
		var allLIs = this.navAs[strAName].nestedRootUL.getElementsByTagName('LI');
		for(i=0;i<allLIs.length;i++){
			var curLen = this.navAs[strAName].nestedLIs.length
			if(allLIs[i].className.indexOf('level1')!=-1){
				if(this.getChildElementsByNodeName(allLIs[i], 'DIV').length>0){
					if(this.getChildElementsByNodeName(this.getChildElementsByNodeName(allLIs[i],'DIV')[0], 'UL')[0].className.indexOf('level2')!=-1){
						allLIs[i].hasSub = true;
						allLIs[i].subA = this.getChildElementsByNodeName(allLIs[i], 'A')[0];
						allLIs[i].subUL = this.getChildElementsByNodeName(this.getChildElementsByNodeName(allLIs[i],'DIV')[0], 'UL')[0];
						allLIs[i].subA.className += " hassub";
						this.navAs[strAName].nestedLIs[curLen] = allLIs[i];
						eval("this.navAs[strAName].nestedLIs[curLen].onmouseover = function(){"+this.instance+".showNested('"+strAName+"',"+curLen+")}")
					}
				}
				else{
					this.navAs[strAName].nestedLIs[curLen] = allLIs[i];
					eval("this.navAs[strAName].nestedLIs[curLen].onmouseover = function(){"+this.instance+".hideNesteds('"+strAName+"')}")
				}
			}
		}
	}
}

omNavObj2.prototype.showNested = function(strAName,intID){
	this.hideNesteds(strAName)
	this.navAs[strAName].nestedLIs[intID].subUL.style.display = 'block';
	this.addCssClass(this.navAs[strAName].nestedLIs[intID].subA," navHover");
}

omNavObj2.prototype.hideNesteds = function(strAName){
	for(hn=0;hn<this.navAs[strAName].nestedLIs.length;hn++){
		if(this.navAs[strAName].nestedLIs[hn].hasSub){
			this.navAs[strAName].nestedLIs[hn].subUL.style.display = 'none';	
			this.delCssClass(this.navAs[strAName].nestedLIs[hn].subA," navHover");
		}
	}
}

omNavObj2.prototype.startFlyoutWithPause = function(strAName){
	eval("this.timerPauseShow = setTimeout(\"" + this.instance + ".showFlyout('" + strAName + "')\"," + this.instance + ".timerPauseShowDuration)")
}

omNavObj2.prototype.cancelFlyoutWithPause = function(){ clearTimeout(this.timerPauseShow); }


omNavObj2.prototype.showFlyout = function(strAName){
	this.cancelTimer();
	this.hideFlyouts();
	this.navAs[strAName].flyoutDiv.style.display = 'block';
	this.addCssClass(this.navAs[strAName]," navHover flyout_on");
	if(this.navAs['careers'].hasNested){ this.hideNesteds('careers') }
}

omNavObj2.prototype.hideFlyouts = function(){
	if(!this.hasActiveSelect){
		this.cancelTimer();
		for(i=0;i<this.navAs.length;i++){
			if(this.navAs[i].hasFlyout){
				this.navAs[i].flyoutDiv.style.display = 'none';
				this.delCssClass(this.navAs[this.navAs[i].name]," navHover flyout_on");
			}
		}
	}
}

omNavObj2.prototype.cleanUp = function(){
	for(i=0;i<this.navAs.length;i++){ if(!this.navAs[i].hasFlyout){eval("this.navAs[i].onmouseover = function(){" + this.instance + ".hideFlyouts()}")} }
}

omNavObj2.prototype.cancelTimer = function(){ clearTimeout(this.timer); }
omNavObj2.prototype.startTimer = function(){ this.cancelFlyoutWithPause();eval("this.timer = setTimeout(\"" + this.instance + ".hideFlyouts()\"," + this.instance + ".timerDuration)") }

omNavObj2.prototype.addCssClass = function(objTarget,strClass){ if(objTarget.className.indexOf(strClass)==-1){objTarget.className += strClass;} }
omNavObj2.prototype.delCssClass = function(objTarget,strClass){ if(objTarget.className.indexOf(strClass)!=-1){objTarget.className = objTarget.className.replace(strClass, "")} }
omNavObj2.prototype.getChildElementsByNodeName = function(obj,type){
	var thisArr = new Array();
	for(o=0;o<obj.childNodes.length;o++){if(obj.childNodes[o].nodeName==type){thisArr[thisArr.length] = obj.childNodes[o];}}
	return thisArr;
}

// END - Revised Global Navigation Logic

//Begin Footer Navigation Logic
function footerOver(objA){ objA.firstChild.src = objA.firstChild.src.toString().replace(/(.*?)(\.gif)/,"$1-over$2"); }
function footerOut(objA){ objA.firstChild.src = objA.firstChild.src.toString().replace(/(.*?)(-over)(\.gif)/,"$1$3"); }
function bookmarkThisPage(){ try{ window.external.addFavorite(window.location,document.title); }catch(e){} }
//End Footer Navigation Logic

//Begin Search Logic

function searchFocus(o){ if(o.value == "Search Site"){o.value="";o.className="active"} }
function searchBlur(o){ if(o.value == ""){o.value="Search Site";o.className=""} }

function voider(){var foo=null;}
function setSearchType(o,sitestring){
	var onSrc = ImageRoot + "/search_on.gif";
	var offSrc = ImageRoot + "/search_off.gif";
	var searchButtonSite = document.getElementById('search_button_site');
	var searchButtonLawyers = document.getElementById('search_button_other');
	var searchHiddenVal = document.getElementById('typeSearchVal');
	var searchButtonSiteSrc = searchButtonSite.firstChild.src;
	var searchButtonLawyersSrc = searchButtonLawyers.firstChild.src;
	
	var isSite = (o.id == searchButtonSite.id) ? true : false;
	searchButtonSite.firstChild.src = (isSite) ? onSrc : offSrc;
	searchButtonLawyers.firstChild.src = (isSite) ? offSrc : onSrc;
	searchHiddenVal.value = sitestring;
}

//End Search Logic

//Begin Twistdown Logic
var twistOpenImage = 	new Image();
var twistCloseImage = new Image();
twistOpenImage.src = ImageRoot + "/twist_open.gif";
twistCloseImage.src = ImageRoot + "/twist_closed.gif";

function objTwistdown(){
	this.allULs = new Array();
	this.allLIs = new Array();
	this.defaultIndex = null;
	this.openImgSrc = twistOpenImage.src; 
	this.closedImgSrc = twistCloseImage.src; 
}

objTwistdown.prototype.init = function(objRootUL,strInstance){
	this.ul = objRootUL;
	this.instance = strInstance;
    
	var theULs = objRootUL.getElementsByTagName('UL');
	for(ul=0;ul<theULs.length;ul++){ this.addUL(theULs[ul]); }
	var theLIs = objRootUL.getElementsByTagName('LI');
	for(li=0;li<theLIs.length;li++){ this.addLI(theLIs[li]); }
	if(this.defaultIndex!=null){ 
		if(this.allLIs[this.defaultIndex].parent!=null){
			this.toggleUL(this.allLIs[this.defaultIndex].parent.parent.index);
		}
	 }
}

objTwistdown.prototype.addUL = function(objUL){
	var len = this.allULs.length;
	this.allULs[len] = objUL;
	this.allULs[len].index = len;
	this.allULs[len].parent = this.allULs[len].parentNode;
}

objTwistdown.prototype.addLI = function(objLI){
    var len = this.allLIs.length;
	this.allLIs[len] = objLI;
	this.allLIs[len].index = len;
	this.allLIs[len].parent = (this.allLIs[len].parentNode != this.ul) ? this.allLIs[len].parentNode : null;
	if(this.allLIs[len].className.indexOf("current")!=-1){this.defaultIndex = len}
	
	this.allLIs[len].hasTwistDown = (getChildElements(this.allLIs[len],'UL').length == 1) ? true : false;
	if(this.allLIs[len].hasTwistDown){
		this.allLIs[len].childUL = getChildElements(this.allLIs[len],'UL')[0];
		this.allLIs[len].twistA = getChildElements(this.allLIs[len],'A')[0];
		if (this.allLIs[len].twistA != null && this.allLIs[len].twistA.className == "twister") {
    		this.allLIs[len].twistA.href = "javascript: tvoid();";
	    	eval("this.allLIs[len].twistA.onclick = function(){" + this.instance + ".toggleUL(" + len + ")}");
		    this.allLIs[len].twistImg = getChildElements(this.allLIs[len].twistA,'IMG')[0];
		}
	}
	else{
		for(i=0;i<this.allLIs[len].getElementsByTagName('A').length;i++){
			if(	this.allLIs[len].getElementsByTagName('A')[i].className == 'twister' ){
				this.allLIs[len].getElementsByTagName('A')[i].style.display = 'none';
			}
		}
	}
	if(this.allLIs[len].className.indexOf("level3")!=-1){
		this.allLIs[len].normA = getChildElements(this.allLIs[len],'A')[0];
		if(this.allLIs[len].className.indexOf("level3plain")==-1){ 
	        this.allLIs[len].normA.onmouseover = function(){this.parentNode.className+=" level3Hover"}
	        this.allLIs[len].normA.onmouseout = function(){this.parentNode.className-=" level3Hover"}
	    }
	}
	if (this.allLIs[len].className.indexOf("level") == -1) {
	    this.allLIs[len].parentNode.forceopen="true";
	} else {
	    this.allLIs[len].parentNode.forceopen="false";
	}
}

objTwistdown.prototype.toggleUL = function(index){
	for(i=0;i<this.allULs.length;i++){
		if(this.allULs[i] != this.ul){
		    try {
			if(this.allULs[i] == this.allLIs[index].parent){ 
				this.allLIs[index].parent.parent.twistImg.src = this.openImgSrc;
				this.allLIs[index].parent.style.display = "block"; 
				}
			else if(this.allULs[i] != this.allLIs[index].childUL){ 
				this.allULs[i].parent.twistImg.src = this.closedImgSrc;
				this.allULs[i].style.display = "none"; 
				}
			} catch (er) {}
		}
		if(this.allULs[i].forceopen == "true") {
		    this.allULs[i].style.display = "block"; 
		}
	}
	var openChildUL = (this.allLIs[index].childUL.style.display=="block") ? false : true;
		this.allLIs[index].childUL.style.display = (openChildUL) ? "block" : "none";
		this.allLIs[index].twistImg.src = (openChildUL) ? this.openImgSrc : this.closedImgSrc;
}

function tvoid(){null;}
//End Twistdown Logic

//Begin Variable Font Size (+/-) Logic
function setActiveStyleSheet(title) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if(a.getAttribute("title") == title) a.disabled = false;
		}
	}
	createCookie("pref_css_style", title, 365);
}

function getActiveStyleSheet() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
	}
	return null;
}

function getPreferredStyleSheet() {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1
		&& a.getAttribute("rel").indexOf("alt") == -1
		&& a.getAttribute("title")
		) return a.getAttribute("title");
	}
	return null;
}

function createCookie(name,value,days){ 
	var expires = "";
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = date;
	}
	setCookie(name,value,expires);
}
function readCookie(name){ return getCookie(name);}


function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1){
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else{ begin += 2; }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1){ end = dc.length; }
    return unescape(dc.substring(begin + prefix.length, end));
}

function onloadPreferredCSS(){
	var cookie = readCookie("pref_css_style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
}

function onunloadPreferredCSS(){
	var title = getActiveStyleSheet();
	createCookie("pref_css_style", title, 365);
}
//End Variable Font Size (+/-) Logic

//Begin Helper Functions
function getChildElements(obj,type){
	var thisArr = new Array();
	for(o=0;o<obj.childNodes.length;o++){
		if(obj.childNodes[o].nodeName==type){ thisArr[thisArr.length] = obj.childNodes[o]; }
	}
	return thisArr;
}
//End Helper Functions