$(document).ready(function(){	
	$("#navlist > li").hover(
		function () {
			var idx = $("#navlist > li").index(this);
			$("#overlays-inner .overlay").eq(idx).addClass("hover");
			$(this).addClass("hover");
			$("#footer-innercontainer .footercol").eq(idx).addClass("hover");
		},
		function () {
			var idx = $("#navlist > li").index(this);
			$("#overlays-inner .overlay").eq(idx).removeClass("hover");
			$(this).removeClass("hover");
			$("#footer-innercontainer .footercol").eq(idx).removeClass("hover");
		}
	);
	$("#navlist > li:last").hover(
		function(){
			$("#logo").addClass("hover");
		},
		function(){
			$("#logo").removeClass("hover");
		}
	);
	
	var pagedimensions = xDocSize();
	$("#overlays").css("min-height",pagedimensions.maxh);
	$(".overlay").css("min-height",pagedimensions.maxh);
	

	$("#fileclaimlink img").click(function () {
		if ($("#contactslider").is(":hidden")) {
		$("#contactslider").slideDown();
		} else {
		$("#contactslider").slideUp();
		}
	});
});

function clearDefault(el) {
if (el.defaultValue==el.value){el.value = "";}
}
function returnDefault(el){
if (el.value==""){el.value=el.defaultValue;}
}
function xDocSize()
{
  var b=document.body, e=document.documentElement;
  var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
  if (e) {
    esw = e.scrollWidth;
    eow = e.offsetWidth;
    esh = e.scrollHeight;
    eoh = e.offsetHeight;
  }
  if (b) {
    bsw = b.scrollWidth;
    bow = b.offsetWidth;
    bsh = b.scrollHeight;
    boh = b.offsetHeight;
  }
  //alert('compatMode: ' + document.compatMode + '\n\ndocumentElement.scrollHeight: ' + esh + '\ndocumentElement.offsetHeight: ' + eoh + '\nbody.scrollHeight: ' + bsh + '\nbody.offsetHeight: ' + boh + '\n\ndocumentElement.scrollWidth: ' + esw + '\ndocumentElement.offsetWidth: ' + eow + '\nbody.scrollWidth: ' + bsw + '\nbody.offsetWidth: ' + bow);
  return {escrollw:esw,eoffsetwidth:eow,bodyscrollw:bsw,bodyoffsetw:bow,escrollh:esh,eoffseth:eoh,bodyscrollh:bsh,bodyoffseth:boh,maxw:Math.max(esw,eow,bsw,bow),maxh:Math.max(esh,eoh,bsh,boh)};
  
  
}

$("#extra-text").click(function () {
	if ($("#extra-more").is(":hidden")) {
	$("#extra-more").slideDown("slow");
	} else {
	$("#extra-more").hide();
	}
});


 $(".morelink").live("click", function () {
		$(this).removeClass("morelink");
		$(this).addClass("lesslink");
		$(this).parent().removeClass("moreli");
		$(this).parent().addClass("lessli");
		if($(this).parent().attr('class') == 'preview'){ // --- Read More link on the about page
			$(this).parent().next().slideDown();
			$(this).parent().prev().prev().prev().animate({width: 225});
			$(this).parent().prev().prev().removeClass("morelink");
			$(this).parent().prev().prev().addClass("lesslink");
		} else if($(this).parent().parent().next().attr('class') == 'more'){ // --- Read More in uls of attorneys
			$(this).parent().parent().next().slideDown();
		} else if($(this).parent().next().attr('class') == 'more'){ // --- Read More link on about page
			$(this).parent().next().slideDown();
		} else if($(this).parent().parent().next().next().hasClass('more')){ // --- Read More in uls of experience page
			$(this).parent().parent().next().next().slideDown();
		}
		if($(this).text() == '(Read More)'){$(this).text("(Hide)");}
	});
	$(".lesslink").live("click", function () {
		$(this).removeClass("lesslink");
		$(this).addClass("morelink");
		$(this).parent().removeClass("lessli");
		$(this).parent().addClass("moreli");
		if($(this).parent().attr('class') == 'preview'){ // --- Read More link on the about page
			$(this).parent().next().slideUp();
			$(this).parent().prev().prev().prev().animate({width: 125});
			$(this).parent().prev().prev().removeClass("lesslink");
			$(this).parent().prev().prev().addClass("morelink");
		} else if($(this).parent().parent().next().attr('class') == 'more'){ // --- Read More link in uls of attorneys
			$(this).parent().parent().next().slideUp();
		} else if($(this).parent().next().attr('class') == 'more'){ // --- Read More link on about page
			$(this).parent().next().slideUp();
		} else if($(this).parent().parent().next().next().hasClass('more')){ // --- Read More in uls of experience page
			$(this).parent().parent().next().next().slideUp();
		}
		if($(this).text() == '(Hide)'){$(this).text("(Read More)");}
	}); 
	$("#pg_head .pg_off").live("click", function () {
		$("#practice_group").slideDown();
		$(this).removeClass('pg_off');
		$(this).addClass('shown');		
	});
	$("#pg_head .shown").live("click", function () {
		$("#practice_group").slideUp();							
		$(this).removeClass('shown');
		$(this).addClass('pg_off');		
	});
	
	
	
