﻿/** 
  * ======================================================
  * $Workfile:   4-6_script.js  $
  * $Revision:   1.3  $
  * $Date:   Oct 29 2009 16:05:50  $
  * $Author:   riverarx  $
  * $Archive:   //legal.regn.net/npv/Dev-Archives/Development_Area/archives/LargeLaw/PageDesigner/v4/Code/Front-end/_Source/LexisNexis/Website/Modules/Style/Themes/4-6/4-6_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() {
	// Call info container
	$('div.callInfo').wrapInner('<div class="callInfoContainer"></div>');
	
	$('a.aCallNow').insertBefore('.callInfoContainer');
	
	// apply png fix after check if still using default background image (above)
	if(/MSIE (5\.5|6\.)/.test(navigator.userAgent)) {
		$('#ForegroundImage').css('behavior','url(/Assets/js/iepngfix.htc)');
		$('#ForegroundImage').css('background-position','100px 100px !important');
	}
}

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

$(document).ready(function () {
	$(".aCallNow").text('');
	
	$('input.submitBtn').attr('value','');
	
	//resizeVideo();
	
	headerAdjust();
	
	updateNavZIndex();
	
	$('div.spanBookmark').prepend('+');
	
	$('.ulLanguages').append('<li class="closeLanguage"><a href="javascript:showLanguage();">close</a></li>');
	
	$('div.multimedia').insertBefore('div.divPodContainer');
	
	if($('div.divPodContainer div.divPod').length <= 0)
		$('div.divPodContainer').css('display','none');
	
	$('div.divPodContainer div.divPod:first').css('background-image','none');
	
	//$('.divAttorneyInfo').after('<div class="clearfix"></div>');
	
	//$('#nav li.active > a').prepend('&raquo; ');
	
	// hide empty language selector
	//if($('div.divLanguages h2').length <= 0)
	//	$('div.divLanguages').css('display','none');
});