// bookmark functionality
function bookmark(url, title){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url, title);
	} else if (navigator.appName == "Netscape") {
		window.sidebar.addPanel(title, url, "");
	} else {
	    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}

//  this shows and hides the language selector
function showLanguage() {
	$('.divLanguages h2').toggleClass('languagesOpened');
	$('.divLanguages ul').toggleClass('openLanguage');
}

exploreHover = function() {
	var li = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<li.length; i++) {
		li[i].onmouseover=function() {
			this.className+=" over";
		}
		li[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", exploreHover);

// this is a multiple window onload function - in the case new functions are added in the future
function addOnloadEvent(fnc){
  if ( typeof window.addEventListener != "undefined" )
    window.addEventListener( "load", fnc, false );
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", fnc );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[fnc]();
      };
    }
    else
      window.onload = fnc;
  }
}

function resizeVideo() {
	$('object').css({width:'220px',height:'178px'});
	$('embed').css({width:'220px',height:'178px'});
}

function headerAdjust() {
	if($('td#ForegroundImage img').length > 0) {
		$('td#ForegroundImage').attr({
			width: $('td#ForegroundImage img')[0].width
		});
	}
	
	if($('td#LogoImage img').length > 0) {
		$('td#LogoImage').attr({
			width: $('td#LogoImage img')[0].width
		});
	}
}

$(document).ready(function () {
	resizeVideo();
	
	$('.ulLanguages').append('<li class="closeLanguage"><a href="javascript:showLanguage();">close</a></li>');
	
	$('.divAttorneyInfo').after('<div class="clearfix"></div>');
	
	//setTimeout(function() { headerAdjust(); },10);
	
	// init accordion left nav
	/*$('#nav').accordion({
		active: '.parent a',
		header: 'li.parent > a',
		event: 'click',
		animated: 'easeslide',
		autoheight: false
	});*/
});