/*lightbox*/
function moveCloseLink() { 
	cb=document.getElementById( 'sb-nav-close' ); 
	tb=document.getElementById( 'sb-title' ); 

	if( tb ) tb.appendChild(cb); 
} 

Shadowbox.init( { 
	onOpen: moveCloseLink 
} );


/* Love Ticker on Home page */
$(function(){
	$('.love-ticker').vTicker({ 
		speed: 700,
		pause: 7000,
		mousePause: true,
		showItems: 2,
		direction: 'down',
		height: 250
	});
});


/* Highlight Tour sub nav of page visiting */
$(function(){

	var found = false;
	var url = window.location.pathname, 
	urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); // create regexp to match current url pathname and remove trailing slash if present as it could collide with the link in navigation in case trailing slash wasn't present there
	// now grab every link from the navigation
	$('ul#tour-nav li a').each(function(){
		// and test its normalized href against the url pathname regexp
		if(urlRegExp.test(this.href.replace(/\/$/,''))){
			$(this).addClass('active');
			found = true;
		}
	});
	// if the link doesn't include the specific php file it is the index.php, which should highlite overview
	if(found == false) {
		$('.overview a').addClass('active');
	}
});


/* Highlight company sub nav of page visiting */
$(function(){

    var url = window.location.pathname, 
        urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); // create regexp to match current url pathname and remove trailing slash if present as it could collide with the link in navigation in case trailing slash wasn't present there
        // now grab every link from the navigation
        $('ul.company li a').each(function(){
            // and test its normalized href against the url pathname regexp
            if(urlRegExp.test(this.href.replace(/\/$/,''))){
                $(this).addClass('active');
            }
        });
});


/* Dynamic Platform Button */
$(document).ready(function(){
  if ($.client.os == "Mac") {
    $("#dynamic-platform-download-allversions").hide();
    $("#dynamic-platform-download-mac").show();
    $("#dynamic-platform-download-pc").hide();
  } else if ($.client.os == "Windows") {
    $("#dynamic-platform-download-allversions").hide();
    $("#dynamic-platform-download-pc").show();
    $("#dynamic-platform-download-mac").hide();
  }
});


/* Expand job openings on Jobs page */
$(document).ready(function(){
	$(".toggle_container").hide();
		$("h3.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false;
	});
});

