﻿/*
  * ======================================================
  * $Workfile:   3-17_script.js  $
  * $Revision:   1.2  $
  * $Date:   Jun 12 2009 11:13:50  $
  * $Author:   riverarx  $
  * $Archive:   //renpdbsmhprod02/pvcsdata/Development_Area/archives/LargeLaw/PageDesigner/v4/Code/Front-end/_Source/LexisNexis/Website/Modules/Style/Themes/3-17/3-17_script.js-arc  $
  * ======================================================
  * Change History:
  * 1.00 initial revision
*/

// 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
		});
	}
	
	if($('div.divHeader').css("background-image").indexOf('HeaderBkg') > 0) {
		$('div.divHeader').css('background-position','right bottom');
	}
}

function updateNavZIndex() {
	$('ul#nav > li').each(
		function(i) {
			$(this).css('z-index',$('ul#nav > li').length - i);
		}
	);
}

function roundCorners() {
	// Nav bottom
	$('body').append('<div class="divNavBottom"></div>');
	$('div.divNavBottom').insertAfter('ul#nav');
	
	// Div Pod Container top
	$('div.divPodContainer').prepend('<div class="divPodContainerTop"></div>');
	
	// Div Pod Container bottom
	$('div.divPodContainer').append('<div class="divPodContainerBottom"></div>');
}

$(document).ready(function () {
	$(".aCallNow").text('');
	
	resizeVideo();
	
	$('.ulLanguages').append('<li class="closeLanguage"><a href="javascript:showLanguage();">close</a></li>');
	
	$('.divAttorneyInfo').after('<div class="clearfix"></div>');
	
	setTimeout(function() { headerAdjust(); },10);
	
	updateNavZIndex();
	
	roundCorners();
	
	headerAdjust();
	
	$('span.spanMore a').append(' &raquo;');
});