// JavaScript Document



jQuery().ready(function (){
						 
	// fix buttons 
	$("INPUT:submit").addClass("button");
	$("INPUT:button").addClass("button");
	$("INPUT:checkbox").addClass("checkbox");
	$("INPUT:radio").addClass("checkbox");
	
	// ACTIVATE NAV
	var navItem = "#" + section;
	$(navItem).addClass("on");
	console.log($(navItem));

	var navItem = "#" + page;
	$(navItem).addClass("on");
	
	var navItem = "#" + subpage;
	$(navItem).addClass("on");
	
	var navItem = "#" + subsubpage;
	$(navItem).addClass("on");	
	
	if (page == "case") {
		ufaq.init(".faq");
	}
	
	
	
	// ADD DROPSHADOWS
	var showMenuShadows = true;
	var showSubShadows = false;
	if($.browser.msie) { 
		showSubShadows = false;			// dont' show sub shadows on IE
		if (jQuery.browser.version < 7) { // dont' show menu shadows on IE 6
			showMenuShadows = false;		
		}
	}
	
	
	function addShadows() {
	if (showMenuShadows) {
		var pageTitle = $(".pageTitle");
		$(pageTitle).dropShadow({left: 1, top: 1, blur: 1, color: "#000", opacity: 0.6});
		
	}}
	
	/*
	
	$('.navmenu ul a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-225px 0)",color:"#FFFFFF"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-500px 0)",color:"#4a3f37"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})
	$('.navside ul li a').addClass("tlSide");
	$('.navside ul ul li a').removeClass("tlSide");
	$('.navside ul li.on a').removeClass("tlSide");
	
	//console.log($(".tlSide"));
	
	$('.tlSide')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-225px 0)",color:"#FFFFFF"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-500px 0)",color:"#4a3f37"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})		

	*/
	var pTitle = $(".pageTitle");

	pTitle.css("top",0);
	//pTitle.animate({opacity: 'show',left:20}, {duration:500, complete:addShadows})
	pTitle.animate({opacity: 'show',top:78}, {duration:1300,easing:"easeOutCubic", complete:function() {addShadows();}})
	
	
	// force background update, since Hover is buggy
	$(".sf-menu a")	
		.mouseover(function(){
			if (!$(this).parent().hasClass("on") ) {				
				$(this).css("background-image","url(/assets/images/bg-navAnim.gif)");
				//$(this).stop().animate({color:"#ffe8b7"}, {duration:500})
			}
		})
		.mouseout(function(){
		   if (!$(this).parent().hasClass("on") ) {	
				$(this).css("background-image","url(/assets/imagesspacer.gif)");
				//$(this).stop().animate({color:"#4a3f37"}, {duration:500})
		   }
		})		
	$(".navside > UL > LI > a")	
		.mouseover(function(){
			if (!$(this).parent().hasClass("on") ) {				
				$(this).css("background-image","url(/assets/images/bg-navAnim.gif)");
			}
		})
		.mouseout(function(){
		   if (!$(this).parent().hasClass("on") ) {	
				$(this).css("background-image","url(/assets/imagesspacer.gif)");
		   }
		})			
});

function showOver(wImg) {
	wImg.src = wImg.src.replace("off","over");
	
}

function showOff(wImg) {	
	wImg.src = wImg.src.replace("over","off");
}

var toggle = false;
function toggleForm() {
	document.location="#pageForm";
	/*
	if (!toggle) {
		if($.browser.msie && jQuery.browser.version < 7) { 
			$('#pageForm').css("display","block");
		}
		else {
			$('#pageForm').show('slow');
		}
		toggle = true;
	}
	else {
		if($.browser.msie && jQuery.browser.version < 7) { 
			$('#pageForm').css("display","none");
		}
		else {
			$('#pageForm').hide('slow');
		}
		toggle = false;
	}*/
}