/* Slideshow Functionality

*/

/*  */

// var quickbar_timeout;
var slides_current    = 0;
var slides_total      = 0;
var slides_timer      = false;
var slides_interval   = 5000;
var slides_transition = 500;
var rotation_started  = false;
var rotation_banned   = false;

function swap_slide( index ) {
	if( slides_current === index ) {return;}

	var target_li = $('#masthead ul#slides').find('li:eq(' + index + ')');

	// update current slide
	$('#masthead ul#slides').find('li.active').fadeOut(slides_transition, function() {$(this).removeClass('active');});

	if($('#masthead #slideshow #slideshow_bgcolor').is(':visible')) {
		$('#masthead #slideshow #slideshow_bgcolor').animate({ opacity: 0 }, 750);
	}

	if($('#masthead #slideshow #slideshow_bgimage').is(':visible')) {
		$('#masthead #slideshow #slideshow_bgimage').animate({ opacity: 0 }, 750);
	}

	// hide elements in next slide if a product slide
	// if( $.browser.msie != true ) {
	var target_screenshot = target_li.find('.image-screenshot').css({top:'300px'});
	var target_icon_ribbon = target_li.find('.edge-ribbon-box').css({ top:'50px', opacity:0 });

	var target_heading = target_li.find('.details-heading').css({ left:'-100px', opacity:0 });
	var target_subheading = target_li.find('.details-subheading').css({ left:'-100px', opacity:0 });
	var target_viewproduct = target_li.find('.details-viewproduct').css({ left:'5px', opacity:0 });
	// }

	target_li.fadeIn(slides_transition, function() {
		$(this).addClass('active');

		// animate slides
		// if( $.browser.msie != true ) {
		setTimeout(function() {
			target_screenshot.animate({top:'0px'});
		}, 75);

		setTimeout(function() {
			target_heading.animate({ left:'0px', opacity:1 });
		}, 150);

		setTimeout(function() {
			target_subheading.animate({ left:'0px', opacity:1 });
		}, 225);

		setTimeout(function() {
			target_icon_ribbon.animate({ top:'97px', opacity:1 });
			target_viewproduct.css({'z-index':'0'}).animate({ left:'60px', opacity:1 }, function() { target_viewproduct.css({'z-index':'2'}); });
		}, 300);
		// }

		// Animate the slideshow background change (if there is one)
		if(target_li.data('bgcolor')) {
			$('#masthead #slideshow #slideshow_bgcolor').attr('style', target_li.data('bgcolor'));
			$('#masthead #slideshow #slideshow_bgcolor').animate({opacity:1});
		}

		if(target_li.data('bgimage')) {
			$('#masthead #slideshow #slideshow_bgimage').css({backgroundImage:'url(/_assets/images/bg_masthead/'+target_li.data('bgimage')+'.png)'});
			$('#masthead #slideshow #slideshow_bgimage').animate({opacity:1});
		}

		// update current slide nav
		$('#masthead ul#slides-nav').find('li').removeClass('active');
		$('#masthead ul#slides-nav').find('li:eq(' + index + ')').addClass('active');

		slides_current = index;
	});
}

function stop_rotation() {
	clearInterval(slides_timer);
	rotation_started = false;
}

function start_rotation() {
	if( rotation_banned === false && rotation_started === false ) {
		slides_timer = setInterval(function() {
			var index = 0;

			if( slides_current !== slides_total ) {
				index = slides_current+1;
			}

			swap_slide(index);
		}, slides_interval);

		rotation_started = true;
	}
}


/* Subscription Plans Toggle */
function bind_subscription_plans() {
	var target_toggle = $('#sidebar').find('.subscription');
	target_toggle.find('h4').css({'padding-bottom':'0', 'cursor':'pointer'});
	target_toggle.find('ul').hide();

	target_toggle.find('h4').click(function() {
		$('#content').css('height', '');
		target_toggle.find('ul').slideToggle();
		return false;
	});
}

function bind_terms_popup() {
	$('#content.safe-harbor').find('.plans').find('a').click(function() {
		var target = $(this);

		var license = $('#license');
		license.find('a').attr('href', target.attr('href'));
		license.lightbox_me({ centered: true });

		return false;
	});

	/*$('#content.safe-harbor').find('.section.module').find('a').eq(0).click(function() {
		var target = $(this);

		var license = $('#license');
		license.find('a').attr('href', target.attr('href'));
		license.lightbox_me({ centered: true });

		return false;
	});*/

	// add transcribe
	$('.transcribe').find('ul.plans').find('a').click(function() {

		var target = $(this);
		var license = $('#license');
		license.find('a').attr('href', target.attr('href'));
		license.lightbox_me({ centered: true });

		return false;
	});
}

