	$(document).ready(function(){
		
		/* Used on the feature pages to expand and collapse the really long details */
		$(".toggle-block").css("display","none");	
		$(".toggle-details").click(function () {
			$(".toggle-block").slideToggle("slow");
			if($(".toggle-details").text() == ("View more details")){
				$(".toggle-details").text("Fewer details");		
				$(".toggle-details").css("background","url(/images/arrow-up.png) no-repeat left");
			}else{
				$(".toggle-details").text("View more details");
				$(".toggle-details").css("background","url(/images/arrow-down.png) no-repeat left");
			}
			 
		});


		/* Colorbox hook */
			if(jQuery().colorbox) { $("a.colorbox").colorbox({transition:"none", opacity:"0.5"}); }
		/* Next Step promo video */
		$("#promoVideo a").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 640;
			var popupHeight = 427;
			$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			return false;
		});
		$("#promoNextSteps h4 a").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 640;
			var popupHeight = 515;
			$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			return false;
		});
		/* Footer Next Step link to Quote */
		$(".quote-popup a").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 690;
			var popupHeight = 551;
			if (jQuery.browser.msie){
				if(parseInt(jQuery.browser.version) < 8) {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight+2, iframe:true});
				}
				else {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
				}
			}
			else{
				$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			}
			return false;
		});

		
		/* Next Step link to One on One Demo */
		/* not using the popup version anymore */
		/*
$(".demo-popup a").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 688;
			var popupHeight = 580;
			if (jQuery.browser.msie){
				if(parseInt(jQuery.browser.version) < 8) {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight+20, iframe:true});
				}
				else {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
				}
			}
			else{
				$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			}
			return false;
		});
*/
	
		/* If Cookied, link to Starter Kit Zip File */
		
		if ($.cookie("registered") == ("yes")) {
			$("a[href='/campaigns/website/starter-kit-popup-lp.html']").attr('href', '/images/starterkit/ArenaStarterKit.zip');
		}


		
		/* Next Step link to Starter Kit */
		$("a[href='/campaigns/website/starter-kit-popup-lp.html']").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 688;
			var popupHeight = 585;
			if (jQuery.browser.msie){
				if(parseInt(jQuery.browser.version) < 8) {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight+20, iframe:true});
				}
				else {
					$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
				}
			}
			else{
				$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			}
			return false;
		});
		




		/* Footer Download Video */
		$("#panel.downloadOffer #panel1 a").click(function(){
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
			var currentLink = this.href;
			var popupWidth = 640;
			var popupHeight = 515;
			$.fn.colorbox({href:currentLink, open:true,innerWidth:popupWidth, innerHeight:popupHeight, iframe:true});
			return false;
		});

		/* Global Navigation */	
		
		$("ul.sf-menu").supersubs({
			minWidth:    1,
			maxWidth:    50,
			extraWidth:  0.25
		}).superfish({
			delay:       0,
			speed:       'fast',
			autoArrows:  false,
			dropShadows: false
		});
		$("ul.sf-menu .navProduct ul li:last,ul.sf-menu .navBenefit ul li:last,ul.sf-menu .navCompany ul li:last").after('<li class="liLast" />');
		if($(".sf-menu .navProduct ul").width()<="160"){
			$(".sf-menu .navProduct ul").css("width","144px");
		}
		if($(".sf-menu .navBenefit ul").width()<="160"){
			$(".sf-menu .navBenefit ul").css("width","144px");
		}
		if($(".sf-menu .navCompany ul").width()<="160"){
			$(".sf-menu .navCompany ul").css("width","144px");
		}
		if (jQuery.browser.msie){
			if(parseInt(jQuery.browser.version) < 7) {
				$(".navProduct .linkMain").addClass("product");
				$(".navBenefit .linkMain").addClass("benefit");
				$(".navCompany .linkMain").addClass("company");
				$(".sf-menu").focus(function(){
					if($(".navProduct").hasClass("sfHover")){
						$(".navProduct").addClass("highliteProduct");
					}
					else{
						$(".navProduct").removeClass("highliteProduct");
					}
					if($(".navBenefit").hasClass("sfHover")){
						$(".navBenefit").addClass("highliteBenefit");
					}
					else{
						$(".navBenefit").removeClass("highliteBenefit");
					}
					if($(".navCompany").hasClass("sfHover")){
						$(".navCompany").addClass("highliteCompany");
					}
					else{
						$(".navCompany").removeClass("highliteCompany");
					}
				}).blur(function(){
					$(".sf-menu li").removeClass("highliteCompany");
				});
			}
		}
		
		/* Removing Search Box Value */
		$("#globalsearch #search-box input").val("");

	
		/* displaying registered message */
		if ($.cookie("registered") == ("yes")) {
			$('.registered').css("display","block");
			$('.registered-hide').css("display","none");
		}
		
		/* displaying message based on Title from form */
		if ($.cookie("Manufacturing") == ("yes")) {
			$('#manufacturing').css("display","block");
		}
		else if ($.cookie("Quality Assurance") == ("yes")) {
			$('#quality_assurance').css("display","block");
		}
		else if ($.cookie("CEO") == ("yes")) {
			$('#CEO').css("display","block");
		}
		else {
			$('#default').css("display","block");
		}
		
		/* Slidebox function */
		
		jQuery.fn.exists = function(){return jQuery(this).length>0;}
		
		if ($('#slide').exists()) {
		$(function() {
			$(window).scroll(function(){
				var distanceTop = $('#slide').offset().top - $(window).height();
		
				if  ($(window).scrollTop() > distanceTop)
					$('#slidebox').animate({'right':'0px'},300);
				else
					$('#slidebox').stop(true).animate({'right':'-430px'},100);
			});
		
			$('#slidebox .close').bind('click',function(){
				$(this).parent().remove();
			});
		});	
		    // Do something
		}

		$(function() {
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
		
			$(".image-gallery a").click(function(){
				var currentLink = this.href; 
				var param = this.className; 
			
				$.fn.colorbox({innerWidth:"815", innerHeight:"700", iframe:true, href:currentLink + "?img=" + param});
				return false;
			});
		});
		$(function() {
			$.fn.colorbox.settings.opacity = "0.5"; 
			$.fn.colorbox.settings.transition = "none";
		
			$(".video-gallery a").click(function(){
				var currentLink = this.href; 
				var param = this.className; 
			
				$.fn.colorbox({innerWidth:"770", innerHeight:"617", iframe:true, href:currentLink + "?video=" + param});
				return false;
			});
		});

	}); /* end document.ready */
