/**
 * 
 * ML WEBCAST PAGE
 * v0.1
 * by Bob Budd
 * bbudd@boathouseinc.com
 *
 */


Event.observe(window, 'load', function() {
	/*if ($('webcast_hero_swf')!=null) {
		Event.observe('webcast_hero_swf', 'click', function(e){
			var newTop;
			if(checkPanelist(Event.element(e)) == 'dad' || checkPanelist(Event.element(e)) == 'grandad'){
		    	Event.stop(e);
		    	if(checkPanelist(Event.element(e)) == 'dad'){
		    		newTop = Event.element(e).parentNode.id;
		    	} else {
		    		newTop = Event.element(e).parentNode.parentNode.id;
		    	}
		    	modalize(newTop);
		    	
		    }
		});
	}*/
	
	if ($('hero-container-noflash')!=null) {
		Event.observe('hero-container-noflash', 'click', function(e){
			var newTop;
			if(checkPanelist(Event.element(e)) == 'dad' || checkPanelist(Event.element(e)) == 'grandad'){
		    	Event.stop(e);
		    	if(checkPanelist(Event.element(e)) == 'dad'){
		    		newTop = Event.element(e).parentNode.id;
		    	} else {
		    		newTop = Event.element(e).parentNode.parentNode.id;
		    	}
		    	modalize(newTop);
		    	
		    }
		});
	}
	
	if(Prototype.Browser.IE && $('webcastIframe') !== null){
		setInterval(function(){
			if($('modal_overlay').getStyle('display') !== 'none' && $('webcastIframe').getStyle('left') === '17px'){
				$('webcastIframe').setStyle({'left': '-1000px'});
			} else if(($('modal_overlay').getStyle('display') === 'none') && $('webcastIframe').getStyle('left') === '-1000px'){
				$('webcastIframe').setStyle({'left': '17px'});
			}
		}, 500);
	}
	
	if($('email_reminder') !== null){
		//var newA = '<div id="charlie-outer"><a href="#" id="charlesBio" onclick="modalize(\'charles\'); return false;"></a></div>';		
		//new Insertion.After('addthis-links', newA);
		Event.observe('email_reminder', 'click', function(e){
			Event.stop(e);
			emailReminder();
		});
		
		Event.observe('cal_reminder', 'click', function(e){
			Event.stop(e);
			calReminder();
		});
		
		Event.observe('text_reminder', 'click', function(e){
			Event.stop(e);
			textReminder();    	
		});
		
		/*Event.observe('addthis-links', 'click', function(e){
			Event.stop(e);
			var addId = Event.element(e).id;
			getAddThis(addId);
		});*/

    }
	
	if($('webcast-hero-container-live') !== null || $('webcast-hero-container-interim') !== null){
		
		Event.observe('sign-up', 'click', function(e){
			Event.stop(e);
			signUp();    	
		});
		
    }

	
});


// open the "important information" modal 
function importantModalCall() {
eventTrack('Downloads', 'Link', '2010 Webcast Retirement - 2 - ImportantInfo');
window.open('/publish/mkt/campaigns/Retirement_2010/assets/ImportantInformation.html#','MyWindow','width=940,height=575,left=100,top=100,scrollbars=yes,resizable=no,status=no,location=no toolbar=no');
}

function getTranscript(){
eventTrack('Downloads', 'PDF', '2010 Webcast Retirement - 2 - Transcript');
fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=juner808;ord=1;num=" + a + "?");
cmCreateManualPageviewTag('GWM:Mkt:MLAdvise:webcast_0610_TM','GWM:Mkt:MLAdvise','http://www.totalmerrill.com/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/REINVENTING_RETIREMENT_Second_Acts.pdf','http://www.totalmerrill.com/TotalMerrill/pages/webcast_retire_0610_TM.aspx');
window.open('/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/REINVENTING_RETIREMENT_Second_Acts.pdf','MyWindow','width=980,height=740,left=100,top=100,scrollbars=yes,resizable=no,status=no,location=no toolbar=no');
}


function getClientStories1Transcript(){
eventTrack('Downloads', 'PDF', '2010 Webcast Retirement - 2 - Client Stories Charlton - Transcript');
fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir691;ord=1;num=" + a + "?");
cmCreateManualPageviewTag('GWM:Mkt:MLAdvise:webcast_0610_TM','GWM:Mkt:MLAdvise','http://www.totalmerrill.com/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Randal_Charlton.pdf','http://www.totalmerrill.com/TotalMerrill/pages/webcast_retire_0610_TM.aspx');
window.open('/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Randal_Charlton.pdf','MyWindow','width=980,height=740,left=100,top=100,scrollbars=yes,resizable=no,status=no,location=no toolbar=no');
}


function getClientStories2Transcript(){
eventTrack('Downloads', 'PDF', '2010 Webcast Retirement - 2 - Client Stories Donaldson - Transcript');
fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir691;ord=1;num=" + a + "?");
cmCreateManualPageviewTag('GWM:Mkt:MLAdvise:webcast_0610_TM','GWM:Mkt:MLAdvise','http://www.totalmerrill.com/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Bettye_and_Gary_Donaldson.pdf','http://www.totalmerrill.com/TotalMerrill/pages/webcast_retire_0610_TM.aspx');
window.open('/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Bettye_and_Gary_Donaldson.pdf','MyWindow','width=980,height=740,left=100,top=100,scrollbars=yes,resizable=no,status=no,location=no toolbar=no');
}


