﻿/*
  * ======================================================
  * $Workfile:   10-2_script.js  $
  * $Revision:   1.0  $
  * $Date:   Oct 01 2009 17:39:48  $
  * $Author:   riverarx  $
  * $Archive:   //legal.regn.net/npv/Dev-Archives/Development_Area/archives/LargeLaw/PageDesigner/v4/Code/Front-end/_Source/LexisNexis/Website/Modules/Style/Themes/10-2/10-2_script.js-arc  $
  * ======================================================
  * Change History:
  * 1.00 initial revision
*/

function addBookmark() {
		// browser checking and branching, since not all browsers allow bookmark the exact same way.
		// set the rel attribute for the link to sidebar so that Opera will pick this up.  This may not be necessary for new versions though -- test out later
		if(window.opera){
			if($('a#bookmarkLink').attr('rel') != "") {
				$('a#bookmarkLink').attr('rel','sidebar');
			}
		}
		
		/* lets create the event handler and assigned to the anchor and once the event is triggered go through the if and check to see which browser is used and us the appropriate add bookmark syntax */
		$('a#bookmarkLink').click(function(event) {
			event.preventDefault(); // this prevents the default behavior of the anchor link to follow the href value
			var url = this.href; // this assigns the current page's href value to the var 'url'
			var title = this.title; // this assigns the current page's title value to the var 'title'
			
			// now lets check to see which browser the user is using!
			if(window.sidebar) {
				/* - ////	FIREFOX	\\\\ - */
				window.sidebar.addPanel(title, url,"");
			} else if (window.external){
				/* - //// IE	\\\\ - */
				window.external.AddFavorite(url, title);
			} else {
				/* - //// Opera Safari and all other browsers that do not support javascript bookmark scripts	\\\\ - */
				alert('Please use "Ctrl-D (PC Win) or Cmd-D (Mac OS)" to bookmark this page.');
			}
		});
/*	m()m	*/
}

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

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

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

function ieHover(element) {
	$(element).find('li').each(function(){
		$(this).hover(
			function() {
				$(this).addClass('over');
			},
			function() {
				$(this).removeClass('over');
			}
		);
	});
}

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

$(document).ready(function () {
	addBookmark();
	
	resizeVideo();

	updateNavZIndex();
	
	ieHover($('#languages'));
	ieHover($('#nav'));
	
	$('.divAttorneyInfo').after('<div class="clearfix"></div>');
	
	$('#language ul').append('<li class="closeLanguage"><a href="javascript:showLanguage();">close</a></li>');
	
	//equalHeight($('#frgImg,#bkgImg'));
	//equalHeight($('#col1,#col2,#col3'));
});