
/**
 * Adds functions into window.load / onload event handlers
 * rather than writing over it.
 * 
 * http://www.sitepoint.com/article/javascript-from-scratch/2
 * http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 */
function addLoadListener(fn)
	{
	if (typeof window.addEventListener != 'undefined')
		{
		window.addEventListener('load', fn, false);
		}
	else if (typeof document.addEventListener != 'undefined')
		{
		document.addEventListener('load', fn, false);
		}
	else if (typeof window.attachEvent != 'undefined')
		{
		window.attachEvent('onload', fn);
		}
	else
		{
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
			{
			window.onload = fn;
			}
		else
			{
			window.onload = function()
				{
				oldfn();
				fn();
				};
			}
		}
	}


/**
 * Adds functions into window.load / onload event handler,
 * rather than writing over it.
 */
//addLoadListener(AppFramework_initInstance);


/**
 * 
 * Requires:
 *  Cookies
 *  DOM
 * 
 */
var txtSize	= new Array();

function textLarger()	{parseFontSize(getBodyFontSize(), "lg");}

function textSmaller()	{parseFontSize(getBodyFontSize(), "sm");}

function parseFontSize(fontsize, dir)
	{
	var txtLen	= fontsize.length;
	var subLen	= txtLen-2;
	var subtxt	= fontsize.substring(subLen);
	var subSize	= fontsize.substring(0,subLen);
	var amt		= subSize*1;
	if (subtxt == 'px')	{amt = amt * 0.0626;}
	if (dir == 'sm')	{amt = amt - 0.1;}
	else if (dir == 'lg')	{amt = amt + 0.1;}
	font_size	= amt.toString()+"em";
	document.body.style.fontSize=font_size;
	content_setWidth();
	Set_Cookie( 'font_size', font_size, '', '/', '', '' );
	}

function content_setWidth()
	{
	var obj_content	= document.getElementById('id-content_container');
	var obj_nav	= document.getElementById('id-nav_container');
	}

function loadFontSize(){if (Get_Cookie('font_size'))	{document.body.style.fontSize=Get_Cookie('font_size');}}

function FontSize_init()
	{
	//var obj_GUI_Tools	= document.getElementById("id-GUI-Tools");
	if (document.getElementById("id-GUI-Tools") !== null)
		{
		var toolsHTML			= "";
		toolsHTML			+= '<table border="0" cellpadding="0" cellspacing="0"><tr><td class="tabsLeft2">&nbsp;</td>';
		
		// Print
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a href="#" id="id-PrintWindow"><span>PRINT</span></a></abbr></td></tr></table></td>';
		
		// Email
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a  href="mailto:?subject=AttorneyPages&amp;body=I thought you would find this attorney web site useful:%0A%0A'+window.location.href+'" title="Email to a Friend" id="id-PrintWindow"><span>EMAIL</span></a></abbr></td></tr></table></td>';
		
		// Resize Text.
		toolsHTML			+= '<td class="tabsLeft2">&nbsp;&nbsp;</td>';
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a href="#" id="id-ReSizeText_SM" title="Make Text Smaller"><span>A</span></a></abbr></td></tr></table></td>';
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:1.1em;"><abbr><a href="#" id="id-ReSizeText_LG" title="Make Text Larger"><span>A</span></a></abbr></td></tr></table></td>';
		
		toolsHTML			+= '<td>&nbsp;&nbsp;</td>';
		toolsHTML			+= '</tr></table>';
		
		
		// ========================
		// Create Anonymous/Lambda Handlers.
		// ========================
		
		// Resize Text.
		if (document.getElementById("id-ReSizeText_LG") !== null)
			{
			document.getElementById("id-ReSizeText_LG").onclick	= function() { textLarger(); navContainer_setWidth(); return false; };
			}
		
		// Resize Text.
		if (document.getElementById("id-ReSizeText_SM") !== null)
			{
			document.getElementById("id-ReSizeText_SM").onclick	= function() { textSmaller(); navContainer_setWidth(); return false; };
			}
		
		// Print
		if (document.getElementById("id-PrintWindow") !== null)
			{
			document.getElementById("id-PrintWindow").onclick	= function() { printWindow(); return false; };
			}
		}
	}

