$(document).ready(function(){
	$(".servicesbox ul li:odd a").css({"color":"#362783 !important", "font-weight":"bold"});
	$(".servicesbox ul li:even a").css({"color":"#438B73 !important", "font-weight":"bold"});
	$("#navigation li").children("a").css({"font-weight":"bold"});
	
	$(".staff").live("click", function(event) {
		event.preventDefault();
		var that=$(this);
		alert("wtu");
		$("#card_image").html(that.children(".staff_image").html());
		$("#card_name").html(that.children(".staff_name").html());
		$("#card_title").html(that.children(".staff_title").html());
		$("#card_office").html(that.children(".staff_office").html());
		$("#card_phone").html(that.children(".staff_phone").html());
		$("#card_email").html(that.children(".staff_email").html());
		$("#card_bio").html(that.children(".staff_bio").html());
		$("#card_linkdin").html(that.children(".staff_linkdin").html());
		//alert();
		$("#card").css({"left": ($(window).width()/2)-($("#card").width()/2)+"px", "top":($(window).height()/2)-($("#card").height()/2)+$(window).scrollTop()+"px"}).show();
	});
	
	$(".close_card").live("click", function(event) {
		event.preventDefault();
		$("#card").hide();
	});
	
	$(".box_title").live("click", function() {
		$(this).next().animate({"height":"400px"}, "slow");
		$("#business").children(".servicesbox").animate({"height":"0px"}, "slow");
	});
	
	$(".box_title_business").live("click", function() {
		$(this).next().animate({"height":"400px"}, "slow");
		$("#you").children(".servicesbox").animate({"height":"0px"}, "slow");
		//$("#you").children(".servicesbox").animate({"height":"0px"}, "slow");
	});
	
	workTheMenu();
});

var ie4 = document.all;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all; 

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function workTheMenu() {
	if (readCookie("type")=="you") {
		$("#business").children(".servicesbox").css({"height":"0px"});
	}
	else {
		$("#you").children(".servicesbox").css({"height":"0px"});
	}
}

function centerIt(div_id, show, div_height, div_width) {
	var center_height=0;
	var center_width=0;
	
	//For non IE browsers
	if (ns6 || ns4) {
  		center_width = (window.innerWidth/2)-(div_width/2);
  		center_height = (window.innerHeight/2)-(div_height/2);
	}
	else {
		center_width=(document.documentElement.clientWidth/2)-(div_width/2);
  		center_height=(document.documentElement.clientHeight/2)-(div_height/2);
 	}

	if (center_width<0) {
		center_width=0;
	}
	if (center_height<0) {
		center_height=0;
	}
	document.getElementById(div_id).style.left=center_width+"px";
	document.getElementById(div_id).style.top=center_height+"px";
	
	if (show==0) {
		document.getElementById(div_id).style.visibility='visible';
	}
}
