$(document).ready(function(){
	// this sets which service should not be hidden
	var startingService = "webdesign";
	var whereIsPound = window.location.toString();
	var timer = 0;
	whereIsPound = whereIsPound.indexOf("#");

	if(whereIsPound != -1){
		var theLocation = window.location.toString();
		startingService = theLocation.substring(whereIsPound+1, theLocation.length);
	}
	
	$("div.cb_white_med").each(function(){
		if($(this).attr("id") != startingService){
			$(this).hide();
		}
	});
	$("div.rightMenu > a").each(function(){
		if($(this).attr("href") == "#"+startingService){
			$(this).attr("class", "current");
		}
	});
	
	$("div.rightMenu > a").click(function(){
		var clickedServiceID = $(this).attr("href");
		//$("div.cb_white_med").slideUp("slow");
		$("div.cb_white_med").fadeOut("slow");
		//$(clickedServiceID).slideToggle("slow");
		//$(clickedServiceID).fadeIn("slow");
		var pass = function(){fadeContentIn(clickedServiceID);};
		timer = setInterval (pass, 1000);
		
		/*var siblingArray = ($(this).parent().children());
		for(var i=0; i < siblingArray.length - 1; i++){
			alert(siblingArray[i].class);
		}*/
		$("div.rightMenu > a").each(function(){
			$(this).attr("class", "");
		});
		$(this).attr("class", "current");
		
		return false;
	});
	function fadeContentIn(serviceID){
		clearInterval(timer);
		$(serviceID).fadeIn("slow");
	}
});