function getClientStories3Transcript(){
eventTrack('Downloads', 'PDF', '2010 Webcast Retirement - 2 - Client Stories Greer - Transcript');
fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir691;ord=1;num=" + a + "?");
cmCreateManualPageviewTag('GWM:Mkt:MLAdvise:webcast_0610_TM','GWM:Mkt:MLAdvise','http://www.totalmerrill.com/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Eva_and_Sid_Greer.pdf','http://www.totalmerrill.com/TotalMerrill/pages/webcast_retire_0610_TM.aspx');
window.open('/publish/mkt/campaigns/Webcast_Retire_0610/Post/transcripts/Eva_and_Sid_Greer.pdf','MyWindow','width=980,height=740,left=100,top=100,scrollbars=yes,resizable=no,status=no,location=no toolbar=no');
}


function checkPanelist(item){
	var dad = item.parentNode;
	var grandad = item.parentNode.parentNode;
	if (dad.id == 'charles' || dad.id == 'sallie' || dad.id == 'marc' || dad.id == 'daniel' || dad.id == 'anna') {}return 'dad';
	if (grandad.id == 'charles' || grandad.id == 'sallie' || grandad.id == 'marc' || grandad.id == 'daniel' || grandad.id == 'anna') return grandad;
	
	return false;
}


