/*
  * ======================================================
  * $Workfile:   8-3_script.js  $
  * $Revision:   1.4  $
  * $Date:   Nov 04 2009 14:10:02  $
  * $Author:   goddarmx  $
  * $Archive:   //legal.regn.net/npv/Dev-Archives/Development_Area/archives/LargeLaw/PageDesigner/v4/Code/Front-end/_Source/LexisNexis/Website/Modules/Style/Themes/8-3/8-3_script.js-arc  $
  * ======================================================
  * Change History:
  * 1.00 initial revision
  * 1.01 updated showLanguage functionality to work with IE and updated formatHeader function
*/

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 showLanguage(obj) {
	//  this shows and hides the language selector
	$('ul.ulLanguages').toggleClass('show');
	if(obj) {
	    $('li#closeLink').remove();
	} else {
	    $('<li id="closeLink"><a href="javascript:showLanguage(1);" title="Close Language Menu">Close</a></li>').appendTo('ul.ulLanguages');
	}
	
	//$('.divLanguages ul').toggleClass('openLanguage');
	
	/*$('a#showLanguages').click(function(){
		$('#languages').show();
	});
	
	$('a#closeLanguages').click(function(){
		$('#languages').hide();
	});*/
}

function formatHeader() {
	if(!$('#headerFrgImg').val()) {
		$('#headerFrgImg').remove();
		$('#firmName').width('66%');
	} 
	
	if(!$('#firmLogo').val()) {
		$('#firmLogo').remove();
		$('#firmName').width('66%');
	}
	
	if(!$('#headerFrgImg').val() && !$('#firmLogo').val() ) {
		$('#headerFrgImg').remove();
		$('#firmLogo').remove();
		$('#firmName').width('100%');
	}
	
}

function toggleSubNav() {	
	// hide all subnav menus EXCEPT for the home sub nav
	$('ul.subNav').hide().filter('#homeSubNav').show();
	
	$('#nav li a').click(function(){	
		// loop and remove the 'active' class then add the class active to the clicked link
		$('#nav li a').removeClass('active');
		$(this).addClass('active');
		
		// capture the clicked link's ID to be used in the show functionality
		var linkId = $(this).attr('id');
		// show the SubNav menu associated with the clicked link
		$('ul.subNav').hide().filter('#' + linkId + 'SubNav').show();
		// cancel out the links' href attribute
		return false;
    });
/*	m()m	*/
}
/*
function resizeVideo() {
	$('object').css({width:'210px',height:'168px'});
	$('embed').css({width:'210px',height:'168px'});
}

*/
function roundCorners() {	
// we are checking to see if users are using an IE flavor browser and if so then add extra divs to pods to implement rounded corner solution
//	IE flavor browsers do NOT support opacity features see: http://docs.jquery.com/Utilities/jQuery.support
	if(!jQuery.support.opacity) {
		$('<div class="topPod">').prependTo('div.pod');
		$('<div class="bottomPod">').appendTo('div.pod');
		
		/*	call firm now button	*/
		$('a#callFirmNow').wrap('<div class="roundedContainer"></div>');
		$('.roundedContainer').prepend('<div class="topCorners"></div>');
		$('.roundedContainer').append('<div class="bottomCorners"></div>');
	}
	/*$('div.divPodContainer h3').insertAfter('div.divTextBody');
	
	$('div.divTextBody').wrapInner('<div class="divTextBodyContent"></div>');
	$('div.divTextBody').wrapInner('<div class="divTextBodyTop"></div>');
	$('div.divTextBody').wrapInner('<div class="divTextBodyBottom"></div>');
	
	$('div.divPodContainer').wrapInner('<div class="divPodContainerContent"></div>');
	$('div.divPodContainer').wrapInner('<div class="divPodContainerTop"></div>');
	$('div.divPodContainer').wrapInner('<div class="divPodContainerBottom"></div>');
	
	$('div.column-right').wrapInner('<div class="column-right-content"></div>');
	$('div.column-right').wrapInner('<div class="column-right-top"></div>');
	$('div.column-right').wrapInner('<div class="column-right-bottom"></div>');
	
	$('div.divQuickContact').prepend('<h2>Quick Contact Form</h2>');
	
	$('div.column-right div.divPod').wrapInner('<div class="divPodContent"></div>');
	$('div.column-right div.divPod').wrapInner('<div class="divPodTop"></div>');
	$('div.column-right div.divPod').wrapInner('<div class="divPodBottom"></div>');
	*/
}

$(document).ready(function () {
	addBookmark();
	//showLanguage();
	formatHeader();
	//toggleSubNav();
	//roundCorners();
	/*$(".aCallNow").text('');
	resizeVideo();
	*/
});