jQuery(document).ready(function() {

	// Document Ready Stuff Below (jQuery)
	
	/* ----- Activate Quovolver ----- */
	jQuery('#quote_container blockquote').quovolver(800, 10000);

	/* ----- Table of Contents ----- */
	
	jQuery('.table_of_contents_btn').addClass('active').click(function() {
	
		jQuery(this).toggleClass('active');
		jQuery('.table_of_contents').slideToggle();
		return false;
		
	});
	
	jQuery('.table_of_contents a').anchorAnimate();
	
	/* ----- Activate Popup ----- */
	
	equalHeight(jQuery('.charts_desc, .charts'));
	
	jQuery('.charts_desc .graph_item_01 .info_box').clone()
		.insertAfter('.charts .graph_item_01 .target');
	jQuery('.charts_desc .graph_item_02 .info_box').clone()
		.insertAfter('.charts .graph_item_02 .target');
	jQuery('.charts_desc .graph_item_03 .info_box').clone()
		.insertAfter('.charts .graph_item_03 .target');
	jQuery('.charts_desc .graph_item_04 .info_box').clone()
		.insertAfter('.charts .graph_item_04 .target');
	jQuery('.charts_desc .graph_item_05 .info_box').clone()
		.insertAfter('.charts .graph_item_05 .target');
	jQuery('.charts_desc .graph_item_06 .info_box').clone()
		.insertAfter('.charts .graph_item_06 .target');
	
	jQuery('.target').popup();
	
	/* ----- Wrap Comments ----- */
	
	jQuery('.comment-body').each(function() {
		jQuery(this).find('p').wrapAll('<div class="the_comment"></div>');
	});
	jQuery('.the_comment').append('<span class="comment_image"></span>');
	
	/* ----- Media Page Shit ----- */
	
	jQuery('#media .flashmovie')
		.appendTo('#media_container')
		.hide()
		.filter(':first')
		.show();
	
	jQuery('#media_listing li')
		.filter(':first')
		.addClass('active');
	
	jQuery('#media_listing li').click(function() {
	
		jQuery('#media_listing li').removeClass('active');
		jQuery(this).addClass('active');
		
		jQuery('#media .flashmovie').hide();
		
		active_item = this;
				
		jQuery(this).parent().children().each(function(i) {
			if (active_item == this) {
				jQuery('#media .flashmovie:eq('+(i)+')').show();
			}
		});
		
	});
	
	/* ----- Homepage Graph Hover Bindings ----- */
		
	jQuery('.graph_item_01').hover(
		function() { jQuery('.graph_item_01').addClass('active'); }, 
		function() { jQuery('.graph_item_01').removeClass('active'); }
	);
	
	jQuery('.graph_item_02').hover(
		function() { jQuery('.graph_item_02').addClass('active'); },
		function() { jQuery('.graph_item_02').removeClass('active'); }
	);
	
	jQuery('.graph_item_03').hover(
		function() { jQuery('.graph_item_03').addClass('active'); },
		function() { jQuery('.graph_item_03').removeClass('active'); }
	);
	
	jQuery('.graph_item_04').hover(
		function() { jQuery('.graph_item_04').addClass('active'); },
		function() { jQuery('.graph_item_04').removeClass('active'); }
	);
	
	jQuery('.graph_item_05').hover(
		function() { jQuery('.graph_item_05').addClass('active'); },
		function() { jQuery('.graph_item_05').removeClass('active'); }
	);
	
	jQuery('.graph_item_06').hover(
		function() { jQuery('.graph_item_06').addClass('active'); },
		function() { jQuery('.graph_item_06').removeClass('active'); }
	);
	
	/* ----- number chart ----- */
	
	jQuery('.charts_desc .numbers').click(function() { return false; });
	
	jQuery('.graph_vert_01').hover(
		function() { jQuery('.graph_vert_01').addClass('active'); },
		function() { jQuery('.graph_vert_01').removeClass('active'); }
	);
	
	jQuery('.graph_vert_02').hover(
		function() { jQuery('.graph_vert_02').addClass('active'); },
		function() { jQuery('.graph_vert_02').removeClass('active'); }
	);
	
	jQuery('.graph_vert_03').hover(
		function() { jQuery('.graph_vert_03').addClass('active'); },
		function() { jQuery('.graph_vert_03').removeClass('active'); }
	);
	
	jQuery('.graph_vert_04').hover(
		function() { jQuery('.graph_vert_04').addClass('active'); },
		function() { jQuery('.graph_vert_04').removeClass('active'); }
	);
	
	jQuery('.graph_vert_05').hover(
		function() { jQuery('.graph_vert_05').addClass('active'); },
		function() { jQuery('.graph_vert_05').removeClass('active'); }
	);
	
	/* ----- Accordion Sidebar Items 2 ----- */
	
	jQuery('.product_details').hide();
	
	jQuery('.view_details a').addClass('accordion closed').click(function() {
		jQuery(this).toggleClass('open').toggleClass('closed').parent().parent().parent().next('.product_details').slideToggle();
		return false;
	});	

	/* ----- drop down login form ----- */
	
	jQuery('#login_error').animate({opacity: 1.0}, 3000).slideUp('slow', function() { jQuery(this).remove(); });
	
	/* ----- drop down site menu ----- */
	
	// initiation stuff
	var btn = '#menu span.network a';
	var list = '#site_listing';
	var tr = '#site_listing tr';
	
	// dropdown btn 
	jQuery(btn).click(function () {
      if (jQuery(list).is(':hidden')) jQuery(list).fadeIn();
      else jQuery(list).fadeOut();
      return false;
    });
    
    // slide up on mouseOut from menu
	jQuery(list).hover( 
		function() { },
  		function() { jQuery(this).animate({opacity: 1.0}, 500).fadeOut();
    });
    
    // give table rows hover effects
	jQuery(tr).hover(
	  function () { jQuery(this).addClass('hover'); },
	  function () { jQuery(this).removeClass('hover'); }
	);
	
	
	/* ----- footer entire block clickable ----- */
	jQuery('#footer_links li').click(function() {
		window.location=jQuery(this).find('a').attr('href');
		return false;
	});
	
	
	/* ----- equal height banner elements ----- */
	
	// fund number of elements
	// var banElem = jQuery('.section_element').size();
	
	// set proper widths and heights
	jQuery('.section_element').css({ height: jQuery('#banner_menu').height() });
	// jQuery('#section_wrap').css({ width: ((jQuery('.section_element').width()) * (banElem)) });
		
});