function modalize(person){
	$('modal_overlay').setStyle({'backgroundColor':'#11395d', 'width':'100%','height':'1800px'});
	$('modal_overlay').show();
	$('modal_overlay').setOpacity(0.9);
	var newDiv = '<div id="new-modal"><a href="" id="modal-close">CLOSE</a>';
	newDiv += '<div id="new-modal-content"><div id="new-modal-content-left"><h3>Our Panelists</h3>';
	newDiv += '<ul id="modal-panelists">';
	newDiv += '<li><a href="" id="modal-charles"><strong>Charles Gibson</strong> Former Anchor, ABC News</a></li>';
	newDiv += '<li><a href="" id="modal-sallie"><strong>Sallie Krawcheck</strong> President, Global Wealth & Investment Management, Bank of America Corporation </a></li>';
	newDiv += '<li><a href="" id="modal-marc"><strong>Marc Freedman</strong> Founder and CEO of Civic Ventures and co-creator of the Purpose Prize</a></li>';
	newDiv += '<li><a href="" id="modal-anna"><strong>Anna Quindlen</strong> Former <em>Newsweek</em> columnist, Pulitzer Prize-winning journalist and best-selling author</a></li>';	
	newDiv += '<li><a href="" id="modal-daniel"><strong>Daniel Gilbert</strong> Professor of Psychology at Harvard University and best-selling author of <em>Stumbling on Happiness</em></a></li>';
	
	
	newDiv += '</ul></div>';
	newDiv += '<div id="new-modal-content-right">';
	
	newDiv += '<div class="bio-content" id="content-charles" style="display:none;"><img src="/publish/mkt/campaigns/Webcast_Retire_0610/images/charles-head.jpg" alt="charles gibson" />';
	newDiv += '<p class="bio-name">Charles Gibson</p>';
	newDiv += '<p class="bio-title">Former Anchor, ABC News</p>';
	newDiv += '<p class="bio-full">Charles Gibson is an award-winning journalist and one of America&rsquo;s favorite broadcast television anchors. He was a host of ABC&rsquo;s <em>Good Morning America</em> from 1987 to 1998 and 1999 to 2006 and ABC News anchor from 2006 until his retirement at the end of 2009.</p>';
	newDiv += '<p class="bio-full">Gibson&rsquo;s career spans from 1965 to 2009. Early positions included news director for Princeton University&rsquo;s student-run radio station, radio producer for RKO and reporter for local television stations. In 1975, he joined ABC News, where he worked as a general assignment reporter and correspondent from Washington, D.C. until becoming a host of <em>Good Morning America</em>.</p>';
	newDiv += '<p class="bio-full">In his career, Mr. Gibson has covered pivotal moments in history, from the Watergate scandal to the death of Pope John Paul II, and was part of ABC&rsquo;s award-winning live coverage of the terrorist attacks on the World Trade Center in 2001. He has interviewed each of the last seven American presidents and leaders from around the globe including Kofi Annan, Tony Blair, Boris Yeltsin, Yasir Arafat, and Nelson Mandela.</p>';
	newDiv += '<p class="bio-full">The National Endowment for the Humanities named Mr. Gibson a National Journalism Fellow at the University of Michigan in 1973, and he has served as a board member of this program, now known as the Knight-Wallace Fellows at Michigan, since 1988.</p>';
	newDiv += '<p class="bio-full">Mr. Gibson is a graduate of Princeton University. He was honored with the 1992 John Maclean Fellowship, which is awarded to Princeton alumni &ldquo;who have made a major contribution to American society.&rdquo;</p>';
	newDiv += '<p class="bio-full">Mr. Gibson, a native of Evanston, IL, grew up in Washington, D.C. He and his wife, Arlene, live in New York. They have two daughters.</p>';
	newDiv += '</div>';
	
	newDiv += '<div class="bio-content" id="content-sallie" style="display:none;"><img src="/publish/mkt/campaigns/Webcast_Retire_0610/images/sallie-head.jpg" alt="sallie krawcheck" />';
	newDiv += '<p class="bio-name">Sallie Krawcheck</p>';
	newDiv += '<p class="bio-title">President, Global Wealth & Investment Management, Bank of America Corporation</p>';
	newDiv += '<p class="bio-full">Sallie L. Krawcheck is president of Global Wealth & Investment Management for Bank of America, one of the largest wealth management businesses in the world with $1.9 trillion* in total client assets. Global Wealth & Investment Management provides comprehensive wealth management to affluent and high net worth clients. It also provides retirement and benefit plan services, philanthropic management and asset management to individuals and institutions.</p>';
	newDiv += '<p class="bio-full">Prior to joining Bank of America, Krawcheck was the chief executive officer and chairman for Citi Global Wealth Management, responsible for the Citi Private Bank, Citi Smith Barney and Citi Investment Research. During her time as CEO, she was also a member of Citi&rsquo;s senior leadership committee and executive committee.</p>';
	newDiv += '<p class="bio-full">Krawcheck joined Citi in October 2002 as chairman and chief executive officer of Smith Barney, where she oversaw the global management of the Smith Barney and Citi Investment Research businesses. In 2004, Sallie was appointed chief financial officer and head of Strategy for Citigroup Inc. Prior to joining Citi, Krawcheck was chairman and chief executive officer of Sanford C. Bernstein & Company, where she became one of the most influential voices for research quality and integrity.</p>';
	newDiv += '<p class="bio-full">Krawcheck has been listed as one of <em>Fortune</em> magazine&rsquo;s &ldquo;Most Powerful Women&rdquo; in business for seven years between 2002 and 2009. <em>U.S. Banker</em> ranked her first on its list of &ldquo;25 Women to Watch&rdquo; in 2009. <em>Forbes</em> magazine, in 2006, listed her as #6 in the rank of the &ldquo;World&rsquo;s 100 Most Powerful Women.&rdquo; She was also the recipient of CNBC&rsquo;s &ldquo;Business Leader of the Future Award&rdquo; in 2007. In 2002, she was recognized as one of <em>Time</em> magazine&rsquo;s &ldquo;Global Business Influentials&rdquo; and, in 2003, <em>Fortune</em> magazine named her the &ldquo;Most Influential Person Under the Age of 40.&rdquo;</p>';
	newDiv += '<p class="bio-full">A native of Charleston, South Carolina, Krawcheck attended the University of North Carolina at Chapel Hill on the Morehead Scholarship and graduated in 1987 with academic honors and a Bachelor of Arts. In 1992, she received a Master of Business Administration from Columbia University.</p>';
	newDiv += '<p class="bio-full">An active participant in the affairs of her alma maters, Krawcheck has endowed her former secondary school, The Porter Gaud School, with the Krawcheck Scholarship, a needs-based scholarship awarding full tuition to students of exceptional aptitude. She is a member of the board of directors of BlackRock, Inc., The University of North Carolina at Chapel Hill Foundations, Inc., and Carnegie Hall; the board of overseers of Columbia Business School; and the board of trustees for The Economic Club of New York.</p>';
	newDiv += '<p class="bio-full"> * Source: Bank of America. Global Wealth and Investment Management (GWIM) is the wealth and investment management division of <br>Bank of America Corporation. As of September 30, 2009 GWIM entities had total client assets of $1.9 trillion. Total Client Assets consists of assets under management (AUM) of GWIM entities, client brokerage assets, and assets in custody of GWIM entities, less an elimination for client brokerage and assets in custody included in AUM.</p>';
	newDiv += '</div>';
	
	newDiv += '<div class="bio-content" id="content-marc" style="display:none;"><img src="/publish/mkt/campaigns/Webcast_Retire_0610/images/Marc-head.jpg" alt="Marc Freedman" />';
	newDiv += '<p class="bio-name">Marc Freedman</p>';
	newDiv += '<p class="bio-title">Founder and CEO of Civic Ventures and co-creator of the Purpose Prize</p>';
	newDiv += '<p class="bio-full">Marc Freedman spearheaded creation of the Experience Corps, now one of America&rsquo;s largest nonprofit national service programs engaging people over 55, and The Purpose Prize, which annually provides five $100,000 prizes and five $50,000 prizes to social innovators in the second half of life.</p>';
	newDiv += '<p class="bio-full">Freedman was described by <em>The New York Times</em> as &ldquo;the voice of aging baby boomers who are eschewing retirement for meaningful and sustaining work later in life,&rdquo; while <em>The Wall Street Journal</em> stated: &ldquo;In the past decade, Mr. Freedman has emerged as a leading voice in discussions nationwide about the changing face of retirement.&rdquo; He is author of <em>Encore: Finding Work That Matters in the Second Half of Life</em>; <em>Prime Time: How Baby Boomers Will Revolutionize Retirement and Transform America</em>; and <em>The Kindness of Strangers: Adult Mentors, Urban Youth, and the New Voluntarism</em>. His new book, <em>Shift</em>, about midlife and the transition of the boomer generation to a new stage of life, will be published in January 2011.</p>';
	newDiv += '<p class="bio-full">Recognized by <em>Fast Company</em> in 2007, 2008 and 2009 as one of the nation&rsquo;s leading social entrepreneurs, Freedman is widely published and quoted in the national media and has been honored with numerous awards and fellowships, including an Ashoka Senior Fellowship. Civic Ventures and Freedman received the 2010 Skoll Award in Social Entrepreneurship at Oxford University in April 2010. </p>';
	newDiv += '<p class="bio-full">Freedman is a high honors graduate of Swarthmore College with an MBA from Yale University and was a Visiting Fellow of Kings College, University of London. He lives with his wife and children in the San Francisco Bay Area.</p>';
	newDiv += '</div>';
	
	newDiv += '<div class="bio-content" id="content-anna" style="display:none;"><img src="/publish/mkt/campaigns/Webcast_Retire_0610/images/Quindlen-head.jpg" alt="Anna Quindlen" />';
	newDiv += '<p class="bio-name">Anna Quindlen</p>';
	newDiv += '<p class="bio-title">Former <em>Newsweek</em> columnist, Pulitzer Prize-winning journalist and best-selling author</p>';	
	newDiv += '<p class="bio-full">Anna Quindlen&rsquo;s books have appeared on fiction, nonfiction and self-help bestseller lists, and her columns have won her many of journalism&rsquo;s most prestigious awards,including the Pulitzer Prize.</p>';
	newDiv += '<p class="bio-full">She was the third woman to write for <em>The New York Times\'</em> influential op-ed page, where she wrote her award-winning column, "Public and Private," and recently retired from <em>Newsweek</em>, where she wrote her column "The Last Word" for ten years.  Her novel, <em>Rise and Shine</em> (September 2006), is a moving story of two sisters, the true meaning of success, and the qualities in life that matter most. It debuted on the <em>New York Times</em> bestsellers list at #1.</p>';
	newDiv += '<p class="bio-full">Quindlen has written four other bestselling novels: <em>Object Lessons, One True Thing, Black and Blue</em>, and <em>Blessings</em>. She has published three collections of her columns, <em>Living Out Loud, Thinking Out Loud</em>, and <em>Loud and Clear</em>, as well as <em>How Reading Changed My Life</em> and <em>Imagined London</em>.</p>';
	newDiv += '<p class="bio-full">Her book <em>A Short Guide to a Happy Life</em> has sold more than a million copies. It was followed by <em>Being Perfect</em>, another national bestseller. Her latest <em>New York Times</em> bestselling book is the just published <em>Every Last One</em>, a novel about facing every last one of the things we fear most and about finding ways to navigate a road we never intended to travel.</p>';
	newDiv += '<p class="bio-full">Quindlen is a native of Philadelphia and a graduate of Barnard College, where she is chair of the board of trustees. She is a fellow of the American Academy of Arts and Sciences and holds honorary degrees from more than a dozen American universities.  She is married to Gerald Krovatin, an attorney, and is the mother of Quindlen, Christopher and Maria Krovatin.</p>';
	newDiv += '</div>';
	
	newDiv += '<div class="bio-content" id="content-daniel" style="display:none;"><img src="/publish/mkt/campaigns/Webcast_Retire_0610/images/Daniel-head.jpg" alt="Daniel Gilbert" />';
	newDiv += '<p class="bio-name">Daniel Gilbert</p>';	
	newDiv += '<p class="bio-title">Professor of Psychology at Harvard University and best-selling author of <em>Stumbling on Happiness</em></p>';
	newDiv += '<p class="bio-full">According to <em>The Wall Street Journal</em>, Daniel Gilbert is the world\'s foremost authority on how people predict their emotional reactions to future events. He is a Professor of Psychology at Harvard University, and the author of the national bestseller <em>Stumbling on Happiness</em>, which spent 25 weeks on the <em>New York Times</em> bestseller list, has been translated into 30 languages, and was awarded the Royal Society&rsquo;s General Prize for best science book of the year. <em>Time</em> magazine called it &ldquo;Fascinating,&rdquo; the <em>New York Times</em> called it &ldquo;Brilliant,&rdquo; and <em>Bloomberg News</em> called it &ldquo;the only truly useful book on psychology I&rsquo;ve ever read.&rdquo;  Gilbert\'s groundbreaking research on how people make judgments, choices and decisions lies at the intersection of psychology and behavioral economics. . He has won numerous awards for his research, including the American Psychological Association&rsquo;s <em>Distinguished Scientific Award for an Early Career Contribution to Psychology</em>. He is the co-editor of <em>The Handbook of Social Psychology</em> and a co-author of the college textbook <em>Psychology</em>. In 2008, he was elected to the prestigious American Academy of Arts and Sciences.</p>';
	newDiv += '<p class="bio-full">In addition to being a leading scientist and best-selling author, Gilbert is also an award winning teacher. He has received the President&rsquo;s Associates Teaching Award and the Phi Beta Kappa Teaching Award, and year after year he is chosen by Harvard&rsquo;s graduating seniors as one of the university&rsquo;s Most Outstanding Professors.  Gilbert is also a well-known public figure. A regular contributor to <em>The New York Times</em>, he has written for <em>Time</em> and <em>Forbes</em>, has been a guest on <em>The Today Show</em>, <em>Charlie Rose</em>, 20/20, and <em>The Colbert Report</em>, and is the co-writer and host of the award-winning PBS television series <em>This Emotional Life</em>.</p>';
	newDiv += '</div>';
	
	
	
	newDiv += '</div></div>   '
	new Insertion.After('modal_overlay', newDiv);
	var theHPos = (Position.GetWindowSize().width / 2) - 380 + 'px';
	var theVPos = ( ((Position.GetWindowSize().height / 2) - 400) > 39 ? ((Position.GetWindowSize().height / 2) - 400) + 'px' : '75px');
	$('new-modal').setStyle({ 'left':theHPos, 'top':theVPos, 'opacity':0 });
	var contenter = 'content-' + person;
	var modaler = 'modal-' + person;
	var num = 0;
	if($('webcastIframe') !== null){
		$('webcastIframe').setStyle({'left': '-1000px'});
	}
	
	var theInterval = setInterval(function(){
		num++;
		var newNum = num / 10;
		if ($('new-modal').getStyle('opacity') < 1){
			$('new-modal').setStyle({'opacity':newNum});
		} else {
			var myName = '/webcasts/2010/retirement/2/panelists/' + nameMe(person);
			pageTrack(myName);
			clearInterval(theInterval);
		}
	}, 100);
	
	
	$(contenter).show();
	$(modaler).addClassName('modal-selected');
	window.scrollTo(0,0);
	Event.observe('new-modal', 'click', function(e){
		Event.stop(e);
		//if(hasClassName(Event.element(e), 'modal-selected') || hasClassName(Event.element(e).parentNode, 'modal-selected')) return;
		if(Event.element(e).parentNode.parentNode.id == 'modal-panelists' || Event.element(e).parentNode.parentNode.parentNode.id == 'modal-panelists'){
        	var me = ((Event.element(e).id.split('-')[0] == 'modal') ? Event.element(e) : Event.element(e).parentNode);
			var oldSelected = $('modal-panelists').getElementsByClassName('modal-selected')[0].id;
			$(oldSelected).removeClassName('modal-selected');
        	var oldContent = $('new-modal-content-right').getElementsByClassName('bio-content');
        	for(var i = 0; i < oldContent.length; i++){
        		var oldName = oldContent[i].id;
        		$(oldName).hide();
        	}
        	var newName = 'content-' + me.id.split('-')[1];
        	$(newName).show();
        	$(newName).setStyle({'opacity':0});
        	var theNum = 0;
        	var newInterval = setInterval(function(){
        		theNum++;
        		var theNewNum = theNum / 5;
        		if ($(newName).getStyle('opacity') < 1){
        			$(newName).setStyle({'opacity':theNewNum});
        		} else {
        			var myName = '/webcasts/2010/retirement/2/panelists/' + nameMe(me.id.split('-')[1]);
        			pageTrack(myName);
        			clearInterval(newInterval);
        		}
        	}, 100);
        	var newModal = 'modal-' + me.id.split('-')[1];
        	$(newModal).addClassName('modal-selected');
		}
		if(Event.element(e).id == 'modal-close'){
			if($('webcastIframe') !== null){
				$('webcastIframe').setStyle({'left': '16px'});
			}
			$('modal_overlay').hide();
			$('new-modal').remove();
		}
	});
}


