// JavaScript Document

 //////// PAGE CONTENT RESETS ////////
/////////////////////////////////////

function pageResets(newPanelIndex){
	if (newPanelIndex == 2) setTimeout("WhatSwitch('us')", 500);  // reset stats panel to US view
	(function(){ iL_i = 0; indexListAnimate; }).delay(0); // reset "What we do" list back to top
	SwitchProduct.delay(1000,this,'how_product_1');
}


//////  LINKS, NAV CONTROLS ///////////
///////////////////////////////////////

window.addEvent('domready', function() {		
	/// [event listeners for nav controls ]
	$('arrow_right').addEvent('click', function(){
		panelMan('next');
	});
	$('arrow_left').addEvent('click', function(){
		panelMan('prev');
	});
	$('home_clicker').addEvent('click', function(){
		panelMan(1);
	});
	$('nav_what').addEvent('click', function(){
		panelMan(2);
		
	});
	/*
	$('what_viewing_us').addEvent('click', function(){
		WhatSwitch('us');				
	});
	$('what_viewing_global').addEvent('click', function(){
		WhatSwitch('global');
	});
	*/
	$('what_toggle').addEvent('click', function(){
		WhatSwitch( (what_status == 'us' ? 'global' : 'us') );				
	});
	
	
	$('nav_how').addEvent('click', function(){
		panelMan(3);
	});
	$$('.how_product').addEvent('click', function(){
		SwitchProduct(this.id);
	});
	$('nav_partners').addEvent('click', function(){
		panelMan(4);
	});
	$('nav_about').addEvent('click', function(){
		panelMan(5);
	});
	$('nav_news').addEvent('click', function(){
		panelMan(6);
		SwitchNews('news_article_1');
	});
	$$('.news_article').addEvent('click', function(){
		SwitchNews(this.id);
	});
	$$('.news_ticker').addEvent('click', function(){
		SwitchNews(this.id);
		panelMan('news');
	});
	$$('.pdf_download').addEvent('click', function(){
		window.open('downloads/gamerDNAmedia_comScore.pdf');
	});
});
	
	var keyStrokeEvent = function(event){
		if (event.key == 'right') {
			panelMan('next')
		};
		if (event.key == 'left') {
			panelMan('prev')
		};
	}
	
	document.addEvent('keydown', keyStrokeEvent);


 ////////// CONTENT SPECIFIC //////////////
//////////////////////////////////////////

////// HOME //////

var word_i = 0;
function wordlistAnimate(){
	var myFx = new Fx({duration: wordDuration, transition: Fx.Transitions.Sine.easeOut});
	myFx.start().chain(
		function() {this.start(nextWord(word_i));},
		function() {this.start(wordlistAnimate());}
	);
}
function nextWord(){
	target = word_i * -36 + 'px';
	var myFx = new Fx.Morph('wordlist', {duration: 100, transition: Fx.Transitions.Sine.easeOut});
	myFx.start({
			'background-position': ['0px ' + target]
	});
	word_i = (word_i >= 86 ? 0 : word_i + 1); //reset the background shift after a few loops through the list
}


////// WHAT WE DO //////

var what_status = 'us';
function WhatSwitch(USorGlobal)
{
	if (what_status == USorGlobal) return;
	if (USorGlobal == 'us')
	{
		what_status = 'us';
		//$('what_title_global').fade('out');
		$('right_global').fade('out');
		$('what_global').fade('out');
		
		$('what_title_us').fade('in');
		$('right_us').fade('in');
		//$('what_audience').fade('in');
		$('what_us').fade('in');
		
		//$('what_viewing_us').set("class", "active");
		//$('what_viewing_global').set("class", "");
		
		$('what_toggle').set("src", "images/what/toggle_us.png");
		
		new Fx.Tween('content_bg').start('opacity',0).chain(
			function() {
				$('content_bg').setStyle('background-image', 'url(images/backgrounds/bg_what.jpg)');
				this.start('opacity',1);
		});
	}
	else if (USorGlobal == 'global')
	{
		what_status = 'global';
		//$('what_title_global').fade('in');
		$('right_global').fade('in');
		$('what_global').fade('in');
		
		//$('what_title_us').fade('out');
		$('right_us').fade('out');
		//$('what_audience').fade('out');
		$('what_us').fade('out');
		
		//$('what_viewing_us').set("class", "");
		//$('what_viewing_global').set("class", "active");
		
		$('what_toggle').set("src", "images/what/toggle_global.png");
		
		new Fx.Tween('content_bg').start('opacity',0).chain(
			function() {
				$('content_bg').setStyle('background-image', 'url(images/backgrounds/bg_what_global.jpg)');
				this.start('opacity',1);
		});
	}
}

 //// "Heavy Indexing" list animation
