	var currentsel = 0;
	
	$(document).ready(function(){
  	var default_text = "Search"
    $('#searchbox').val(default_text);
	  $('#searchbox').focus(function(){
	 	  if ($(this).val() === default_text){
		    $(this).val("");
	 	  }
	 	});
	  $('#searchbox').blur(function(){
	  	if ($(this).val() === ""){
	  		$(this).val(default_text);
	  	}
	  });
	  
	  $('.children-overview').show();
	  
	  $('.learnmore, #loginBtn, #footerLoginBtn').hover(function(){
	  		  $(this).stop();
	  		  $(this).animate({ backgroundColor:"#6fa296" }, 200);
	  		  $(this).find("span").stop();
	  		  $(this).find("span").animate({ color:"#ffffff" }, 200);
		  }, function(){
		  	  $(this).stop();
		  	  $(this).animate({ backgroundColor:"#373737" }, 300);
		  	  $(this).find("span").stop();
	  		  $(this).find("span").animate({ color:"#6fa296" }, 300);
          });
          
          $('#top-nav a').hover(function(){
          		  if($(this).attr("class") != "current") {
				  $(this).stop();
				  $(this).animate({ color:"#ffffff" }, 200);
			  }
		  }, function(){
		  	  if($(this).attr("class") != "current") {
				  $(this).stop();
				  $(this).animate({ color:"#aab3b8" }, 300);
			  }
          });
          
          $('#jk_login').click(function(){
          	$("#footer").after("<div id=\"loginBG\"></div>");
          	$("#loginBG").css("opacity", 0);
          	$("#loginBG").animate({ opacity: "0.75" }, 200);
          	$('#loginBG').click(function(){
      			$(this).animate({ opacity: "0" }, 100, "linear", function(){
  				$(this).remove();
       			});
       			$("#loginBox").animate({ height: 'hide' }, 100);
			return(false);
		});
          	
		$("#loginBox").animate({ height: 'show' }, 200);
		//$("#loginBox p.footer-heading").html($(this).html());
          	return(false);
          });
	  
          /* accordion behavior for menus, disabled due to request
	  $('#navigation ul li.haschild, #navigation ul li.last-haschild').click(
	  	function(){
	  		var child_id = $(this).attr("id");
	  		var parent_class = $(this).attr("class");
	  		var link = $(this).find("a");
	  		if (child_id !== ""){
	  			var menu_id = child_id.search('menu-');
	  			var menu_name = 'menu-';
	  			var child_name = '';
	  			if (menu_id > 0){
	  				menu_name = 'custom-menu-';
	  				child_name = 'custom-';
	  			}
	  			child_id = child_id.replace(menu_name,'');
	  			
	  			//alert($('#children-'+child_id).find("ul").attr("class"));
	  			
	  			var any_open = false;
	  			$.each($('#navigation ul li.open'), function(){
	  				if($(this).find("ul").attr("class") === "children") {
  						$(this).find("ul").removeClass("children");
  						$(this).find("ul").addClass("children-current");
  						$(this).css("display", "none");
  					}
  					if($(this).css("display") !== "none") {
  						any_open = true;
  					}
  					else {
  						$(this).css("opacity", "0");
  					}
  				});
  				
				$("#navigation a").removeClass("on");
	  			
	  			$.each($('#navigation ul li.open'), function(){
	  				var item_id = $(this).attr("id").replace("children", "menu");
  					if($(this).attr('id') === child_name+'children-'+child_id) {
  						if($(this).css("display") === "none") {
  							$(link).addClass("on");
	  						if(any_open) {
								$(this).css("margin-bottom","10px");
								$(this).animate({margin:"0"},400,"linear", function(){
									$("#"+item_id).css("background-image", "url('/images/arrow-todown-green.gif')");
									$(this).animate({ opacity: 1, height: 'show' }, 600);
								});
							}
							else {
								$("#"+item_id).css("background-image", "url('/images/arrow-todown-green.gif')");
								$(this).animate({ opacity: 1, height: 'show' }, 600);
							}
	  					}
	  					else {
	  						$("#"+item_id).css("background-image", "url('/images/arrow-right-green.gif')");
	  						$(this).animate({ opacity: 0, height: 'hide' }, 400);
	  					}
  					}
  					else {
  						if($(this).css("display") !== "none") {
  							$("#"+item_id).css("background-image", "url('/images/arrow-right-green.gif')");
  							$(this).animate({ opacity: 0, height: 'hide' }, 400);
						}
  					}
	  			});
	  			
	  			//
	  			if ($('#'+child_name+'children-'+child_id).find("ul").attr("class") === "children-current"){
	  				$(link).removeClass("on");
	  				
	  				$('#navigation ul li.open').slideUp(500);
	  				$('#navigation ul li.open ul').removeClass("children-current");
	  				$('#navigation ul li.open ul').addClass("children");
	  				
	  			}
	  			else{
	  				$('#navigation a').removeClass("on");
	  				$('#navigation ul li.open').slideUp(400);
	  				$('#navigation ul li.open ul').removeClass("children-current");
	  				$('#navigation ul li.open ul').addClass("children");
	  				$(link).addClass("on");
	  				$('#'+child_name+'children-'+child_id).slideDown(600);
	  				$('#'+child_name+'children-'+child_id).find("ul").removeClass("children");
	  				$('#'+child_name+'children-'+child_id).find("ul").addClass("children-current");
	  				$('#'+child_name+'children-'+child_id).find("ul").slideDown();
	  			}
	  			//
	  			
	  		}
	  		return false;
	  	}
	  );
	*/
	  
       // animates the descriptive text on portfolio thumbnail hover 
	  $('span.portfolio-image-bg').fadeTo("fast",0.80);
		
		$('div.portfolio-row a').hover(function(){
			$(this).find('span.portfolio-image span').animate({ 
				left: '0px'
			}, 200 );
		},
		function(){
			$(this).find('span.portfolio-image span').animate({ 
				left: '-250px'
			}, 100 );
		});
		
		// handles tab content display
		$('.page-tabs-content').hide();
		$('.page-tabs a').click(function(){
			var hash = $(this).attr('href').replace('#','');
			$('.page-tabs a').removeClass('active');
			$('.page-tabs li').removeClass('active');
			$(this).addClass('active');
			$('.page-tabs-content').hide();
			$('.page-tabs-content#tabcontent-' + hash).fadeIn();
			//$(this).parent().addClass('active');
		});
		
		var hash = document.location.hash.replace('#','');
		if(hash){
			$('.page-tabs a[href="#' + hash + '"]').click();
		} else {
			$('.page-tabs a:first').click();
		}
  });
	
	function hide_items(selector){
		var lis = $('#'+selector+' ul li');
		var i = 1;
		for(i;i<lis.length;i++){
			lis[i].style.left = "900px";
		}
	}
	
	function slideit(dir,selector){
		var lis = $('#'+selector+' ul li');
		var prev = currentsel;
		var curfrom = '-900px';
		var prevto = '900px';
		
		if(dir == 'fwd'){
			currentsel++;
			currentsel = (currentsel > lis.length - 1) ? 0: currentsel;
			curfrom = '900px';
			prevto = '-900px';
		} else {
			currentsel--;
			currentsel = (currentsel < 0) ? lis.length - 1: currentsel;
		}
		
		lis[prev].style.left = '0px';
		lis[currentsel].style.left = curfrom;
		$(lis[prev]).animate({left: prevto},{queue:false,duration:500});
		$(lis[currentsel]).animate({left:'0px'},{queue:false,duration:500});
		/*
		$(lis[prev]).animate(
		  {"left": prevto,"opacity": .2}, 500,
      function(){
      	$(lis[prev]).fadeTo("slow",1);
      }
		);
		$(lis[currentsel]).animate(
		  {"left": "0px","opacity": .2}, 500,
      function(){
      	$(lis[currentsel]).fadeTo("slow",1);
      }
		);
		*/
  }