function getBodyFontSize()
	{
	var x = document.body;
	var y = '';
	if (x.currentStyle)			{y = x.currentStyle["fontSize"];}
	else if (window.getComputedStyle)	{y = document.defaultView.getComputedStyle(x,null).getPropertyValue("font-size");}
	return y;
	}

function getStyle(el,styleProp)
	{
	var x = document.getElementById(el);
	var y = '';
	if (x.currentStyle)			{y = x.currentStyle[styleProp];}
	else if (window.getComputedStyle)	{y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);}
	return y;
	}

function printWindow()
	{
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
	}
function Set_Cookie( name, value, expires, path, domain, secure ) 
	{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
		{
		expires = expires * 1000 * 60 * 60 * 24;
		}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
	}

// this function gets the cookie, if it exists
function Get_Cookie( name )
	{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
		{
		return null;
		}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
	}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain )
	{
	if ( Get_Cookie( name ) ) 
		{
		document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
		}
	}function dbg(msg){document.getElementById('dbg').innerHTML=msg;}
function navMain_setWidth(){var obj_nav=document.getElementById('nav');document.getElementById('id-navTabs').style.width=obj_nav.offsetWidth+"px";}
function navContainer_setWidth(){var obj_TD=document.getElementById('id-nav_containerTD');var obj_cont=document.getElementById('id-content_container');if(obj_TD!==null&&obj_cont!==null){obj_TD.style.width=obj_cont.offsetWidth+"px";}}
function navMain_initInstance(){if(document.location.protocol!="https:"){if(document.getElementById('id-navSubPractice')!==null){var togPractice=document.getElementById('id-navMainPractice');togPractice.onmouseover=function(){togglePanel(togPractice,'id-navSubPractice');return false;};togPractice.onmouseout=function(){overlayclose('id-navSubPractice');return false;};var togPracticeSub=document.getElementById('id-navSubPractice');togPracticeSub.onmouseout=function(){overlayclose('id-navSubPractice');return false;};initHideExplorerSelect(togPractice,'id-navSubPractice');}
if(document.getElementById('id-navSubLocation')!==null){var togLocation=document.getElementById('id-navMainLocation');togLocation.onmouseover=function(){togglePanel(togLocation,'id-navSubLocation');return false;};togLocation.onmouseout=function(){overlayclose('id-navSubLocation');return false;};var togLocationSub=document.getElementById('id-navSubLocation');togLocationSub.onmouseout=function(){overlayclose('id-navSubLocation');return false;};initHideExplorerSelect(togLocation,'id-navSubLocation');}
if(document.getElementById('id-navSubHotTopics')!==null){var togHotTopics=document.getElementById('id-navMainHotTopics');var togHotTopicsSub=document.getElementById('id-navSubHotTopics');togHotTopics.onmouseover=function(){togglePanel(togHotTopics,'id-navSubHotTopics');return false;};togHotTopics.onmouseout=function(){overlayclose('id-navSubHotTopics');return false;};togHotTopicsSub.onmouseout=function(){overlayclose('id-navSubHotTopics');return false;};initHideExplorerSelect(togHotTopics,'id-navSubHotTopics');}}navMain_setWidth();}
function togglePanel(togID,subID){overlay(togID,subID,'bottom');}
function overlayclose(subobjstr){document.getElementById(subobjstr).style.display="none";}
function initHideExplorerSelect(obj_parent,id_child){if(BrowserDetect.browser=="Explorer"){if(BrowserDetect.version>"5.0"&&BrowserDetect.version<"7.0"&&document.location.protocol!="https:"){var ieMat=document.createElement('iframe');if(document.location.protocol=="https:"){ieMat.src="/empty.txt";}
else if(window.opera!="undefined")
ieMat.src="";else
ieMat.src="robots.txt";var obj_child=document.getElementById(id_child);togglePanel(obj_parent,id_child);ieMat.scrolling="no";ieMat.frameBorder="0";ieMat.style.width=obj_child.offsetWidth+"px";ieMat.style.height=obj_child.offsetHeight+"px";ieMat.style.zIndex="-1";obj_child.insertBefore(ieMat,obj_child.childNodes[0]);obj_child.style.zIndex="101";overlayclose(id_child);}
else{var ieLIs=document.getElementById('nav').getElementsByTagName('li');for(var i=0;i<ieLIs.length;i++){if(ieLIs[i]){ieLIs[i].onmouseover=function(){this.className+=" sfhover";hideSelects();};ieLIs[i].onmouseout=function(){this.className=this.className.replace(' sfhover','');showSelects();};}}}}}
function hideSelects(){var oSelects=document.getElementsByTagName("select");for(var i=0;i<oSelects.length;i++){oSelects[i].className+=" hide";}}
function showSelects(){var oSelects=document.getElementsByTagName("select");for(var i=0;i<oSelects.length;i++){oSelects[i].className=oSelects[i].className.replace(" hide","");}}
addLoadListener(navMain_initInstance);var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||(this.searchVersion(navigator.appVersion)||"an unknown version");this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}else if(dataProp)return data[i].identity;}return null;},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};
BrowserDetect.init();
var cm=null;
function getPos(el,sProp){var iPos=0;iPos+=el["offset"+sProp];el=el.offsetParent;iPos+=el["offset"+sProp];el=el.offsetParent;return iPos;}
function getleft(el,m){if(m){m.style.pixelLeft=getPos(el,"Left");}cm=m;}
function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}return[curleft,curtop];}
function voidx(){}
function getposOffset(obj_overlay,offsettype){var totaloffset=(offsettype=="left")?obj_overlay.offsetLeft:obj_overlay.offsetTop;var parentEl=obj_overlay.offsetParent;while(parentEl!==null){totaloffset=(offsettype=="left")?totaloffset+parentEl.offsetLeft:totaloffset+parentEl.offsetTop;parentEl=parentEl.offsetParent;}return totaloffset;}
function overlay(obj_parent,childId,opt_position){if(document.getElementById){var obj_child=document.getElementById(childId);obj_child.style.display="block";var xpos=getposOffset(obj_parent,"left")+((typeof opt_position!="undefined"&&opt_position.indexOf("right")!=-1)?-(obj_child.offsetWidth-obj_parent.offsetWidth):0);var ypos=getposOffset(obj_parent,"top")+((typeof opt_position!="undefined"&&opt_position.indexOf("bottom")!=-1)?obj_parent.offsetHeight:0);obj_child.style.left=(xpos-15)+"px";obj_child.style.top=(ypos-1)+"px";return false;}else{return true;}}