var iL_speed = 1000; // animation speed

var iL_i = 0;
var iL_group;
var timer;

function indexListAnimate(){
	clearTimeout(timer);
	// grab all list elements
	if(!iL_group){ iL_group = $$('#indexing dd')};
	//fade old
	iL_group.tween('color', '#858585');
	//highlight new
	iL_group[iL_i++].tween('color', '#fff');
	//reset counter at end
	if( iL_i == iL_group.length ) { iL_i = 0; }
	//repeat
	timer = indexListAnimate.delay(iL_speed);
}


//////// HOW WE DO IT ////////

var Products = [
				['how_product_1', 'Interactive Interstitial', 'Interstitials capture 100% SOV to drive incredible performance and impact.  Videos, downloads, games, and other interactive content deliver that Moment --free from competing noise.  These units run across our Alliance Network, reaching a wide yet segmentable audience.', 'selected_dcuo.png', 'http://gamerdnamedia.com/dcu_stitial/'],
				
				['how_product_2', 'In-Page Rich Media Experience', 'Cut through the noise and jolt the audience with our custom developed in-page rich media experiences!  Launched from any page inside any standard IAB banner, this creative takeover can include video, audio, animation, interaction, link outs and downloads --whatever you can imagine-- all without leaving the page.', 'selected_portal2.png', 'http://sandbox.crispygamer.com/portal2'],

			    ['how_product_3', 'Social Scavenger Hunt', 'For the launch of Assassin\'s Creed: Brotherhood we teamed up with Ubisoft to create an exciting scavenger hunt across our network. Using Facebook and Twitter to disseminate clues, we invited our collective audience to "Track the Assassins" who were hidden on various sites throughout our Alliance Network.  Each assassin would in turn lead to a microsite with an interactive quiz where the user could test their "assassin skillz" and gain access to exclusive downloadable content.', 'selected_acb.png', 'http://www.gamerdna.com/tracktheassassin/'],	    
				
			    ['how_product_4', 'Interactive Banners', 'Let us help you create an exciting in-banner experience. Users engage your brand without leaving the page. Our interactive banners can expand to play video, stream information, collect info, and offer interactive experiences like games and quizzes.', 'selected_tron.png', 'http://sandbox.crispygamer.com/tron'],
				
			    ['how_product_5', 'Expandables & Pushdowns', 'Let us help you create an exciting in-banner experience. Users engage your brand without leaving the page. Our interactive banners can expand to play video, stream information, collect info, and offer interactive experiences like games and quizzes.', 'selected_dominos.png', 'http://sandbox.crispygamer.com/dominos'],
				
				['how_product_6', 'Custom Microsites', 'What better way to integrate your brand into our Alliance Network?  Let us build a microsite for your next campaign and drive our audience to your high impact informational experience.  Collect data, present offers, showcase new products… the possibilities are endless!', 'selected_green.jpg', '#']
				
				];

//var prodImg_selected;

function SwitchProduct(product)
{
	var i;
	for (i = 0; i < Products.length; i++)
	{
		if (Products[i][0] == product)
		{
			$('how_title').empty().set('html', Products[i][1]);
			$('how_text').empty().set('html', Products[i][2]);
			
			$('how_image').set('src', 'images/how/' + Products[i][3]);
			/*  testing gallery selected fade-in-out
			prodImg_selected = 'images/how/' + Products[i][3];
			new Fx.Tween('how_image').start('opacity',0).chain(
				function() {
					$('how_image').set('src', prodImg_selected);
					this.start('opacity',1);
			}); */
			
			$('how_launch').set('href', Products[i][4]);
			$$('.activeproduct').set('class', 'how_product');
			$(product).set('class', 'how_product activeproduct');
			if(Products[i][4] == '#'){
				$('how_launch').fade('out');
			} else {
				$('how_launch').fade('in');
			}
		}
	}
}


///////// NEWS PAGE ////////

