$(document).ready(function(){
	$("#selects input, #searchpanel select, #register #text input, #register textarea").bind("click", function(){
     		
  	var id = $(this).attr("id");
  	$("[@for='"+id+"']").addClass('hide');
   		
	  	$(this).bind("blur", function(){
  			if($(this).val() == "") $("[@for='"+id+"']").removeClass('hide');
  		});
   });
	$("#selects input, #searchpanel select, #register #text input, #register textarea").bind("focus", function(){
     		
  	var id = $(this).attr("id");
  	$("[@for='"+id+"']").addClass('hide');
   		
	  	$(this).bind("blur", function(){
  			if($(this).val() == "") $("[@for='"+id+"']").removeClass('hide');
  		});
   });
	$("#subnav li").hover(
      function () {
		  if($(this).children("a").attr("href") != "") { 
			  var linkref = $(this).children("a").attr("href");
			  if(linkref != undefined) {
				$(this).addClass("over");
				window.status = linkref;			
				  $(this).bind("click", function(e){
				  window.location.href = linkref;
				});
			  }
	  	  }
      }, 
      function () {
        $(this).removeClass("over");
		window.status = "";
      }
    ); 
	var c = 0;
	$("#subnav li:last").addClass("last");
	$("#subnav li").each(function (i) {
		if($(this).hasClass("active") != true) {
			if(c%2) { $(this).addClass("pinkbg"); }
			else { $(this).addClass("redbg"); }
			c++;
		}
		else c++;
    });
	if($("#team")) {
		$("#team li").hover(
		  function () {
			  var linkref = $(this).children("a").attr("href");
			  if(linkref != undefined) {
				$(this).addClass("over");
				window.status = linkref;			
				  $(this).bind("click", function(e){
				  window.location.href = linkref;
				});
			  }
		  }, 
		  function () {
			$(this).removeClass("over");
			window.status = "";
		  }
		);
	}
});


//this one is important, many browsers don't reset scroll on refreshes
if($('#services').html() != null) { $.scrollTo( 0 ); } //reset the screen to (0,0)
			
function toggle(id, dur) {
	var $dur = dur;
	var $id = $('#'+id+'');
	$id.slideToggle("normal", function() {
		$.scrollTo($id, $dur);
	});
};

function bringIn()
{
 	$('#soundbite').remove();
	$('#right').fadeIn(1000, function() {
		$.scrollTo('#subnav', 500);								
	});
}

function OpenPDF(path) {
	window.open(path);
}

$(document).ready(function() {
    $('#backgroundfade').fadeOut(3000);
});

