/* B5Media Team Widget (CS) */

var cs_lastViewedTM = null;
var cs_lastViewedTMInnerHTML = null;

/* 
	Edit team members in the following 3 arrays.
	Each array contains a collection of objects; each object represents one team member.
	If a team member property has no value, give it the empty string value ("") or the JS keyword null, like so:
		twitterName:""
			or
		twitterName:null
*/
// 
var cs_team1 = new Array();
cs_team1[0] = {
		photoFileName:"elaine_bw_100x100.jpg",
		name:"Elaine Kunda",
		title:"CEO",
		twitterName:"",
		twitterURL:"",
		blogName:"",
		blogURL:"",
		skypeName:"",
		skypeURL:"",
		tmDo:"As much as I can possibly fit into each and every day!!",
		tmHaveDone:"Most recently I completed my 1st Triathlon...more to come once I recover from the post traumatic stress syndrome (I’m certain I almost drowned!).",
		tmLikeToDo:"Crack the code for a hugely successful online media company then take off for a while and help people who don’t have access to the basic necessities of life."
};
cs_team1[1] = {
	photoFileName:"jw_thumbnail.jpg",
	name:"Jeremy Wright",
	title:"Founder",
	twitterName:"jeremywright",
	twitterURL:"http://www.twitter.com/jeremywright",
	blogName:"Ensight",
	blogURL:"http://ensight.org/",
	skypeName:"jeremywright",
	skypeURL:"skype:jeremywright?call",
	tmDo:"Fly kites. Build companies. Watch movies. Blog (too much). Twitter (too much). Eat (too much). Oh, and watch over the rockstar b5team!",
	tmHaveDone:"Built 4 great companies. Made a rock skip 12 times. Wrote a book or two (and read a few of thousand). Had way too much fun.",
	tmLikeToDo:"Learn to fly (a plane, duh). Live in Italy. Design (and make) my own pants. Climb a mountain. Jump a shark. Read every Isaac Asimov story."
};
cs_team1[2] = {
	photoFileName:"darrenrowse.jpg",
	name:"Darren Rowse",
	title:"Founder",
	twitterName:"problogger",
	twitterURL:"http://www.twitter.com/problogger",
	blogName:"Problogger",
	blogURL:"http://www.problogger.net",
	skypeName:"",
	skypeURL:"",
	tmDo:"My passions are to communicate and build community. Most of what I do in my work each day attempts to build on these.",
	tmHaveDone:"Created blogs, planted a faith community, co-founded a company (b5media), started a family - I'm a 'serial starter'.",
	tmLikeToDo:"I want to help people reach their potential."
};
cs_team1[11] = {
	photoFileName:"lee_newton.jpg",
	name:"Lee Newton",
	title:"Server Therapist",
	twitterName:"leenewton",
	twitterURL:"http://twitter.com/leenewton",
	blogName:"Blog Meets World",
	blogURL:"http://www.blogmeetsworld.com/",
	skypeName:"",
	skypeURL:"",
	tmDo:"I sing the songs that make the servers sing, I sing the songs of bits and bytes and things. I sing the songs so the users do not cry...",
	tmHaveDone:" Worked with computers all my life, with stints as bicycle mechanic, test-driver, short-order cook, and yard hand at a buddhist retreat camp.",
	tmLikeToDo:"Get my pilot's license, drive in the Targa NFLD, see the death of the keyboard/mouse interface, and I want to see mountains Gandalf, mountains!!!"
};
cs_team1[3] = {
	photoFileName:"joe.jpg",
	name:"Joe Taiabjee",
	title:"Director, Technology",
	twitterName:"joetek",
	twitterURL:"http://twitter.com/joetek",
	blogName:"Joetek",
	blogURL:"http://www.joetek.ca",
	skypeName:"",
	skypeURL:"",
	tmDo:"I build the web for innovation, scalability and an audience of millions.",
	tmHaveDone:"I've built technology to support some of the largest, kick-ass websites and web applications.",
	tmLikeToDo:"I'd like keep pushing the envelope of possibilities as we move our lives online."
};
cs_team1[4] = {
	photoFileName:"gabriellegreen.jpg",
	name:"Gabrielle Green",
	title:"Senior Account Executive",
	twitterName:"gabigrn",
	twitterURL:"http://www.twitter.com/gabigrn",
	blogName:"",
	blogURL:"",
	skypeName:"",
	skypeURL:"",
	tmDo:"Sling ads, build marketing programs for b5media partners.",
	tmHaveDone:"Ten plus years in online media, publishing, advertising with an emphasis in the technology space.",
	tmLikeToDo:"Help people, build programs with excellent ROI, hike, yoga, bike."
};
cs_team1[12] = {
	photoFileName:"corey.jpg",
	name:"Corey Shaffer",
	title:"Support Ninja",
	twitterName:"",
	twitterURL:"",
	blogName:"The Corey Story",
	blogURL:"http://www.thecoreystory.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Main line of support for b5media.",
	tmHaveDone:"Kept bloggers smiling.",
	tmLikeToDo:"Optimize the company's support structure and get the ticket queue to zero!"
};
cs_team1[6] = {
	photoFileName:"kori-ellis.jpg",
	name:"Kori Ellis",
	title:"Senior Editor",
	twitterName:"koriellis",
	twitterURL:"http://twitter.com/koriellis",
	blogName:"The Fantasy Kickoff",
	blogURL:"http://www.thefantasykickoff.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"I write for a variety of blogs, websites, magazines and newspapers. I work from home and spend the majority of my life in my robe.",
	tmHaveDone:"I started a Spurs message board in 2003 that gets over 4 million page views a month. I've been to every state in the U.S. except Alaska.",
	tmLikeToDo:"Continue to live happily ever after with my husband and hopefully have a few kids."
};
cs_team1[10] = {
	photoFileName:"brianlayman.jpg",
	name:"Brian Layman",
	title:"Code Ninja",
	twitterName:"brianlayman",
	twitterURL:"http://www.twitter.com/brianlayman",
	blogName:"The Code Cave",
	blogURL:"http://www.thecodecave.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Silent and unseen, I traverse the dark underworld of code behind b5media entities. Where there's a need for JS, PHP, CSS or SQL, I am there.",
	tmHaveDone:"I've spent 18 years practicing the art of code in corporate America. I've experienced the disciplines both of Agile and Extreme Programming.",
	tmLikeToDo:"I'm on a quest to find the perfect work location, with a good view, quiet, 110 outlet, highspeed Internet, comfy chair and a coffee IV drip."
};
cs_team1[8] = {
	photoFileName:"franca.jpg",
	name:"Franca Schulte",
	title:"Account Manager",
	twitterName:"",
	twitterURL:"",
	blogName:"I'm Not Okay With That",
	blogURL:"http://www.imnotokwiththat.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"I organize. More specifically, I handle the blogger contracts, schedule meetings, and know the Purolator, UPS and Staples guy by name.",
	tmHaveDone:"I have done everything except take the fulltime job thing seriously- then came along b5media.",
	tmLikeToDo:"If I had to choose three: Compose music for the big screen, perform in Stomp, and be a professional 'Co-worker of the Week'."
};
cs_team1[5] = {
	photoFileName:"arieannaschweber-ce.jpg",
	name:"Arieanna Schweber",
	title:"Senior Editor",
	twitterName:"arieanna",
	twitterURL:"http://www.twitter.com/arieanna",
	blogName:"Blogoholics",
	blogURL:"http://www.blogoholics.ca",
	skypeName:"",
	skypeURL:"",
	tmDo:"I manage a kick-ass set of Entertainment writers for b5. I am a pro blogger & event photographer. A proud Vancouverite, married, 2 cats.",
	tmHaveDone:"Business & Communications joint degree from SFU. Background in marketing & advertising. Jumped into pro blogging in 2005.",
	tmLikeToDo:"Put our name out there in the Entertainment industry. Speak at more events. Build up my photography portfolio. Have fun. Travel."
};
cs_team1[7] = {
	photoFileName:"TerrySmithbw.jpg",
	name:"Terry Smith",
	title:"Code Ninja",
	twitterName:"terryjsmith",
	twitterURL:"http://www.twitter.com/terryjsmith",
	blogName:"Ice Tea Powered",
	blogURL:"http://www.iceteapowered.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Work really quickly building out new ideas and web sites. Build desktop applications and video games in my 'free time'.",
	tmHaveDone:"Worked with almost every PHP framework, presented at Wordcamp Toronto, and married my high school sweeheart.",
	tmLikeToDo:"Write a book, start a few amazing companies and one day run for public office."
};
cs_team1[9] = {
	photoFileName:"nikki_katz.jpg",
	name:"Nikki Katz",
	title:"Staff Writer",
	twitterName:"",
	twitterURL:"",
	blogName:"Junior Celebs",
	blogURL:"http://www.juniorcelebs.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Write and manage communities for five blogs (at the moment!) and assist wherever needed on other blogs across the network!",
	tmHaveDone:"Come 180 degrees from my B.S. in Aerospace Engineering! Did consulting, project management, authored a few books, and now freelance writing. Oh, and got married and had a few kids!",
	tmLikeToDo:"Fly to the moon. Seriously. And be famous. I'd love to have my own talk show one day. And along the way I'd like to be an awesome mom and wife!"
};
cs_team1[13] = {
	photoFileName:"brittany_dow.jpg",
	name:"Brittany Dow",
	title:"Intern",
	twitterName:"MissBrittanyDow",
	twitterURL:"http://www.twitter.com/missbrittanydow",
	blogName:"Avril Groupie",
	blogURL:"http://www.avrilgroupie.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Help the content team where I can! Blog and blog some more. Smile, laugh, and play.",
	tmHaveDone:"Studied Art History, through and through. Traveled to London, Paris, and Berlin. Enrolled in E-Business & Web Marketing. Now, I'm surfing the digital wave.",
	tmLikeToDo:"Blog into the future. Work from home. Continue to collect retro furniture. Eat great food, smile, laugh, and play."
};
cs_team1[14] = {
	photoFileName:"sabrina_baldini.jpg",
	name:"Sabrina Baldini",
	title:"Intern",
	twitterName:"Sabrina Scorpio",
	twitterURL:"http://twitter.com/sabrinascorpio",
	blogName:"Jess and Ashlee",
	blogURL:"http://www.jessandashlee.com",
	skypeName:"",
	skypeURL:"",
	tmDo:"Proud member of the content team, update sites, write, blog, drink coffee, be awesome.",
	tmHaveDone:"Where do I start?  Student, waitress, cashier, political scientist, journalist, world traveler, sexual educator, drama queen, awesome person.",
	tmLikeToDo:"Continue writing, travel all over the world, especially Africa, blog blog blog, learn to speak French, complete a triathalon, continue being awesome."
};