var News = [
			['news_article_1', '07.19.11', 'Live Gamer Acquires Brandport and GamerDNA', '<h4><i><center>Launches "Live Gamer Media," A New Advertising Business Unit</center></i></h4><p><strong>NEW YORK · July 19, 2011</strong> · <a href="http://www.livegamer.com" target="_blank">Live Gamer</a>  announced today that it has acquired New York-based video game ad network gamerDNA Media, and engagement advertising platform BrandPort. The two additions will form Live Gamer Media, a new business unit complementing Live Gamer&rsquo;s industry-leading microtransaction offerings. <p> The unique pairing of gamerDNA Media and BrandPort offers advertisers a single source for targeting gamers, including both elusive hardcore gamers, and  casual/social gamers. Live Gamer Media&rsquo;s innovative mix of advertising products combine the reach of display, share of voice of rich media, branding of video engagement and high viral impact of social media.<p>“Launching Live Gamer Media through the acquisitions of two impressive companies - gamerDNA and BrandPort - offers advertisers a one-stop partner for connecting with gamers in a whole new way,“ said Andrew Schneider, president and co-founder of Live Gamer, “We&rsquo;ve brought together the reach of display with the innovation and high-engagement levels of virtual goods incentive video - both gamers and advertisers win.”<p>"Virtual items sales and advertising are the business models driving revenue in the games industry today," said Billy Pidgeon, analyst with M2 Research.  "Merging advertising and transactions creates more growth opportunity, more quickly, for both publishers and advertisers."<br/ ><p><a href="http://www.livegamer.com/about-us/news/2011/07/live-gamer-media.html" target="_blank">[ Read the Whole Announcement Here ]</a></p>'],
			
			['news_article_2', '06.20.11', 'gamerDNA Media Invites Gamers to Celebrate Gears of War 3 Launch with Brotherhood Achievement Challenge', '<h4><i><center>Worldwide Team-Based Achievement Challenge for Microsoft and Epic Games&rsquo; Highly Anticipated Third-Person Shooter to Commence in September</center></i></h4><p><strong>NEW YORK · June 20, 2011</strong> · gamerDNA Media, the digital advertising firm that gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web, today provided a sneak peek into its upcoming Brotherhood Achievement Challenge on <a href="http://360voice.gamerdna.com" target="_blank">360voice.com</a>, its own Xbox 360-centered gaming community.</p><p>When <a href="http://gearsofwar.xbox.com" target="_blank">Gears of War 3</a> launches on Sept. 20, gamers using Xbox Live worldwide who have signed up at <a href="http://360voice.gamerdna.com" target="_blank">360voice.com</a> can track and log their achievements and compete against fellow GoW3 players.  The 360voice Brotherhood Achievement Challenge will begin the day the game launches and will run for 30 days. </p><p>Here&rsquo;s how it works: <ul><li>Gamers will unite into Brotherhoods – teams formed via <a href="http://facebook.com" target="_blank">Facebook</a>, <a href="http://twitter.com" target="_blank">Twitter</a>, forums, other social networks or email.</li><li>Brotherhoods will compete by unlocking achievements and receiving points for recruiting new players.</li><li>The Top 5 Brotherhoods at the end of the challenge will partake in $10,000 in prizes, to be awarded based on their respective rankings.</li></ul><p>"360voice.com will be the best way for GoW3 players to track, share and compete with their fellow gamers," said Jay Benach, president of gamerDNA Media.  "Given the immense popularity of GoW1 and 2 at 360voice.com – we&rsquo;ve tracked more than 5.7 million GoW games played to date – we know GoW players have found a community to showcase their success and competitive spirit."</p><p>Launched in 2006, 360voice.com is an online community for the Xbox 360 with a unique twist. Gameplay data from Xbox Live is transformed into a comprehensive summary of the player&rsquo;s entire gaming history, conveyed in a blog format from the perspective of the user&rsquo;s Xbox 360.  Conversations around daily achievements and events like Gamerscore increases and most-played games are easily facilitated by the ability to watch other users&rsquo; Xbox 360 blogs and remain up to date on what friends are playing.  360voice.com is operated by community leaders Shawn Blagg and Jonathan Klotz, who manage the site on a daily basis for its user base of more than 200,000 registered members.</p><p>For first dibs on how to participate in the upcoming 360voice Brotherhood Achievement Challenge, sign up for information alerts at <a href="http://360voice.gamerdna.com" target="_blank">360voice.com.</a><p><u><strong>About gamerDNA Media</strong></u><br /><a href="http://www.gamerdnamedia.com">gamerDNA Media</a> gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web. The digital advertising firm represents the top gaming sites, delivering views and visibility to the largest reach of a key demographic of grassroots trendsetters: true gamers, typically males ages 18-34. gamerDNA Media is a go-to partner to seed new products among early adopters and build new revenue opportunities for established brands. The company specializes in helping establish "geek cred" for trend-setting brands, including KFC, FOX, WalMart and Xbox.</p><p># # #</p><p>Media Contact<br />Mark Van Hook<br />Articulate Communications Inc.<br />212.255.0080, ext. 33<br /><a href="mailto:mvanhook@articulatecomms.com">mvanhook@articulatecomms.com</a></p>'],
			
			['news_article_3', '05.16.11', 'gamerDNA Media Delivers Ads to Potential Audience of 20 Million Unique U.S. Visitors Every Month', '<h4><i><center>Digital Ad Firm Triples Potential Reach Year-Over-Year, Delivers to Prospective Audience of Video Gamers Influential for Early Product Adoption and Grassroots Brand-Building</center></i></h4><p><strong>NEW YORK · May 16, 2011</strong> · gamerDNA Media, the digital advertising firm that gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web, today announced that its video game ad network has grown 277% over the past 12 months, delivering ads to sites with a combined potential reach of more than 20 million unique United States visitors every month. According to <a href="http://www.comscore.com/" target="_blank">comScore</a>, the global digital analytics leader, gamerDNA Media also has garnered a high concentration of visitors among 18-34 year olds, a critical target audience for brands looking to build early awareness among key "geek chic" influencers.</p><p>As more innovative advertisers seek to push grassroots adoption of products or services, they are looking for a way to reach people who have the power and the visibility to impact public perception. The gaming community, typically men ages 18-34, is a proven way to do that – if you can reach them.</p><p>"True gamers are notoriously difficult to pin down, and they don&rsquo;t like anything about traditional advertising," said Jay Benach, President, gamerDNA Media. "Brands that can tap into this group are immediately considered hip, new and &lsquo;must have.&rsquo;  At gamerDNA, we work with the world&rsquo;s most interesting brands to launch new products, re-launch old products in new ways and drive early adoption among some of the web&rsquo;s most vocal decision-makers."</p><p>Other notable findings from the recently released comScore data include:</p> <ul> <li>gamerDNA Media is now the fourth largest gaming ad network, potentially reaching more visitors in the 12-17, 18-24 and 25-34 age ranges than the general Internet audience and making it a go-to resource to reach grassroots-level influencers where they live on the web.</li><li>Nearly 25 percent of the visitors on gamerDNA Media&rsquo;s network make more than $100,000 in annual household income, combining online influence with actual buying power.</li><li>gamerDNA Media&rsquo;s publisher network has also grown exponentially in Europe, now potentially reaching more than 15 million unique visitors across European sites. This can provide critical awareness on a worldwide basis for global brand campaigns.</li></ul><p><u><strong>About gamerDNA Media</strong></u><br /><a href="http://www.gamerdnamedia.com">gamerDNA Media</a> gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web. The digital advertising firm represents the top gaming sites, delivering views and visibility to the largest reach of a key demographic of grassroots trendsetters: true gamers, typically males ages 18-34. gamerDNA Media is a go-to partner to seed new products among early adopters and build new revenue opportunities for established brands. The company specializes in helping establish "geek cred" for trend-setting brands, including KFC, FOX, WalMart and Xbox.</p><p># # #</p><p>Media Contact<br />Mark Van Hook<br />Articulate Communications Inc.<br />212.255.0080, ext. 33<br /><a href="mailto:mvanhook@articulatecomms.com">mvanhook@articulatecomms.com</a></p>'],
			
			['news_article_4', '05.10.11', 'gamerDNA Media and PLAYXPERT Bring Next-Gen Community Technology to gamerDNA.com', '<h4><i><center>Leading In-Game Community Toolset Provider to Power Tech Backbone for Dedicated Gamer Haven</center></i></h4><p><strong>NEW YORK · May 10, 2011</strong> · gamerDNA Media, the digital advertising firm that gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web, today announced that it has entered a strategic technology partnership with PLAYXPERT, provider of the premier in-game widget, communication and multi-media platform.  As a result of the agreement, PLAYXPERT will leverage its gaming expertise and versatile technology to further develop gamerDNA.com and support the site&rsquo;s growing gamer community.</p><p>PLAYXPERT&rsquo;s unique in-game overlay technology gives gamers around the world access to chat, match-making, entertainment and a range of community-focused applications without the need to navigate out of their favorite game or impact frame rates.  The company&rsquo;s seasoned team of technologists and developers have created an open, extensible widget architecture that allows anyone to develop, configure and customize PLAYXPERT&rsquo;s client to fit their gaming desires.  Through its partnership with gamerDNA Media, the company will apply this technology and further enhance gamerDNA.com to bring its audience the most robust tools available for connecting and interacting with other like-minded gamers.</p><p>"Launched in 2008, gamerDNA.com was developed with such forethought that it remains one of the few social applications to enable console and PC gamers to share and connect," said Charles F. Manning, CEO of PLAYXPERT.  "By applying our experience in community management and expanding the service to include console, PC and mobile, we are confident that gamerDNA.com will continue to drive innovation in the market.  The combination of our intellectual property and expertise and gamerDNA Media&rsquo;s industry reach delivers an unmatched offering for gamers and advertisers alike." </p><p>In addition to its versatile technology aimed at console and PC gamers, PLAYXPERT&rsquo;s consulting practice, METAXPERT, has built extensive experience in developing and delivering mobile solutions to global brands and agencies. As another benefit of its partnership with gamerDNA Media, PLAYXPERT will apply this expertise in mobile to extending gamerDNA.com to reach the full spectrum of gamers – wherever they may be.</p><p>"PLAYXPERT has been a pioneer in bringing community management capabilities to the in-game experience, creating advancements that have changed the way gamers connect with other gamers while they play," said Jay Benach, President, gamerDNA Media. "With the company&rsquo;s technology powering gamerDNA.com, we&rsquo;re confident that the site will become a vibrant, thriving haven for gamers of all stripes, while simultaneously allowing us to focus on our core mission of helping advertisers reach some of the most buzz-generating influencers on the web."</p><p><strong><u>About PLAYXPERT</strong></u><br />PLAYXPERT, LLC, is the provider of next-generation community management tools for games. PLAYXPERT licenses its technology platform to publishers, studios, and communities allowing them to cater to the needs of gamers by giving them an always-on, skinnable technology platform that can be bundled or integrated directly with their games. Partners include industry innovators like Razer, Destructoid, GuildLaunch, and GamersGate. For more information, please visit <a href= "http://www.playxpert.com"; target="_blank">www.playxpert.com. </a></p><p><strong><u>About gamerDNA Media</strong></u><br /><a href= "http://www.gamerdnamedia.com">gamerDNA Media</a> gives advertisers a targeted, creative gateway to some of the most buzz-creating influencers on the web. The digital advertising firm represents the top gaming sites, delivering views and visibility to the largest reach of a key demographic of grassroots trendsetters: true gamers, typically males, ages 18-30. gamerDNA Media is a go-to partner to seed new products among early adopters and build new revenue opportunities for established brands. The company specializes in helping establish "geek cred" for trend-setting brands, including White Castle, FOX, Walmart and Xbox.</p><p># # #</p><p>Media Contact<br />Mark Van Hook<br />Articulate Communications Inc.<br />212.255.0080, ext. 33<br /><a href="mailto:mvanhook@articulatecomms.com">mvanhook@articulatecomms.com</a></p>'],
			
			['news_article_5', '04.07.11', 'gamerDNA Media unveils new website and corporate identity.', '<img src="images/news/2011-04-07.png" width="416" height="407" />'],
			
			['news_article_6', '05.03.11', 'Announcing the launch of our brand new site!', 'New site <a href="#">New site Lorem ipsum dolor sit amet</a> <p> Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? '],
			
			['news_article_7', '04.24.11', 'gamerDNA Media announces partnership with BrandX', 'Lorem ipsum dolor sit amet <a href="#">Lorem ipsum dolor sit amet</a>  <p> Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? '],
			
			['news_article_8', '04.01.11', 'gamerDNA Media announces partnership with BrandX', 'Lorem ipsum dolor sit amet <a href="#">Lorem ipsum dolor sit amet</a>'],
			
			['news_article_9', '03.29.11', 'Videogames trump films as top-earning entertainment', 'Lorem ipsum dolor sit amet <a href="#">Lorem ipsum dolor sit amet</a>'],
			
			['news_article_10', '03.19.11', 'Announcing the launch of our brand new site!', 'Lorem ipsum dolor sit amet <a href="#">Lorem ipsum dolor sit amet</a>']];

function SwitchNews(news)
{
	for (i = 0; i < News.length; i++)
	{
		if (News[i][0] == news)
		{
			//$('news_article_date').empty().appendText(News[i][1]);
			$('news_article_title').empty().appendText(News[i][2]);
			$('news_article_text').empty().set('html', News[i][3]);
			setHeight('news');
		}
	}
}