/* handle quickbar toggle */
// function quickbar_mouseenter() {
// 	clearTimeout(quickbar_timeout);
// 	$('#quickbar .wrapper').animate({height:'68px'}, {duration:250});
// 	$('#quickbar-toggle a').addClass('active');
// }
// function quickbar_mouseleave() {
// 	quickbar_timeout = setTimeout(function() {
// 		$('#quickbar .wrapper').animate({height:'0px'}, {duration:250, queue:false});
// 		$('#quickbar-toggle a').removeClass('active');
// 	}, 500);
// }

/* enable sticky sidebar functionality */
function sticky_sidebar() {
    if ($('#content.documentation #sidebar').length > 0) {
        var Sticky = function($obj, opts) {
            $(window).scroll(function(e) {
                Sticky.onScroll(e, $obj, opts);
            });
        };

        Sticky.onScroll = function(e, $o) {
            var iScrollTop = $(window).scrollTop();
            var sClass = "sticky";
            if (!$o.data(sClass)) {
                $o.data(sClass, {
                    css: {
                        position: $o.css('position'),
                        top: $o.css('top')
                    },
                    offset: $o.offset(),
                    height: $o.height(),
                    heightref: $('#content .wrapper').height()
                });
            }
            var oOrig = $o.data(sClass);
            var bIsSticky = $o.hasClass(sClass);
            var toofar = false;

            if (oOrig.heightref - iScrollTop - oOrig.height + oOrig.offset.top - 0 < 0) {
                toofar = true;
            }

            if (iScrollTop > oOrig.offset.top && !bIsSticky && !toofar) {
                $o.css({
                    position: 'fixed',
                    top: '0px'
                }).addClass(sClass);
            } else if (iScrollTop < oOrig.offset.top && bIsSticky && !toofar) {$o.css(oOrig.css).removeClass(sClass);} else if (toofar) {
                var newtop = oOrig.heightref - iScrollTop - oOrig.height + oOrig.offset.top;
                $o.css({
                    position: 'fixed',
                    top: newtop + 'px'
                }).addClass(sClass);
            } else if (iScrollTop > oOrig.offset.top) {
                $o.css({
                    position: 'fixed',
                    top: '0px'
                }).addClass(sClass);
            }
        };

        Sticky($('#content.documentation #sidebar')); // jshint ignore:line
    }
}

function adjustSameHeightCols() {
	// Two-Col Features Same-Height Adjuster
	if(window.innerWidth > 767 || window.outerWidth > 767) {
		$('.same-height-cols').each(function() {
			var tallestCol = 0;
			$(this).find('.same-height').each(function() {
				$(this).css('height', 'auto');

				var colHeight = $(this).height();

				if(colHeight > tallestCol) {
					tallestCol = colHeight;
				}
			});

			$(this).find('.same-height').height(tallestCol);//+45);
		});
	} else {
		$('.same-height-cols').each(function() {
			$(this).find('.same-height').each(function() {
				$(this).css('height', 'auto');
			});
		});
	}
}