function nameMe(item){
	switch (item) {
		case 'charles':
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir657;ord=1;num=" + a + "?");
			return 'charles-gibson';
			break;
			
		case 'sallie':
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir144;ord=1;num=" + a + "?");
			return 'sallie-krawcheck';
			break;
			
		case 'marc':
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=junes761;ord=1;num=" + a + "?");
			return 'marc-freedman';
			break;
			
		case 'daniel':
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=junes554;ord=1;num=" + a + "?");
			return 'daniel-gilbert';
			break;
			
		case 'anna':
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=junes002;ord=1;num=" + a + "?");
			return 'anna-quindlen';
			break;
			
		
			
		
		
	}
}



Position.GetWindowSize = function(w) {
	var width, height;
	w = w ? w : window;
	width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
	height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);

	return { width: width, height: height };
}





function getAddThis(place){
	var newURL = 'http://api.addthis.com/oexchange/0.8/forward/' + place + '/offer?url=http://www.totalmerrill.com/TotalMerrill/Pages/Webcast_Retire_0410_TM.aspx&title=Merrill%20Lynch%20Retirement%20Webcast&sms_ss=1&username=merrilllynch';	
	var newWindow = window.open(newURL, '_blank');
	return false;
}






var isChecked = true, responseData, emailVars2 = {};



