// TOPNAV HOVER STATES
	
	$(document).ready(function(){
	
		// remove link background images since we're re-doing the hover interaction below 
		// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
		// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
		$(".topnav").children("li").each(function() {
			var current = "topnav current-" + ($(this).attr("class"));
			var parentClass = $(".topnav").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each nav item
		attachNavEvents(".topnav", "home");
		attachNavEvents(".topnav", "about");
		attachNavEvents(".topnav", "solutions");
		attachNavEvents(".topnav", "casestudies");
		attachNavEvents(".topnav", "careers");
		attachNavEvents(".topnav", "contact");
		
		function attachNavEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				$(this).append('<div class="topnav-' + myClass + '"></div>');
				$("div.topnav-" + myClass).css({display:"none"}).fadeIn(200);
			}).mouseout(function() {
				$("div.topnav-" + myClass).fadeOut(200, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.topnav-" + myClass).attr("class", "topnav-" + myClass + "-click");
			}).mouseup(function() {
				$("div.topnav-" + myClass + "-click").attr("class", "topnav-" + myClass);
			});
		}

	});


/* Prevents IE6 Background Flicker */

try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}




/* Case Study lightboxes */	

	
	$(document).ready(function(){
			$("a[rel^='prettyPhoto']").prettyPhoto({
				animationSpeed: 'normal', /* fast/slow/normal */
				padding: 25, /* padding for each side of the picture */
				opacity: 0.5, /* Value betwee 0 and 1 */
				showTitle: false, /* true/false */
				allowresize: true, /* true/false */
				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
				theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
				callback: function(){}
			});
		});
	
	
$(document).ready(function() {
    $('.partnerShuffle').cycle({
		fx: 'scrollRight',
		delay: 1000
	});
});