$(document).ready(function() {
	/* Quick Bar Function */
	//$('#quickbar-toggle a').click(function() { return false; });
	//$('#quickbar-toggle a, #quickbar').hover(quickbar_mouseenter, quickbar_mouseleave);

	/* Enabled sticky sidebar */
	sticky_sidebar();
	$('#sidebar').find('.nav').find('a').on('click', function(e) {
		if( this.href.match(/^\/members\/?$/) ) {
			e.preventDefault();
			$.scrollTo(this.hash, 500);
		}
	});

	/* Safe Harbor Functionality */
	bind_subscription_plans();
	bind_terms_popup();

	/* initialize shadowbox */
	// jshint ignore:start
	Shadowbox.init({
		troubleElements: ["select","object","embed"]
	});
	// jshint ignore:end

	/* Basic tooltip functionality */
	var tooltip = $('<div class="eetooltip"><div class="helper"><div class="text"></div><div class="arrow"></div></div></div>').css({opacity:0}).hide();
	$('.tip').hover(
		function() {
			// var text = $(this).html();

			if( $(this).parent().find('.eetooltip').length === 0 ) {
				$(this).parent().append( tooltip.clone() );
			}

			var target = $(this).parent().find('.eetooltip');

			target.find('.text').html( $(this).data('tip') );

			while( target.height() > 45 )
			{
				var current_width = target.find('.text').width();
				target.find('.text').width(current_width + 5);
			}

			// show tooltip
			target.show().animate({opacity:1}, { duration:200, queue:false });
			target.find('.arrow').animate({opacity:1}, { duration:200, queue:false });
		},
		function() {
			var target = $(this).parent().find('.eetooltip');

			// hide tooltip
			target.animate({opacity:0}, { duration:200, queue:false }).hide();
			target.find('.arrow').animate({opacity:0}, { duration:200, queue:false });
		}
	);

	/* Footer tooltip functionality */
	$('#copyright').find('.social').find('a').hover(
		function() {
			// var text = $(this).html();

			if( $(this).parent().find('.eetooltip').length === 0 ) {
				$(this).parent().append( tooltip.clone() );
			}

			var target = $(this).parent().find('.eetooltip');

			target.find('.text').html( $(this).html() );

			while( target.height() > 45 )
			{
				var current_width = target.find('.text').width();
				target.find('.text').width(current_width + 5);
			}

			// show tooltip
			target.animate({opacity:1}, { duration:200, queue:false });
			target.find('.arrow').animate({opacity:1}, { duration:200, queue:false });
		},
		function() {
			var target = $(this).parent().find('.eetooltip');

			// hide tooltip
			target.animate({opacity:0}, { duration:200, queue:false });
			target.find('.arrow').animate({opacity:0}, { duration:200, queue:false });
		}
	);

	// Hide all but currently active slide (class:active)
	$('#masthead ul#slides').find('li').not('.active').hide();

	// setup slide nav links
	$('#masthead ul#slides-nav').find('li a').click(function(e) {
		e.preventDefault();

		// switch active state to currently selected link
		$('#masthead ul#slides-nav').find('li.active').removeClass('active');
		$(this).parent().addClass('active');

		var index = parseInt( $('#masthead ul#slides-nav').children().index($(this).parent()) );
		if( index !== slides_current ) {
			stop_rotation();
			swap_slide(index);
			start_rotation();
		}
	});

	// bind the "view product" button in the slides
	// $('#masthead ul#slides').find('a.details-viewproduct').unbind('click');
	// $('#masthead ul#slides').find('a.details-viewproduct').click(function(e) {
	// 	if( $(this).hasClass('active') ) {
	// 		$(this).attr('rel', this.href);
	// 		this.href = window.location.protocol + '//' + window.location.hostname;
	// 	} else {
	// 		var old_href = $(this).attr('rel');
	// 		if( old_href != '' ) {
	// 			this.href = old_href;
	// 		}
	// 	}
	// });

	if(page_url_segment_1) {
		// Animate the slideshow background change (if there is one)
		if($('#masthead ul#slides li.active').data('bgcolor')) {
			$('#masthead #slideshow #slideshow_bgcolor').attr('style', $('#masthead ul#slides li.active').data('bgcolor'));
			$('#masthead #slideshow #slideshow_bgcolor').animate({opacity:1}, 1000);
		}

		if($('#masthead ul#slides li.active').data('bgimage')) {
			$('#masthead #slideshow #slideshow_bgimage').css({ backgroundImage:'url(/_assets/images/bg_masthead/'+$('#masthead ul#slides li.active').data('bgimage')+'.png)' });
			$('#masthead #slideshow #slideshow_bgimage').animate({opacity:1}, 1250);
		}

		swap_slide(-1);
	} else {
		// start slideshow
		slides_total = parseInt( $('#masthead ul#slides-nav').find('li').length - 1 );
		slides_current = parseInt( $('#masthead ul#slides-nav').find('li.active').index() );

		if( slides_current <= 0 ) {start_rotation();}

		// on hover, stop rotation
		$('#masthead ul#slides').unbind('mouseenter mouseleave');
		$('#masthead ul#slides').on('mouseenter', function() {stop_rotation();}).on('mouseleave', function() {start_rotation();});

		// Monitor the window size, if it's too small, stop the slideshow and replace with a static version.
		$(window).resize(function() {
			if($( window ).width() < 1000) {
				rotation_banned = true;
				stop_rotation();
			} else {
				if(rotation_banned === true) {
					rotation_banned = false;
					start_rotation();
				}
			}
		});
	}

	$('#newsletter-signup').submit(function(e){
		e.preventDefault();

		var name = $(this).find('input[name="name"]').val(),
		email = $(this).find('input[name="email"]').val(),
		list = $(this).find('input[name="list"]').val(),
		url = $(this).attr('action');

		$('#newsletter-response').hide();
		$('#newsletter_submit').html('<i class="fa fa-cog fa-spin"></i>');

		$.post(url, { name:name, email:email, list:list, boolean:true },
			function(data) {
				// console.log(data);

				var text;

				if(data === "1") {
					text = "You're subscribed!";
				} else if(data === "Some fields are missing.") {
					text = "Please fill in your name and email.";
				} else if(data === "Invalid email address.") {
					text = "Your email address is invalid.";
				} else if(data === "Invalid list ID.") {
					text = "Your list ID is invalid.";
				} else if(data === "Already subscribed.") {
					text = "You're already subscribed!";
				} else {
					text = "Sorry, unable to subscribe. Please try again later!";
				}

				$('#newsletter-response').text(text).fadeIn('fast');
				$('#newsletter_submit').html('Submit');
			}
		);
	});

	$('#newsletter-signup').keypress(function(e) {
	    if(e.keyCode === 13) {
	    	e.preventDefault();
			$(this).submit();
	    }
	});

	$("#submit-btn").click(function(e){
		e.preventDefault();
		$('#newsletter-signup').submit();
	});

	$('a.btn-action').click(function(){
		// var currentButtonCode = $(this).html();
		$(this).html('<i class="fa fa-cog fa-spin"></i> Please Wait...');
		$(this).attr('disabled', true);
	});

	$('form.form-action').on('submit', function() {
		$(this).find('.fancy-action').html('<i class="fa fa-cog fa-spin"></i> Please Wait...').attr('disabled', true);
	});

	// Documentation triggers for showing child parameters.
	$('.related-parameters-btn').on('click', function() {
		var paramTarget = $(this).data('target');

		if($(this).hasClass('open')) {
			$('#'+paramTarget).slideUp();
			$(this).html('Show Related Parameters').removeClass('open');
		} else {
			$('#'+paramTarget).slideDown();
			$(this).html('Hide Related Parameters').addClass('open');
		}
	});

	// Make the Mega Pack columns the same height.
	adjustSameHeightCols();
	$(window).resize(function() {adjustSameHeightCols();});
});

