/*

	HL2 2010 Redesign
	------------------

	@file 		what-we-do.js
	@version 	1.0.0b
	@date 		2010-03-04 16:33:19 -0800 (Thu, 4 Mar 2010)
	@author 	Marissa Wells <hello@marissawells.com>

	Copyright (c) 2010 HL2 <http://www.hl2.com>

*/

// **********************************
// ***** Custom jQuery scripts
// ***** Used in 'What We Do' section
// **********************************

// Compensate for Wordpress including prototype.js in the wp_head
jQuery.noConflict();

jQuery(document).ready(function() {	
	
	// Add current class to 'What We Do' in main nav
	jQuery("li#what-we-do-nav a").addClass("current");
	
	
	// Stretch aside#post-nav ul to full height of article on single entries
	var mainContentHeight = jQuery("body.single section#main-content").height();
	jQuery("body.single aside#post-nav ul").css("height",mainContentHeight + "px");

		
	// Slider
	jQuery(".single .browse").hide();
	jQuery(".scrollable-second-wrapper").mouseover(function() {
		jQuery(".browse:not(.disabled)").show();
	}).mouseout(function(){
		jQuery(".browse").hide();
	});
	jQuery(".browse").click(function() {
		jQuery(".browse").hide();
	});
	jQuery("div.scrollable-wrapper").scrollable({
		size: 1,
		clickable: false,
		loop: true,
		disabledClass: "disabled"
	}).navigator({
		navi: 'ul#tabs'
	});
    
    
    // Stretch marquee space on click if not on the main 'What We Do' page
	jQuery("body[id!='what-we-do'] section#marquee").css("cursor","pointer").toggle(
		function(){
			jQuery(this).animate({height:"440px"},400);
		},
		function(){
			jQuery(this).animate({height:"13px"},400);
		}
	);
	
	
	// qTip in marquee
	jQuery("body#what-we-do * div#marquee-tooltip-button span").delay(400).fadeOut(300).delay(150).fadeIn(300).delay(150).fadeOut(300).delay(150).fadeIn(300);
	jQuery("div#marquee-tooltip-button").toggle(
		function(){
			jQuery(this).addClass("off").removeClass("on");
			jQuery("span", this).text("+");
		},
		function(){
			jQuery(this).addClass("on").removeClass("off");
			jQuery("span", this).text("-");
		}
	);
	jQuery("div#marquee-tooltip-button").qtip({
		content: 'And while we employ a practiced approach to solving every challenge through the process of planning, tactics and metrics, we also know that every challenge is different. For that reason, we&rsquo;ve kept our process easily malleable. Evolvable. Adjustable. Tweakable enough that we have the freedom to create unique solutions that help our clients keep pace with the constantly changing communication landscape&mdash;from advertising to an enterprise website to anything in between. And in an era of such uncertainty, we think that&rsquo;s a pretty powerful thing.',
		style: {
			width: 260,
			padding: 20,
			background: '#000000',
			color: '#ffffff',
			'font-size': '11px',
			'line-height': '18px',
			border: {
				width: 1,
				color: '#000'
			},
			tip: true
		},
		position: {
			corner: {
				target: 'rightMiddle',
				tooltip: 'leftMiddle'
			}
		},
		show: {
			effect: {
				type: 'fade',
				length: 100
			},
			when: {
				event: 'click'
			}
		},
		hide: {
			effect: {
				type: 'fade',
				length: 100
			},
			when: {
				target: 'div#marquee-tooltip-button',
				event: 'click'
			}
		}
	});
	
});