function emailReminder(){
	$('modal_overlay').setStyle({'backgroundColor':'#11395d', 'width':'100%','height':'1800px'});
	$('modal_overlay').show();
	$('modal_overlay').setOpacity(0.9);
	var emailOverlay = '<div id="new-overlay"><a href="" id="modal-close">CLOSE</a>';
	emailOverlay += '<div id="new-overlay-content" class="email">';
	emailOverlay += '<img id="overlay-icon" src="/publish/mkt/campaigns/Webcast_Retire_0610/images/spacer.gif" />'; 
	emailOverlay += '<h3>Enter your e-mail address below to receive your reminder.</h3>';
	emailOverlay += '<p id="emailInvalid" style="display:none">Please enter a valid email</p>';
	emailOverlay += '<input type="text" id="emailInputBox" />';
	emailOverlay += '<input type="checkbox" id="moreCheck" checked="true" />';
	emailOverlay += '<input type="submit" name="emailSubmit" id="emailSubmit" />';
	emailOverlay += '<p class="checkboxStuff">Receive alerts for future Webcasts</p>';
	emailOverlay += '<a class="privacyStuff" id="goNow" href="http://www.ml.com/index.asp?id=7695_69068" target="_blank">Privacy Policy</a>';
	emailOverlay += '<p id="youWin" style="display:none">Thank you for signing up for the reminder.<br /><span id="theEm">You will receive an email 30 minutes prior to the start time.<br />Enjoy the Webcast.</span></p>';
	emailOverlay += '</div>';
	new Insertion.After('modal_overlay', emailOverlay);
	var theHPos = (Position.GetWindowSize().width / 2) - 282 + 'px';
	var theVPos = ( ((Position.GetWindowSize().height / 2) - 110) > 39 ? ((Position.GetWindowSize().height / 2) - 110) + 'px' : '75px');
	$('new-overlay').setStyle({ 'left':theHPos, 'top':theVPos, 'opacity':0 });

	var num = 0;

	var theInterval = setInterval(function(){
		num++;
		var newNum = num / 10;
		if ($('new-overlay').getStyle('opacity') < .91){
			$('new-overlay').setStyle({'opacity':newNum});
		} else {
			$('new-overlay').setStyle({'opacity':1});
			var myName = '/webcasts/2010/retirement/2/reminders/email';
			pageTrack(myName);
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir305;ord=1;num=" + a + "?");
			clearInterval(theInterval);
		}
	}, 100);

	Event.observe('new-overlay', 'click', function(e){
		if(Event.element(e).id !== 'goNow' && Event.element(e).id !== 'moreCheck' )  {
			Event.stop(e);
		}
		if(Event.element(e).id == 'emailSubmit'){
			emailRemind();
		}
		if(Event.element(e).id == 'modal-close'){
			$('modal_overlay').hide();
			$('new-overlay').remove();
		}
		
		if(Event.element(e).id == 'moreCheck'){
			if(isChecked){
				isChecked = false;				
				$('moreCheck').checked = false; //('checked', false);
				// add to list here
			}else{
				isChecked = true;
				$('moreCheck').checked = true;
				// add to list here
			}
		}
		
	});

}