// ==============================
// WEBSITE NAVIGATION
// ==============================
// $.address.state(window.location.protocol + '//' + window.location.hostname);

// $('#quickbar').find('a').address();
// $('#logo').find('a').address();
// $('#masthead').find('a.details-viewproduct').address();
// $('#documentation-nav').find('a').address();
// $('#products').find('.buy').find('a').address();
// $('#products').find('.details').find('a').address();

// var start_path;
// if (window.location.hash) addressChanged = true;

// $.address.init(function(event) {
// 	start_path = event.path;
// });

// $.address.change(function(event) {
// 	if(event.path == start_path) {
// 		// return false;
// 	}

// 	var target_path = event.path;
// 	var current_path = location.pathname.replace($.address.state(), '');

// 	var href = $.address.state() + event.path;

// 	if( target_path.match(/^\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }
// 		stop_rotation;
// 		swap_slide(0);
// 		start_rotation();
// 		$('#masthead ul#slides').find('li').find('a.details-viewproduct').removeClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeIn();

// 		// remove content
// 		$('#content').find('.wrapper').fadeOut().end().dequeue().slideUp();
// 	}
// 	// 	
// 	if( target_path.match(/^\/wygwam\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(1).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(1);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/structure\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(2).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(2);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/assets\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(3).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(3);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/detour-pro\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(4).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(4);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/matrix\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(5).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(5);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/playa\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(6).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(6);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/fieldpack\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(7).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(7);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/transcribe\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(8).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(8);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/charge\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(9).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(9);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/polls\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(10).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(10);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/shortlist\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(11).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(11);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/binder\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(12).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(12);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/maps\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(13).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(13);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/safeharbor\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(14).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(14);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/image-editor\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(15).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(15);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-list\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(16).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(16);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-nice-date\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(17).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(17);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-options\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(18).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(18);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-random\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(19).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(19);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-replace\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(20).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(20);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-seg2cat\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(21).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(21);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-title\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(22).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(22);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-widont\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(23).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(23);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-yearly-archives\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(24).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(24);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/tag\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(25).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(25);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/rating\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(26).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(26);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/favorites\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(27).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(27);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/user\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(28).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(28);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/mega-pack\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(29).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(29);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/freemember\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(30).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(30);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/seeo\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(31).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(31);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/catchall\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(32).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(32);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/champagne-2\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(33).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(33);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/field-editor\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(34).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(34);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/geofinder\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(35).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(35);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/geotagger\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(36).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(36);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/profile\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(37).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(37);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/channel-images\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(38).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(38);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/forms\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(39).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(39);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/updater\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(40).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(40);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/channel-files\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(41).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(41);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/subscriptions\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(42).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(42);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/editor\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(43).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(43);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/channel-ratings\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(44).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(44);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/channel-polls\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(45).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(45);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/campaigns\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(46).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(46);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/visitor\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(47).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(47);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/credits\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(48).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(48);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/entry-mapper\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(49).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(49);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/hits\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(50).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(50);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/channel-videos\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(51).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(51);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/forum-subscribe\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(52).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(52);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/tagger\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(53).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(53);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/smart-switch\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(54).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(54);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/zoo-flexible-admin\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(55).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(55);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/goldfish\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(56).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(56);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-search\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(57).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(57);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-variables\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(58).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(58);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-reorder\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(59).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(59);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-alphabet\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(60).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(60);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/low-events\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(61).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(61);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//// 	
// 	if( target_path.match(/^\/kraken\/?$/) ) {
// 		if( current_path.match(/members|documentation|faqs|changelog\/?$/) ) { window.location.href = href; return; }