// The Minions
var cs_team2 = new Array();

// Channel Editors
var cs_team3 = new Array();


function cs_loadTeams() {
	cs_buildAndDisplayTeam(cs_team1,1);
	cs_buildAndDisplayTeam(cs_team2,2);
	cs_buildAndDisplayTeam(cs_team3,3);
	// Open up the first team member balloon
	cs_toggleTeamDetail(document.getElementById("cs_teamLevel_1_tmID_0"));
}

function cs_buildAndDisplayTeam(teamArray,teamLevel) {
	var row = document.createElement("div");
	row.className = "cs_teamRow";
	for(var i=0; i<teamArray.length;i++) {
		if(!teamArray[i].name) continue;

		// Create nodes.
		var summary = document.createElement("div");
		summary.id = "cs_teamLevel_"+teamLevel+"_tmID_" + i;
		summary.className = "cs_tmSummary";
		summary.onclick = cs_toggleTeamDetail;
		var textbox = document.createElement("span");
		textbox.className = "cs_tmSummaryTextbox";
		var name = document.createElement("span");
		name.className = "cs_tmName";
		name.appendChild(document.createTextNode(teamArray[i].name));
		var title = document.createElement("span");
		title.className = "cs_tmTitle";
		title.appendChild(document.createTextNode(teamArray[i].title));
		// Append nodes.
		textbox.appendChild(name);
		textbox.appendChild(title);
		summary.appendChild(textbox);
		row.appendChild(summary);
		// Only 4 summaries on each row.
		if(i%4==3) {
			var clearDiv = document.createElement("div");
			clearDiv.style.clear = "both";
			row.appendChild(clearDiv);
			document.getElementById("cs_team"+teamLevel).appendChild(row);
			row = document.createElement("div");
			row.className = "cs_teamRow";
		}
	}
	var clearDiv = document.createElement("div");
	clearDiv.style.clear = "both";
	row.appendChild(clearDiv);
	document.getElementById("cs_team"+teamLevel).appendChild(row);
}