function email_testsOut(address){
	if(address.length > 7 && address.indexOf('@') > -1 && address.indexOf('.') > -1 && address.lastIndexOf('.') > address.indexOf('@')){
		return true;
	} else {
		return false;
	}
}


function emailRemind(){
	var address = document.getElementById('emailInputBox').value;
	var emailList = "";
	
	if(isChecked) {
		emailList = "SiteCaptureList";
	} else {
		emailList = "SiteList";
	}
	
	if (email_testsOut(address)){
		var newEmailOverlay = '<form action="http://emailer.emailroi.com/dbadmin/xml_post.pl" method="post" id="myForm" type="hidden">';
		newEmailOverlay += '<input name="user_token" type="hidden" value="yqs5Kgw4xfTC" />';
		newEmailOverlay += '<input name="api_password" type="hidden" value="eyeMerrill10" />';
		newEmailOverlay += '<input name="xml_body" type="hidden" value="<ListSettings list=\'FirstMailingList\'></ListSettings><Record><Email>' + address + '</Email><AddLists>' + emailList +'</AddLists></Record>" /></form>';
		new Insertion.After('modal_overlay', newEmailOverlay);
		var myResponders = Ajax.Responders.register({
			onException: function() {
				trace('exception');
			}
		});

		
		var newreq = $('myForm').request({
			method		: 'get',
			crossSite	: true,
			contentType	: 'application/xml',
			onSuccess	: function(responseXML){
				return false;
			},
			onComplete	: function(responseXML){
				happyDays();				
			}
		});
		pageTrack('/webcasts/2010/retirement/2/reminders/email/thankyou');
		//return false;
	} else {
		$('emailInvalid').show();
		return false;
	}
}


function happyDays(){
	$('youWin').show();
	setTimeout(function(){
		$('modal_overlay').hide();
		if($('new-overlay') !== null) $('new-overlay').remove();
	}, 4000);
}


/*
function handleSaved(address) {
	
	var emailVars2 = {};
	emailVars2.featureId = 56100089;
	emailVars2.fieldnames = 'email';
	emailVars2.email = address;
	emailVars2.execution = 82884; //This will get changed out to match one of the execution or adIDs from your ads. For now, I would just use the adID from one of your 300x600s
	//console.log(emailVars2);
	new Ajax.Request('http://projects.eyewonder.com/dataServices/dataCapture.aspx', {
		method 		: 'GET',
		crossSite 	: true,
		parameters	: emailVars2
	});
}
*/