// 		$('#masthead ul#slides').unbind('mouseenter mouseleave');
// 		$('#masthead ul#slides').find('li').eq(62).find('a.details-viewproduct').addClass('active');
// 		$('#masthead ul#slides-nav').find('li').fadeOut();
// 		swap_slide(62);
// 		stop_rotation();

// 		load_page(href);
// 	}
// 	
//

// 	if( target_path.match(/documentation|faqs|changelog\/?$/) ) {
// 		if( current_path.match(/^\/?(members|wygwam|structure|assets|detour-pro|matrix|playa|fieldpack|transcribe|charge|polls|shortlist|binder|maps|safeharbor|image-editor|low-list|low-nice-date|low-options|low-random|low-replace|low-seg2cat|low-title|low-widont|low-yearly-archives|tag|rating|favorites|user|mega-pack|freemember|seeo|catchall|champagne-2|field-editor|geofinder|geotagger|profile|channel-images|forms|updater|channel-files|subscriptions|editor|channel-ratings|channel-polls|campaigns|visitor|credits|entry-mapper|hits|channel-videos|forum-subscribe|tagger|smart-switch|zoo-flexible-admin|goldfish|low-search|low-variables|low-reorder|low-alphabet|low-events|kraken)\/?$/) ) { window.location.href = href; return; }

// 		var docs_nav = $('#documentation-nav');
// 		var link_id = target_path.match(/documentation|faqs|changelog\/?$/)[0];

// 		docs_nav.find('li').removeClass('active');
// 		docs_nav.find('#link-'+link_id).addClass('active');

// 		if( link_id == 'documentation' ) { docs_nav.find('#link-active').animate({left:'54px'}); }
// 		if( link_id == 'faqs' ) { docs_nav.find('#link-active').animate({left:'192px'}); }
// 		if( link_id == 'changelog' ) { docs_nav.find('#link-active').animate({left:'311px'}); }

// 		load_page(href);
// 		// call the modal stuffz

// 	}
// });

// function load_page( href ) {
// 	var request = $.ajax({ url:href, dataType:'html' });

// 	// output contents when successful
// 	request.success(function( data ) {
// 		// setup content div if it doesn't exist
// 		if( $('#content').length === 0 ) {
// 			$('#masthead').after($('<div />', {'id':'content'}).hide());
// 		}

// 		var content_div = $('#content');

// 		var page_content = $('#content', data);
// 		var page_wrapper = $('.wrapper', page_content);

// 		// replace page content
// 		content_div.find('.wrapper').fadeOut();
// 		content_div.attr('class', page_content.attr('class'));
// 		content_div.html( page_wrapper.hide() );
// 		bind_terms_popup();
// 	});

// 	// handle error if request did not complete
// 	request.error(function() {//});

// 	// cleanup
// 	request.complete(function() {
// 		if( href.match(/safe-harbor/) ) {
// 			bind_subscription_plans();
// 			bind_terms_popup();
// 		}

// 		Shadowbox.init({ skipSetup:true, troubleElements: ["select","object","embed"] });
// 		Shadowbox.setup();

// 		// setup pages after transition for normal operation
// 		if( href.match(/documentation|faqs|changelog/) ) {
// 			sticky_sidebar();
// 			$('#sidebar').find('.nav').find('a').on('click', function(e) {
// 				e.preventDefault();
// 				$.scrollTo(this.hash, 500);
// 			});
// 		} else {
// 			if( window.scrollY > 100 ) {
// 				$.scrollTo('0px', 500);
// 			}
// 		}

// 		var content_div = $('#content');
// 		content_div.dequeue().slideDown(function() {
// 			content_div.find('.wrapper').fadeIn(function() {
// 				var height = $(this).height();
// 				var padding = parseInt(content_div.css('paddingTop'));
// 				content_div.animate({height:(height+padding)});
// 			});
// 		});
// 	});
// }