gQuoteFaders = new Object;
var bFirstQuote = true;

var kHiddenColor = [ 0xFF, 0xFF, 0xFF ];
var kDisplayedColor = [ 0x22, 0x66, 0xBB ];

function d2h(dec)
{
       return dec.toString(16);
}
function h2d(hex)
{
       return parseInt(hex,16);
}

function CssColorToRgb(color)
{
     if(color.indexOf('rgb')<=-1)
	 {
	     return [h2d(color.substring(1,3)),h2d(color.substring(3,5)),h2d(color.substring(5,7))];
     }
     return color.substring(4,color.length-1).split(',');
}

function RgbToCssColor(color)
{
     return "rgb("+color[0]+","+color[1]+","+color[2]+")";;
}

function lerp(color0, color1, t)
{
	return [Math.round(color0[0] * (1-t) + color1[0] * t), Math.round(color0[1] * (1-t) + color1[1] * t), Math.round(color0[2] * (1-t) + color1[2] * t)];
}

function QuoteFaderBegin( containerId, quoteTextId, quoteSourceId, newQuoteText, newQuoteSource, duration, interval )
{
	key = containerId;
	var fadeObject = new Object;
	gQuoteFaders[key] = fadeObject;
	
	fadeObject.fadeDuration = duration;
	fadeObject.fadeInterval = interval;
	fadeObject.opacityDelta = -interval/duration;
	fadeObject.newQuoteText = newQuoteText;
	fadeObject.newQuoteSource = newQuoteSource;
	fadeObject.container = document.getElementById(containerId);
	fadeObject.quoteText = document.getElementById(quoteTextId);
	fadeObject.quoteSource = document.getElementById(quoteSourceId);
	fadeObject.opacity = 1.0;
	
	if ( bFirstQuote )
	{
//		kDisplayedColor = CssColorToRgb(fadeObject.container.style.color);
		fadeObject.container.style.color = RgbToCssColor(kHiddenColor);
		fadeObject.opacity = 0.0;
		bFirstQuote = false;
	}
	
	setTimeout('QuoteFaderStep("' + key + '")', fadeObject.fadeInterval);
}

function QuoteFaderStep( key )
{
	var fadeObject = gQuoteFaders[key];
	
	fadeObject.opacity += fadeObject.opacityDelta;
	var done = false;
	var pauseTime = 0;
	
	if ( fadeObject.opacity <= 0.0 && fadeObject.opacityDelta < 0.0 )
	{
		// done fading out, swap the text
		fadeObject.quoteText.innerHTML = fadeObject.newQuoteText;
		fadeObject.quoteSource.innerHTML = fadeObject.newQuoteSource;
		fadeObject.opacityDelta = -fadeObject.opacityDelta;
		fadeObject.opacity = 0.0;
		pauseTime = 800;
	}
	else if ( fadeObject.opacity >= 1.0 && fadeObject.opacityDelta > 0.0 )
	{
		// done fading in
		done = true;
		fadeObject.opacity = 1.0;
	}
	
	fadeObject.container.style.color = RgbToCssColor(lerp(kHiddenColor, kDisplayedColor, fadeObject.opacity));
	
	if ( !done )
		setTimeout('QuoteFaderStep("' + key + '")', fadeObject.fadeInterval + pauseTime);
	else
		gQuoteFaders[key] = null;
}

