jQuery(document).ready(function($) { 
	
	
//  for home icon in main nav...

	$('#menu-item-109').html('<a href="/"><img src="/wp-content/themes/USB_Insert/images/icon_home.png" alt="home" />');

	$('#menu-main-nav li:last-child').addClass("last-item");


	 // for equal height homepage columns (anything wrapped in  <div class="equal_height">
	 function setEqualHeight(columns)
	  {
	  var tallestcolumn = 0;
	  columns.each(
	  function()
	  {
	  currentHeight = $(this).height();
	  if(currentHeight > tallestcolumn)
	  {
	  tallestcolumn  = currentHeight;
	  }
	  }
	  );
	  columns.height(tallestcolumn);
	  }
	 $(document).ready(function() {
	  setEqualHeight($(".equal_height  > div"));
	 });


	 // stop equal height columns

	 	
	 
// scrollable for home rotator
	 
	// custom easing called "custom"
	 $.easing.custom = function (x, t, b, c, d) {
	 	var s = 1.70158; 
	 	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	 	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	 }


	// initialize scrollable
	 $("#home_rotator").scrollable({easing: 'custom', speed: 700, circular: true}).autoscroll({ autoplay: true, interval: 6500 });
//	$("#home_rotator").scrollable({easing: 'custom', speed: 700, circular: true}).autoscroll({
//		interval: 7000		
//	});

// stop scrollable
	

	
// cookie logic for homepage roadblock
	

	// delicious cookie for bar_status open or closed...
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

/*
	$("a.close_bar").click(function()
		{
			createCookie('bar_status', 'closed', '1');
			$("#site-bottom-bar").animate({"bottom": "-50px"}, 2000);
			$("img.open_bar").animate({"bottom": "60px"}, 1500);
			return false;
	});

	$("a.open_bar").click(function()
		{
			createCookie('bar_status', 'opened', '1');
			$("#site-bottom-bar").animate({"bottom": "0px"}, 2000);
			$("img.open_bar").animate({"bottom": "-60px"}, 1500);
			return false;
	});

*/

	function eraseCookie(name) {
		createCookie(name,"",-1);
//		window.location = "/fundraiser/";
	}
		
		
// stop cookie for homepage roadblock


// resize embeds/objects
	
	/// Resize embeds
	var maxEmbedWidth = 530;
	 $(".video_wrap object, .video_wrap embed").each(function (i) {
	    var ow = $(this).attr('width');
		var oh = $(this).attr('height');
		if(ow > maxEmbedWidth){
			var s = maxEmbedWidth/ow;
			var nw = Math.floor(ow *s);
			var nh = Math.floor(oh * s);
			$(this).attr('width', nw);
			$(this).attr('height',nh);
			}
	});	
	
	
	
	// use the custom easing
//	 $("div#home_rotator").scrollable({easing: 'custom', speed: 700, circular: true});
	
	
// logic for MORE menu 
/*
	if ( $('li.menu-item').children('ul.sub-menu') ) {
		 $('li.menu-item').addClass('hasSubMenu'); 
	}
*/
	
/*	
	$('li.menu-item').children('ul.sub-menu').parent().addClass('hasSubMenu');
	
	
    $("ul.sub-menu").mouseover(function() {
    	$(this).parent().addClass('top_sub_item_left');
    	$(this).siblings().addClass('top_sub_item_right');
    	//alert('blahClass added somewhere');
    });
    
    $("ul.sub-menu").mouseout(function() {
    	$(this).parent().removeClass('top_sub_item_left');
    	$(this).siblings().removeClass('top_sub_item_right');
    	//alert('blahClass added somewhere');
    });
*/
    

    
// append class to even schedule events
//    $("div.faux_bg:even").addClass("even_row");    
    


 // for equal height homepage columns (anything wrapped in  <div class="equal_height">
    /*
 function setEqualHeight(columns)
  {
  var tallestcolumn = 0;
  columns.each(
  function()
  {
  currentHeight = $(this).height();
  if(currentHeight > tallestcolumn)
  {
  tallestcolumn  = currentHeight;
  }
  }
  );
  columns.height(tallestcolumn);
  }
 $(document).ready(function() {
  setEqualHeight($(".equal_height  > div"));
 });
*/

 // stop equal height columns

	 
 
// for email signup form clear on focus...

 /*
 $("#fieldformBuilderFieldEmail").focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});

*/

	

 
}); // STOP JQUERY





