$(document).ready(function() {

	//function for opening facebox content
	//cnt_string is placeholder until we create it via ajax
	
	//to turn off the facebox popup, see the setTimeout call on line 46
	$.openFaceboxContent = function() {
	
		//modify this to change opacity
		$.facebox.settings.opacity = 0.8;
		var cnt_string = ' \
			<div style="width:465px;"> \
				<div id="old_logos"></div> \
				<div class="grayBox"> \
					<div> \
						<h4> a new name for an old friend </h4> \
						<p> \
							  The merger of Hearing &amp; Speech/Northwest Early Childhood Institute in 2003 coupled with the changing needs of children and families with social, emotional, and developmental challenges propelled the Institute into a period of unprecedented growth.\
						</p> \
						<p> \
							Our mission has expanded and we have outgrown our name . . . \
						</p> \
						<p> \
							<a href="http://artzcenter.org/wp-content/uploads/brand-brochure.pdf" target="_blank">If you want to learn more click here.</a> \
						</p> \
					</div> \
				</div> \
				<div id="new_logo"></div> \
			</div> \
		';
		jQuery.facebox(cnt_string);
	};
	
	/*	size changing function
		This will change size of all p tags that do not have a class of .dontSize
		.dontSize was added to the login button as well as the size buttons 
	*/
	$.change_size = function(entity) {
		var sizeTo 	= $(entity).attr("href");
		sizeTo 		= sizeTo.replace("#","");
		switch(sizeTo) {
			case 'small':
				var sizeNum = 13;	//small font-size
			break;
			
			case 'medium':
				var sizeNum = 16;	//medium font-size
			break;
			
			case 'big':
				var sizeNum = 20;	//large font-size
			break;
			default:
				var sizeNum = 13; 	//coincides with default p size just in case
		}
		
		$("p:not(.dontSize)").css({'font-size': sizeNum});
		$("li:not(.dontSize)").css({'font-size': sizeNum});

	};
	
	$("a.size_change").each(function() {
		$(this).click(function() {
			$.change_size(this);
			return false;
		});
	});

	//search box value (needs to tie in with #searchbox value)
	var searchBoxVal = $("#searchbox").val();
	//search box focus
	$("#searchbox").focus(function() {
		if( $("#searchbox").val()==searchBoxVal)
			$("#searchbox").val('');
	});
	//search box blur
	$("#searchbox").blur(function() {
		if( $("#searchbox").val()=='')
			$("#searchbox").val(searchBoxVal);
	});
	
	//add no border to right nav element
	$("#topNavBar li:last a").each(function() {
		$(this).css({'border-right' : 'none'});
	});
	
	//no border on nav
	$("#mainNavBar li:last a").each(function() {
		$(this).css({'border-right' : 'none'});
	});
	
	/*
		functions.php > check_popup() is now responsible for the homepage
		popup. Cannot be controlled from here.
	*/
	//$("#new_name").click(function(){ $.openFaceboxContent(); return false;});
});