function textReminder(){
	$('modal_overlay').setStyle({'backgroundColor':'#11395d', 'width':'100%','height':'1800px'});
	$('modal_overlay').show();
	$('modal_overlay').setOpacity(0.9);
	var emailOverlay = '<div id="new-overlay"><a href="" id="modal-close">CLOSE</a>';
	emailOverlay += '<div id="new-overlay-content" class="text">';
	emailOverlay += '<img id="overlay-icon" src="/publish/mkt/campaigns/Webcast_Retire_0610/images/spacer.gif" />';
	emailOverlay += '<h3>Enter your phone number below to receive your reminder.</h3>';
	emailOverlay += '<p id="emailInvalid" style="display:none">Please enter a valid email</p>';
	emailOverlay += '<input type="text" id="textInput1" /><input type="text" id="textInput2" /><input type="text" id="textInput3" />';
	emailOverlay += '<input type="submit" name="textSubmit" id="textSubmit" />';
	emailOverlay += '<p id="wrongNumber" style="display:none;">Please input a valid number</p>';
	emailOverlay += '<p id="youWin" style="display:none">Thank you for signing up for the reminder.<br /><span id="theEm">You will receive a text message 30 minutes prior to the start time.<br />Enjoy the Webcast.</span></p>';
	emailOverlay += '</div>';
	new Insertion.After('modal_overlay', emailOverlay);
	var theHPos = (Position.GetWindowSize().width / 2) - 282 + 'px';
	var theVPos = ( ((Position.GetWindowSize().height / 2) - 110) > 39 ? ((Position.GetWindowSize().height / 2) - 110) + 'px' : '75px');
	$('new-overlay').setStyle({ 'left':theHPos, 'top':theVPos, 'opacity':0 });
	
	var num = 0;
	
	var theInterval = setInterval(function(){
		num++;
		var newNum = num / 10;
		if ($('new-overlay').getStyle('opacity') < .91){
			$('new-overlay').setStyle({'opacity':newNum});
		} else {
			$('new-overlay').setStyle({'opacity':1});
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir150;ord=1;num=" + a + "?");
			var myName = '/webcasts/2010/retirement/2/reminders/sms';
			pageTrack(myName);
			clearInterval(theInterval);
		}
	}, 100);
	
	Event.observe('new-overlay', 'click', function(e){
		Event.stop(e);
		if(Event.element(e).id == 'textSubmit'){
			textRemind();
		}
		if(Event.element(e).id == 'modal-close'){
			$('modal_overlay').hide();
			$('new-overlay').remove();
		}
	});
	
	Event.observe('textInput1', 'keyup', function(e){
		if (Event.element(e).value.length > 3){
			Event.element(e).value = Event.element(e).value.slice(0,3);
		} else if (/^[a-zA-Z]+$/.test(Event.element(e).value.slice(-1))){
			Event.element(e).value = Event.element(e).value.slice(0, -1);
		}
	});
	Event.observe('textInput2', 'keyup', function(e){
		if (Event.element(e).value.length > 3){
			Event.element(e).value = Event.element(e).value.slice(0,3);
		} else if (/^[a-zA-Z]+$/.test(Event.element(e).value.slice(-1))){
			Event.element(e).value = Event.element(e).value.slice(0, -1);
		}
	});
	Event.observe('textInput3', 'keyup', function(e){
		if (Event.element(e).value.length > 4){
			Event.element(e).value = Event.element(e).value.slice(0,4);
		} else if (/^[a-zA-Z]+$/.test(Event.element(e).value.slice(-1))){
			Event.element(e).value = Event.element(e).value.slice(0, -1);
		}
	});

}



function textRemind(address) {
	if ($('textInput1').value == "800" || $('textInput1').value == "900" || $('textInput1').value == "866" || $('textInput1').value == "555" || $('textInput1').value == "888" || $('textInput1').value.length !== 3 || $('textInput2').value.length !== 3 || $('textInput3').value.length !== 4) {
		$('wrongNumber').show()
		setTimeout(function(){
			$('wrongNumber').hide();
		}, 2500);
		return false;
	}
	numString = $('textInput1').value.toString() + $('textInput2').value.toString() + $('textInput3').value.toString();
	var url = 'http://msg.us.phonevalley.com/conxengine/ce/svc/bac/livewebcast/optin?conx.action.msg.new.from=MT_226526_http://www.totalmerrill.com/TotalMerrill/pages/webcast_retire_0410_TM.aspx&conx.action.msg.new.info=sms.recipients=1' + numString
	//emailVars2.execution = 82884; //This will get changed out to match one of the execution or adIDs from your ads. For now, I would just use the adID from one of your 300x600s
	
	new Ajax.Request(url, {
		method 		: 'GET',
		crossSite 	: true,
		onComplete	: function(o){
			pageTrack('/webcasts/2010/retirement/2/reminders/sms/thankyou');
			happyDays();
		}
	});
}



function calReminder(){
	$('modal_overlay').setStyle({'backgroundColor':'#11395d', 'width':'100%','height':'1800px'});
	$('modal_overlay').show();
	$('modal_overlay').setOpacity(0.9);
	var emailOverlay = '<div id="new-overlay"><a href="" id="modal-close">CLOSE</a>';
	emailOverlay += '<div id="new-overlay-content" class="cal">';
	emailOverlay += '<img id="overlay-icon" src="/publish/mkt/campaigns/Webcast_Retire_0610/images/spacer.gif" />';
	emailOverlay += '<p id="youWin" style="display:none">Thank you for downloading the the reminder.<br /><span id="theEm">Enjoy the Webcast.</span></p>';
	emailOverlay += '<h3><a href="/publish/mkt/campaigns/Webcast_Retire_0610/assets/mlwm-live-webcast.ics" target="_blank" onclick="pageTrack(\'/webcasts/2010/retirement/2/reminders/calendar/downloaded\'); happyDays();">Click to download your calendar reminder.</a></h3>';	

	emailOverlay += '</div>';
	new Insertion.After('modal_overlay', emailOverlay);
	var theHPos = (Position.GetWindowSize().width / 2) - 282 + 'px';
	var theVPos = ( ((Position.GetWindowSize().height / 2) - 110) > 39 ? ((Position.GetWindowSize().height / 2) - 110) + 'px' : '75px');
	$('new-overlay').setStyle({ 'left':theHPos, 'top':theVPos, 'opacity':0 });
	
	var num = 0;
	
	var theInterval = setInterval(function(){
		num++;
		var newNum = num / 10;
		if ($('new-overlay').getStyle('opacity') < .91){
			$('new-overlay').setStyle({'opacity':newNum});
		} else {
			$('new-overlay').setStyle({'opacity':1});
			var myName = '/webcasts/2010/retirement/2/reminders/calendar';
			pageTrack(myName);
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir155;ord=1;num=" + a + "?");
			clearInterval(theInterval);
		}
	}, 100);
	
	Event.observe('new-overlay', 'click', function(e){
		//Event.stop(e);
		if(Event.element(e).id == 'modal-close'){
			Event.stop(e);
			$('modal_overlay').hide();
			$('new-overlay').remove();
		}
	});
}