/**
 * Adds functions into window.load / onload event handlers
 * rather than writing over it.
 * 
 * http://www.sitepoint.com/article/javascript-from-scratch/2
 * http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 */
function addLoadListener(fn)
	{
	if (typeof window.addEventListener != 'undefined')
		{
		window.addEventListener('load', fn, false);
		}
	else if (typeof document.addEventListener != 'undefined')
		{
		document.addEventListener('load', fn, false);
		}
	else if (typeof window.attachEvent != 'undefined')
		{
		window.attachEvent('onload', fn);
		}
	else
		{
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
			{
			window.onload = fn;
			}
		else
			{
			window.onload = function()
				{
				oldfn();
				fn();
				};
			}
		}
	}


/**
 * Adds functions into window.load / onload event handler,
 * rather than writing over it.
 */
//addLoadListener(AppFramework_initInstance);



function Set_Cookie( name, value, expires, path, domain, secure ) 
	{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
		{
		expires = expires * 1000 * 60 * 60 * 24;
		}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
	}

// this function gets the cookie, if it exists
function Get_Cookie( name )
	{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
		{
		return null;
		}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
	}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain )
	{
	if ( Get_Cookie( name ) ) 
		{
		document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
		}
	}/**
 * 
 * Requires:
 *  Cookies
 *  DOM
 * 
 */