function cs_toggleTeamDetail() {
	// Check if function is passed an argument (used to expand first team member on load)
	var tm = (this.id)?this:arguments[0];
	if(tm != cs_lastViewedTM && cs_lastViewedTM!=null) cs_collapseTM(cs_lastViewedTM);
	var tmID = tm.id.split(/tmID_/i)[1];
	var teamLevel = tm.id.match(/teamLevel_(\d)_/i)[1];
	var rowPos = tmID%4 + 1;
	var balloon = document.getElementById("cs_tmDetailDiv");
	tm.parentNode.insertBefore(balloon,tm.parentNode.firstChild);
	cs_fillTmDetail(tmID,teamLevel);
	balloon.style.position = "relative";
	balloon.style.background = "url(images/team/balloon_"+rowPos+".gif) center no-repeat";
	balloon.style.display = "block";
	tm.className = "cs_tmSummaryEmpty";
	cs_lastViewedTMInnerHTML = tm.innerHTML;
	tm.innerHTML = "";
	cs_lastViewedTM = tm;
}

function cs_collapseTM(tmObj) {
	tmObj.className = "cs_tmSummary";
	tmObj.innerHTML = cs_lastViewedTMInnerHTML;
}

function cs_fillTmDetail(tmID,teamLevel) {
	var tmArray = eval("cs_team"+teamLevel);
	document.getElementById("cs_tmPhoto").src = document.getElementById("cs_tmPhoto").src.replace(/[^\/]*\.jpg$/i,tmArray[tmID].photoFileName);
	document.getElementById("cs_tmName").innerHTML = tmArray[tmID].name;
	document.getElementById("cs_tmTitle").innerHTML = tmArray[tmID].title;
	if(tmArray[tmID].twitterURL!="" && tmArray[tmID].twitterURL!=null) {	
		document.getElementById("cs_tmTwitter").href = tmArray[tmID].twitterURL;
		document.getElementById("cs_tmTwitter").innerHTML = tmArray[tmID].twitterName;
		
		document.getElementById("cs_tmTwitterSpan").style.display="inline";
	}
	else
		document.getElementById("cs_tmTwitterSpan").style.display="none";
	
	if(tmArray[tmID].blogURL!="" && tmArray[tmID].blogURL!=null) {	
		document.getElementById("cs_tmBlog").href = tmArray[tmID].blogURL;
		document.getElementById("cs_tmBlog").innerHTML = tmArray[tmID].blogName;
		document.getElementById("cs_tmBlogSpan").style.display="inline";
	}
	else
		document.getElementById("cs_tmBlogSpan").style.display="none";
	
	if(tmArray[tmID].skypeURL!="" && tmArray[tmID].skypeURL!=null) {	
		document.getElementById("cs_tmSkype").href = tmArray[tmID].skypeURL;
		document.getElementById("cs_tmSkype").innerHTML = tmArray[tmID].skypeName;
		document.getElementById("cs_tmSkypeSpan").style.display="block";
	}
	else
		document.getElementById("cs_tmSkypeSpan").style.display="none";
	document.getElementById("cs_tmDo").innerHTML = tmArray[tmID].tmDo;
	document.getElementById("cs_tmHaveDone").innerHTML = tmArray[tmID].tmHaveDone;
	document.getElementById("cs_tmLikeToDo").innerHTML = tmArray[tmID].tmLikeToDo;
}

// Attach load events to the page.
if(document.addEventListener)
	window.addEventListener('load',cs_loadTeams,false);
else if(document.attachEvent)
	window.attachEvent('onload',cs_loadTeams);