/*
function signUp(){
	$('modal_overlay').setStyle({'backgroundColor':'#11395d', 'width':'100%','height':'1800px'});
	$('modal_overlay').show();
	$('modal_overlay').setOpacity(0.9);
	var emailOverlay = '<div id="new-overlay"><a href="" id="modal-close">CLOSE</a>';
	emailOverlay += '<div id="new-overlay-content-live" class="email">';
	emailOverlay += '<iframe src="http://www.totalmerrill.com/TotalMerrill/Pages/Outlook_2010_Ch2.aspx" scrolling="no" width="100%" height="100%" style="border:none;"></iframe>';
	emailOverlay += '</div></div>';
	new Insertion.After('modal_overlay', emailOverlay);
	var theHPos = (Position.GetWindowSize().width / 2) - 282 + 'px';
	var theVPos = ( ((Position.GetWindowSize().height / 2) - 110) > 39 ? ((Position.GetWindowSize().height / 2) - 110) + 'px' : '75px');
	$('new-overlay').setStyle({ 'left':theHPos, 'top':theVPos, 'opacity':0 });

	if($('webcastIframe') !== null){
		$('webcastIframe').setStyle({'left': '-1000px'});
	}
	
	var num = 0;

	var theInterval = setInterval(function(){
		num++;
		var newNum = num / 10;
		if ($('new-overlay').getStyle('opacity') < .91){
			$('new-overlay').setStyle({'opacity':newNum});
		} else {
			$('new-overlay').setStyle({'opacity':1});
			var myName = '/webcasts/2010/retirement/2/live/email';
			pageTrack(myName);
			var axel = Math.random()+"";
			var a = axel * 10000000000000;
			fncWriteFloodlightTag("footer", "http://fls.doubleclick.net/activityi;src=1359940;type=sdlpb511;cat=retir305;ord=1;num=" + a + "?");
			clearInterval(theInterval);
		}
	}, 100);

	Event.observe('new-overlay', 'click', function(e){
		if(Event.element(e).id !== 'goNow')  Event.stop(e);
		if(Event.element(e).id == 'emailSubmit-live'){
			var address = document.getElementById('emailInputBox-live').value;
			if(email_testsOut(address)){
				handleSaved(address);
			} else {
				$('emailInvalid-live').show();
				return false;
			}
		}
		if(Event.element(e).id == 'modal-close'){
			if($('webcastIframe') !== null){
				$('webcastIframe').setStyle({'left': '16px'});
			}
			$('modal_overlay').hide();
			$('new-overlay').remove();
		}
		
	});

}
*/









function gotoPriv(){
	var newURL = 'http://www.ml.com/index.asp?id=7695_69068';	
	var newWindow = window.open(newURL, '_blank');
}














function pageTrack(item) {
	//trace('tracking');
	var pt = _gat._getTracker('UA-3395701-2');
	pt._initData();
	try{
		pt._trackPageview(item);
	} catch (e) { 
		//trace("FAIL"); 
	}

}

function eventTrack(one, two, three, four) {
	pageTracker._trackEvent(one, two, three);
	var axel = Math.random()+"",
	a = axel * 10000000000000,
	action, title;
	//trace(four);
	fncWriteFloodlightTag("footer", four + a + "?");
	if(two.indexOf('Play') > -1) { 
		action = 1;
		switch(three){
			case 'creating-your-own-second-act:-strategies,-ideas-&-opportunities':
			title = 'RetirementWebcastP2Chpt1';
			break;
			case 're-imagining-traditional-<br>notions-of-retirement':
			title = 'RetirementWebcastP2Chpt2';
			break;
			case 'the-freedom-to-work:-finding-fulfillment-in-encore-careers':
			title = 'RetirementWebcastP2Chpt3';
			break;
			case 'discovering-new-meaning,-<br>finding-ways-to-give-back':
			title = 'RetirementWebcastP2Chpt4';
			break;
			}
		coremetricsEventTrack(title, action)
		} 
	}
	
	
function coremetricsEventTrack(title, action) {
	cmCreateConversionEventTag(title,action,'GWM:Mkt:MLAdvise:webcast_0610_TM',0,null,null,null,null);
}



function fncWriteFloodlightTag(container, url) {
	//is url valid
	if (url != "" && url != null) {
		//does browser support DOM scripting?
		if (document.getElementById) {
			//find the container
			var _con = document.getElementById(container);
			if (_con != null) {
				//create a new <image> element
				var _iframe = document.createElement('iframe');
				
				_iframe.setAttribute('alt', 'DoubleClick Spotlight tracking image');
				_iframe.setAttribute('src', url);
				_iframe.setAttribute('width', "1");
				_iframe.setAttribute('height', "1");
				
				//attach <img> to container
				_con.appendChild(_iframe);
			}			
		}
		//does browser support document.images?
		else if (document.images) {
			var _iframe = new Image();
			_iframe.src = url;
		}
		//does browser support document.write?
		else if (document.write) {
			document.write("<iframe src=\"" + url + "\" alt=\"\" width=\"1\" height=\"1\" frameborder=\"0\" />");
		}
	}
}



function trace(item) {
	if(console != 'undefined') console.log(item);
}