var txtSize	= new Array();

function textLarger()	{parseFontSize(getBodyFontSize(), "lg");}

function textSmaller()	{parseFontSize(getBodyFontSize(), "sm");}

function parseFontSize(fontsize, dir)
	{
	var txtLen	= fontsize.length;
	var subLen	= txtLen-2;
	var subtxt	= fontsize.substring(subLen);
	var subSize	= fontsize.substring(0,subLen);
	var amt		= subSize*1;
	if (subtxt == 'px')	{amt = amt * 0.0626;}
	if (dir == 'sm')	{amt = amt - 0.1;}
	else if (dir == 'lg')	{amt = amt + 0.1;}
	font_size	= amt.toString()+"em";
	document.body.style.fontSize=font_size;
	content_setWidth();
	Set_Cookie( 'font_size', font_size, '', '/', '', '' );
	}

function content_setWidth()
	{
	var obj_content	= document.getElementById('id-content_container');
	var obj_nav	= document.getElementById('id-nav_container');
	}

function loadFontSize(){if (Get_Cookie('font_size'))	{document.body.style.fontSize=Get_Cookie('font_size');}}

function FontSize_init()
	{
	//var obj_GUI_Tools	= document.getElementById("id-GUI-Tools");
	if (document.getElementById("id-GUI-Tools") !== null)
		{
		var toolsHTML			= "";
		toolsHTML			+= '<table border="0" cellpadding="0" cellspacing="0"><tr><td class="tabsLeft2">&nbsp;</td>';
		
		// Print
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a href="#" id="id-PrintWindow"><span>PRINT</span></a></abbr></td></tr></table></td>';
		
		// Email
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a  href="mailto:?subject=AttorneyPages&amp;body=I thought you would find this attorney web site useful:%0A%0A'+window.location.href+'" title="Email to a Friend" id="id-PrintWindow"><span>EMAIL</span></a></abbr></td></tr></table></td>';
		
		// Resize Text.
		toolsHTML			+= '<td class="tabsLeft2">&nbsp;&nbsp;</td>';
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:0.8em;"><abbr><a href="#" id="id-ReSizeText_SM" title="Make Text Smaller"><span>A</span></a></abbr></td></tr></table></td>';
		toolsHTML			+= '<td class="tabsMain" valign="bottom" align="left"><table border="0" cellpadding="0" cellspacing="0"><tr><td class="blur" nowrap="nowrap" style="font-size:1.1em;"><abbr><a href="#" id="id-ReSizeText_LG" title="Make Text Larger"><span>A</span></a></abbr></td></tr></table></td>';
		
		toolsHTML			+= '<td>&nbsp;&nbsp;</td>';
		toolsHTML			+= '</tr></table>';
		
		
		// ========================
		// Create Anonymous/Lambda Handlers.
		// ========================
		
		// Resize Text.
		if (document.getElementById("id-ReSizeText_LG") !== null)
			{
			document.getElementById("id-ReSizeText_LG").onclick	= function() { textLarger(); navContainer_setWidth(); return false; };
			}
		
		// Resize Text.
		if (document.getElementById("id-ReSizeText_SM") !== null)
			{
			document.getElementById("id-ReSizeText_SM").onclick	= function() { textSmaller(); navContainer_setWidth(); return false; };
			}
		
		// Print
		if (document.getElementById("id-PrintWindow") !== null)
			{
			document.getElementById("id-PrintWindow").onclick	= function() { printWindow(); return false; };
			}
		}
	}

function getBodyFontSize()
	{
	var x = document.body;
	var y = '';
	if (x.currentStyle)			{y = x.currentStyle["fontSize"];}
	else if (window.getComputedStyle)	{y = document.defaultView.getComputedStyle(x,null).getPropertyValue("font-size");}
	return y;
	}

function getStyle(el,styleProp)
	{
	var x = document.getElementById(el);
	var y = '';
	if (x.currentStyle)			{y = x.currentStyle[styleProp];}
	else if (window.getComputedStyle)	{y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);}
	return y;
	}

function printWindow()
	{
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
	}