/* Author
Chase Foster of 303software
*/
jQuery(document).ready(function(){
	// used in photo galleries
	$(".colorbox").colorbox();
	//get sub cat
	//alert($("#sub-cat").text());
	$(".menu-expandable > div > div > ul li > a").filter( 
		function() 
		{
			return $(this).text().toUpperCase() == $.trim($("#sub-cat").text());
		}
	).parent().find('ul').show();
	// inline for colorbox grouped photos.
	//

	$(".inline").colorbox({inline:true, href:"#sgdata",initialWidth: "604px",intialHeight:"405px",innerHeight:"397px",scolling:"false"});
	$(document).bind('cbox_closed', function(){
			$("#sgdata").hide();
	});
	
	//$(".inline").colorbox({inline:true, href:"#sgdata",width: "620px",height:"496px"});
	//$("#smileGallery1 > div > a.inline").colorbox({inline:true, href:"#sgdata"});
	//$("#smileGallery2 > div > a.inline").colorbox({inline:true, href:"#sgdata"});
	//$("#smileGallery3 > div > a.inline").colorbox({inline:true, href:"#sgdata"});
	//$(".inline").colorbox({inline:true, href:"this > div"});
	//$(".menu-expandable > div > div > ul li > a").filter( function() { return $.trim( $(this).text().toUpperCase(); ) == $("#sub-cat").text();}).parent().find('ul li').slideDown();
	// animations for expandable menus
	/*$(".menu-expandable > div > div > ul > li > a").bind("click", function(){
		$(".menu-expandable > div > div > ul > li > ul > li").slideUp(1300);
		$(".menu-expandable > div > div > ul > li > ul").slideUp(1300);
		$(this).parent().find('ul').slideDown(1300);
		$(this).parent().find('ul li').slideDown(1300);
		return false;
	});
	*/
	if($.trim($('#top-slug').text()) == 'our-services')
	{
		
		$("#main-nav > div > ul > li > a").filter( function() {return $.trim( $(this).text().toLowerCase() ) =='our services'}).parent().addClass('current-menu-item');
	}
		if($.trim($('#top-slug').text()) == 'patient-library')
	{
		$("#main-nav > div > ul > li > a").filter( function() {return $.trim( $(this).text().toLowerCase() ) =='patient library'}).parent().addClass('current-menu-item');
	}
	$(".menu-expandable div div ul li ul li.current-menu-item").show(0,function(){$(this).children('a').css('font-weight','bold')});
	$(".menu-expandable div div ul li ul li").show();
	$(".current-menu-item").parent('ul').show();
	
	//Gallery
	if( $("div#gallery-images").length){
		$("#gallery-images > div:first").slideDown(1500);
	}
	

	$("#showcomments").click(function() {
	  $("#comments").slideDown();
	});
	
	
	$('#tagcloud  a').each(function() {
		if( ($(this).text()) == $('.page-title span').text()){
			$(this).css('font-weight','bold');
		}
  });
  
  	$('#archives  ul li a').each(function() {
		if( ($(this).text()) == $('.blogleft h1').text()){
			$(this).css('font-weight','bold');
		}
  });

	
	
	
});
function colorboxLoadData(theid){
		$('#sgdata').html($('#' + theid).html());
		$("#sgdata").show();
}
function showImg(theid){
	$('#gallery-images div').hide();
	$('#gallery-img-' + theid).slideDown(1500);
}
function displayGallery(n){
	$(".smileGalleryData").hide();
	$("#smileGallery" + n).fadeIn();
}