quotes = [
	["LOGIN 2008 was a great experience. LOGIN offers great networking opportunities, a beautiful venue, valuable information from the sessions and the best amenities. LOGIN has the best online game design and marketing seminars I have attended all year and easily pays for itself in the knowledge and contacts gained.", "Aaron Jones, MarkeeDragon Inc"],
	["Where else can you find the best and brightest of the MMO space all in one place?", "Anne Toole, Narrative Designer/Writer"],
	["Last year's conference was the perfect venue for bringing together leaders and visionaries within the online gaming industry. It was an honor to serve on an executive panel with my peers, and very fulfilling to attend the wide variety of great sessions offered at the event. In my opinion it was the key event of the year for networking, catching up with industry colleagues, and making new friends. I look forward to the LOGIN 2009 event.", "Bob Ferrari, VP of Business Development, Turbine"],
	["After the great experience I had in 2007, I had very high expectations for 2008. I'm happy to say that those expectations were met and exceeded this year! Once again this conference had outstanding speakers and sessions, great networking, wonderful food, all in an excellent location. I'm already looking forward to next year.", "Brian Robbins, Executive Producer / Gaming Evangelist, Fuel Industries, Inc."],
	["The networking opportunities that I encountered at LOGIN 2008 were unlike any other conference I've been a part of. The range of individuals present - from executives to relative newbies - can't be surpassed. A truly phenomenal show.", "Cody Bye, Managing Editor Ten Ton Hammer"],
	["Evergreen Events has created a conference that's provided a tremendous opportunity for iovation to connect with our gaming clients, network with the some of the biggest names and newcomers in the industry, and learn more about all of their exciting new products. We are anxious to be a part of LOGIN in 2009!", "Cory Swick, Sr. Enterprise Sales Executive, iovation Inc."],
	["With its laser-sharp content focus, excellent amenities, and brilliant attendees, LOGIN 2008 was easily the best conference I've attended in memory.", "Darius Kazemi, President Orbus Gameworks"],
	["If I had to recommend one event to a newcomer into the industry I would tell them that LOGIN is a must-attend. The quality of the attendees exceeds most other events. I have benefited more from LOGIN than any other event since I entered this industry.", "David Wisotzky, President/CEO, Xivio"],
	["The best run conference in the gaming industry.", "Douglas Naimo, President, Triggerfinger Software"],
	["This conference is at the top of my list for 2009. This was honestly a perfect conference as far as I'm concerned. The networking was fantastic, the environment was lush (even decadent), the speakers were terrific, and I loved the location.", "Erin Hoffman, Game Designer, Philomath Games"],
	["LOGIN 2008 was a very positive experience there were great networking opportunities, informative panels, and casual areas to hold meetings we will definitely be attending in 2009!", "Jodie McIntyre, CEO, MPOGD"],
	["LOGIN was a great combination of education and networking, laser-focused on the people and issues that matter most to the exploding MMOG industry.", "John Young, General Manager, Slipgate Ironworks"],
	["LOGIN 2008 had a lot to live up to from the prior year - and it easily surpassed 2007 in all areas; networking, education and professionalism.", "Katie Postma, Senior Community Manager, FireSky"],
	["If you work in the online games space - this is the show to attend.", "Katja Reitemeyer, Director, Media & Entertainment, iEnergizer"],
	["Thanks for all your hard work at LOGIN. It was a great turnout. I enjoyed the speakers, the topics were interesting, and the networking was incredible. I made more new friends than at any show I have attended... and that is a lot of shows!", "Krissie Franco, Exe. V.P. Production, Hydrogen Whiskey"],
	["Like the 2008 conference, LOGIN 2009 will no doubt be a compact conference with the right mixture of high level designers, developers and executives to get things done while being small enough to not be a media circus.", "Marty Poulin, CEO of ShadyLogic Studios"],
	["Evergreen's conferences are everything a game conference should be &mdash; great sessions, speakers, and plenty of networking opportunities. We look forward to participating in 2009!", "Matt Tullis, Sr. Manager Game Segment, Dolby Laboratories"],
	["I think it speaks very well of the organizers that in such a short period of time they've been able to develop a conference that is so content rich, well organized and just right in terms of size. Bravo.", "Mike Doyle, Producer Online, Relic Entertainment"],
	["First time at LOGIN, great experience, learned a lot, particularly thanks to very well moderated panels. The small size like first GDCs was a great opportunity for networking.", "Nicolas Eypert, Creative Director, UBISOFT"],
	["LOGIN was a great conference - a small environment, packed with decision makers from across the games industry. We will definitely be attending in the future.", "Paul Manwell, Director - Business Development, PX Interactive"],
	["I thought that the conference made it easy to connect with almost all that attended. I liked that most people stuck around for the conference thru the end.", "Phil Adam, President, BigWorld"],
	["LOGIN '08 was one the best organized and most valuable conferences that I have attended in a very long time!", "Pierre Joubert, Senior Director Partnerships, BitTorrent, Inc"],
	["LOGIN 2008 was positively energizing. I was absolutely thrilled to be surrounded by professionals working in MMOs and virtual worlds.", "Sande Chen, Writer/Designer, The Writers Cabal"],
	["One of the best game conferences that really work. Deals signed and the right people met.", "Seth Crofton, Humanity Online"],
	["Most relevant topics, most synergistic atmosphere, and most productive 4 days I've had in a long time. Simply put, LOGIN provides the best opportunity for executive level professional to network - period.", "Skylar Kreisher, CEO, Olympus Entertainment"],
	["I was very impressed with all aspects of the LOGIN 2008 conference. The content, networking opportunities, arrangements and even the food were all great.", "Steve Klebe, VP, Business Development, BilltoMobile(tm) from Danal, Inc."],
	["One of the best game conferences I have attended, both in terms of content and execution.", "Thomas Edwards, Principal Consultant, Englobe Inc."],
	["I really found your event more rewarding than any tradeshow I have ever been to. Great talks, great atmosphere you guys built, and great food. Sign me up for next year.", "Tony Roam Gascon, Production Manager, Reinvented, Inc."],
	["Seattle is a beautiful city, a perfect backdrop for a fantastic conference. LOGIN has swiftly become my favorite event of the year.", "Troy Hewitt, Director, Community Relations Flying Lab Software"],
	["Good arrangements and guidance, good breakfast meetings.", "Yiran Xu, Director of Strategic Investment, Giant Interactive Group"],
	["Vindicia is enthusiastic about the opportunity to support one of the most forward-thinking and influential game industry conferences. The 2009 LOGIN Conference is the perfect environment to engage with our customers and industry thought leaders to share our expertise in monetization, customer acquisition and customer retention.", "Gene Hoffman, CEO, Vindicia"],
	["Evergreen's past event was an intimate get-together of some of the sharpest minds in the MMO field today.", "Sam Lewis, Lead Designer, Cartoon Network"],
	];

lastUsedIndex = -1;

function RandomInt( range )
{
	return Math.floor(Math.random() * range);
}

function StartQuoteFader()
{
	var nextIndex;
	do
	{
		nextIndex = RandomInt(quotes.length);
	} while ( nextIndex == lastUsedIndex && quotes.length > 1 );
	
	var newQuoteText = quotes[nextIndex][0];
	var newQuoteSource = "- " + quotes[nextIndex][1];
	
	QuoteFaderBegin("quoteContainer", "frontQuoteText", "frontQuoteSource", newQuoteText, newQuoteSource, 1500, 40);
	lastUsedIndex = nextIndex;
	setTimeout('StartQuoteFader()', 10000);
}


