﻿//-- nav functions --//

var mmh = false;
var pih = false;
var bus = false;

$(document).ready(function(){
	
	// take away background for .nav_2 on IE
	if ($.browser.msie) $('.nav_2').css({backgroundImage:'none', backgroundColor:'#ffffff'});
	
	$('#what_is_your_issue').click(function(){
		$('.toplevel > a:not(this)').removeClass('on');
		$(this).addClass('on');
		$('.nav_1:not(#what_is_your_issue_more)').slideUp('slow', function() {
		$('#what_is_your_issue_more').slideDown('slow');
		});
	});	
	$('#why_you_need_us').click(function(){
	$('.toplevel > a:not(this)').removeClass('on');
		$(this).addClass('on');
		$('.nav_1:not(#why_you_need_us_more)').slideUp('slow', function() {
		$('#why_you_need_us_more').slideDown('slow');
		});
	});
	$('#get_started').click(function(){
	$('.toplevel > a:not(this)').removeClass('on');
		$(this).addClass('on');
		$('.nav_1:not(#get_started_more)').slideUp('slow', function() {
		$('#get_started_more').slideDown('slow');
		});
	});
	$('#meet_our_firm').click(function(){
	$('.toplevel > a:not(this)').removeClass('on');
		$(this).addClass('on');
		$('.nav_1:not(#meet_our_firm_more)').slideUp('slow', function() {
		$('#meet_our_firm_more').slideDown('slow');
		});
	});

	$('.toplevel > a').hover(function() {
		$('.nav_2').stop();
		$('.more').removeClass('subon');
		$('.nav_2').css({ width:'0px', opacity:'0', zIndex:'5' });
	}, function(){});
	$('.secondlevel > a:not(.more)').hover(function() {
		$('.nav_2').stop();
		$('.more').removeClass('subon');
		$('.nav_2').css({ width:'0px', opacity:'0', zIndex:'5' });
	}, function(){});
	
	$('#what_is_your_issue_medical_mistakes').hover(function(){
		mmh = true;
		$(this).addClass('subon');
		$('#what_is_your_issue_medical_mistakes_more').animate({ width: '220px', opacity: '1', zIndex: '10' }, 500);
	}, function(){});

	$('#what_is_your_issue_personal_injury').hover(function() {
		pih = true;
		$(this).addClass('subon');
		$('#what_is_your_issue_personal_injury_more').animate({ width: '200px', opacity: '1', zIndex: '10' }, 500);
	}, function(){});

	$('#what_is_your_issue_business_transactions').hover(function() {
		bus = true;
		$(this).addClass('subon');
		$('#what_is_your_issue_business_transactions_more').animate({ width: '200px', opacity: '1', zIndex: '10' }, 500);
	}, function(){});

	$('#what_is_your_issue_medical_mistakes_more').hover(function() {
		mmh = true;
	},function(){
		mmh = false;
		setTimeout(function(){
			if (!mmh)
			{
			  $('#what_is_your_issue_medical_mistakes').removeClass('subon');

			  if (jQuery.browser.msie) $('#what_is_your_issue_medical_mistakes_more').css({ width: '0px', zIndex: '5', display: 'none' });
			  else $('#what_is_your_issue_medical_mistakes_more').animate({ width: '0', opacity: '0', zIndex: '5' }, 500);
			}
		}, 500)
	});

	$('#what_is_your_issue_personal_injury_more').hover(function() {
		pih = true;
	},function(){
		pih = false;
		setTimeout(function(){
			if (!pih)
			{
			  $('#what_is_your_issue_personal_injury').removeClass('subon');

			  if (jQuery.browser.msie) $('#what_is_your_issue_personal_injury_more').css({ width: '0px', zIndex: '5', display: 'none' });
			  else $('#what_is_your_issue_personal_injury_more').animate({ width: '0px', opacity: '0', zIndex: '5' }, 500);				
			}
		}, 500)
	});

	$('#what_is_your_issue_business_transactions_more').hover(function() {
		bus = true;
	},function(){
		bus = false;
		setTimeout(function(){
			if (!bus)
			{
			  $('#what_is_your_issue_business_transactions').removeClass('subon');

			  if (jQuery.browser.msie) $('#what_is_your_issue_business_transactions_more').css({ width: '0px', zIndex: '5', display: 'none' });
			  else $('#what_is_your_issue_business_transactions_more').animate({ width: '0px', opacity: '0', zIndex: '5' }, 500);				
			}
		}, 500)
	});
	
	
	
	// Font Resizing
	// Reset Font Size
  var originalFontSize = $('body').css('font-size');
    $(".resetFont").click(function(){
    $('body').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
    var currentFontSize = $('body').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.1;
    $('body').css('font-size', newFontSize);
    return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
    var currentFontSize = $('body').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.9;
    $('body').css('font-size', newFontSize);
    return false;
  });

	
	
});


function toggleDiv(obj){ $(obj).slideToggle("slow"); }
