var promoToCookie = Math.ceil(Math.random() * 2);
var promo = get_cookie('home');

// check if cookie has been set
if (promo == null) {
	set_cookie('home', promoToCookie, '90', '/', '.arenasolutions.com', '');
	promo = promoToCookie;
}
if (promo == 2) {
	// hide promo-pdx-learn
	document.write("<style>#promo-pdx-learn{display:none;}#promo-pdx-try{display:block;}</style>");
}


head.ready(function(){
	/* Video Colorbox */
	$.fn.colorbox.settings.opacity = "0.5"; 
	$.fn.colorbox.settings.transition = "none";
	var videoWidth = 640;
	var videoHeight = 427;
	var popupWidth = videoWidth;
	var popupHeight = videoHeight+88;
	$("a[href='/resources/videos/dl/product-overview.html']").colorbox({innerWidth:popupWidth,innerHeight:popupHeight,iframe:true, href:"/resources/videos/dl/product-overview.html"});


	$('#rotate').html('<div id="tabs-1"><span class="cite"><strong>Greg Mead,</strong> VP of Manufacturing &amp; Operations, Nordic Windpower</span><blockquote><p>Using Arena means virtually no support costs, which allows us to stay focused on taking wind power technology to the next level.</p></blockquote><a href="/benefits/customers/index.html" class="learn-more">Learn how customers succeed with Arena</a></div><div id="tabs-2"><span class="cite"><strong>Len Hedge,</strong> VP of Operations, Invisalign</span><blockquote><p>With Arena, we&rsquo;re able to deal with a larger volume of changes and we&rsquo;ve reduced our change implementation cycle time&mdash;all without increasing headcount.</p></blockquote><a href="/benefits/customers/index.html" class="learn-more">Learn how customers succeed with Arena</a></div><div id="tabs-3"><span class="cite"><strong>Tod Dykstra,</strong> VP of Operations, Dust Networks</span><blockquote><p>The Arena solution is perfect for early-stage, rapid-growth companies who want stable, high-quality controls without a massive upfront investment.</p></blockquote><a href="/benefits/customers/index.html" class="learn-more">Learn how customers succeed with Arena</a></div><div id="tabs-4"><span class="cite"><strong>Doug Field,</strong> Chief Technology Officer, VP of Design &amp; Engineering, Segway</span><blockquote><p>Arena has helped us focus on the job of new product development instead of configuration management and document control.</p></blockquote><a href="/benefits/customers/index.html" class="learn-more">Learn how customers succeed with Arena</a></div><div id="tabs-5"><span class="cite"><strong>Ranjan Prasad,</strong> Director of Operations and Supply Chain Management, SunLink</span><blockquote><p>With Arena we ensure that our entire supply chain has all the revision information they need to build products on time and on budget.</p></blockquote><a href="/benefits/customers/index.html" class="learn-more">Learn how customers succeed with Arena</a></div><ul><li><a href="#tabs-1">Nordic Windpower</a></li><li><a href="#tabs-2">Invisalign</a></li><li><a href="#tabs-3">Dust Networks</a></li><li><a href="#tabs-4">Segway</a></li><li><a href="#tabs-5">SunLink</a></li></ul>');
	$('.rss-box').css('display', 'block');
	$('.rss').css('display','block');
	$('#rotate ul').css('display','block');
	$('#networks').css('display', 'block');
	$('.more').css('border-top','1px solid #E7E7E7').css('margin-top','54px');

	var Tabs = $('#rotate').tabs({ fx: {opacity: 'toggle' } });
		Tabs.tabs( 'rotate' , 10000 );
		$('#rotate').mouseenter(function(){Tabs.tabs( 'rotate' , 0)});
		$('#rotate').mouseleave(function(){Tabs.tabs( 'rotate' , 10000)});

	var $twtlink = $('#twitter_update_list li > a').not('.tweet').attr("href");
	$('#twitter_update_list li > a').not('.tweet').css('display','none');
	$('#twitter_update_list li span').wrap('<a href="http://twitter.com/arenasolutions" class="tweet"></a>');
	$('.bird').wrap('<a href="http://twitter.com/arenasolutions"></a>');
	$('#twitter_update_list li a span').hover(function (){$(this).css("color","#777");},function(){$(this).css("color", "#919191");});
	
	var bloglink = $('a.rss-item').attr('href');
	$('a[title="blog"]').attr('href', bloglink);

    olark.extend(function(api){
    	if(api.chat.operatorsAreAvailable() == true){
    		$('#live-chat-li').css('display','list-item');
    	}
    	else{
    		$('#live-chat-li').css('display','none');
    	}
	});
	if ($("li.rss-item").length == 0){
		$('#explore').css('display', 'none');
		$('#more').css('border','0');
	}
});
/* Adds a border to all IE browsers (:last-child workaround) */
jQuery.each(jQuery.browser, function(i) {
   if($.browser.msie){
      $('#secondary ul#steps li').last().css('border-bottom', 'solid 1px #e8e8e8');
   }
});


