PageSourceSearch

https://www.fidelity.com/intlacct/js/inter-accounts.js

js fidelity.com collected 2026-10-01 09:01:35 UTC 55,415 bytes, 2,232 lines download raw bytes

1fontControl = {
2adjustFont : function(link,id,size)
3{
4	var elmID = null;
5	var newSize = null;
6	var currentLink = null;
7	var container = null;
8	
9	try
10	{
11		elmID = id;
12		newSize = size;
13		currentLink = link;
14
15		if(typeof elmID == null || elmID == "undefined" ||
16	      	typeof newSize == null || newSize == "undefined" ||
17		     	typeof currentLink == null || currentLink == "undefined")
18		{
19			return false;
20		}
21		else
22		{
23			container =	document.getElementById(elmID);
24		
25			if(typeof container == null || container == "undefined")
26			{
27				return false;
28			}
29			else
30			{
31				container.style.fontSize = newSize + "px";
32			}
33			fontControl.changeAnchorText(currentLink);
34		}
35	}
36	catch(e)
37	{
38		// do something here
39	}
40},
41		
42changeAnchorText : function(currentLink)
43{
44	var linkArr = new Array();
45	linkArr[0] = document.getElementById("text1");
46	linkArr[1] = document.getElementById("text2");
47	linkArr[2] = document.getElementById("text3");
48			
49	for(i = 0; i < linkArr.length ; i++)
50	{
51		if(typeof linkArr[i] == "undefined" || linkArr[i] == null)
52		{
53			return false; 
54		}		
55		else
56		{
57			if(linkArr[i].id == currentLink)
58			{
59				linkArr[i].className = currentLink + " active";
60			}
61			else
62			{
63				linkArr[i].className = linkArr[i].id;
64			}
65		}
66	}		
67}
68}
69//Scripts
70
71//Utility Functions
72
73function addEvent(obj, type, fn) {
74	
75	try {
76
77    if (obj.addEventListener) {
78
79        obj.addEventListener(type, fn, false);
80
81
82
83    } else if (obj.attachEvent) {
84
85        obj["e" + type + fn] = fn;
86
87        obj[type + fn] = function () {
88
89            obj["e" + type + fn](window.event);
90
91        }
92
93        obj.attachEvent("on" + type, obj[type + fn]);
94
95    } else {
96
97        obj["on" + type] = obj["e" + type + fn];
98
99    }
100	
101	}
102	
103	catch(e) {
104		return;
105	}
106
107}
108
109
110//Attach init functions to window on load event
111
112addEvent(window, 'load', function () {
113
114    init();
115
116});
117
118function init() {
119	try	{
120	isPrintPreviewPage();
121	sideBarHeight();
122	displayNextPreviousArticleLessons();
123	displaySelectedClass();
124	displayMessageHighLvlComp();
125  //  displayLinkName();
126    attachMouseEvents();
127    attachValidationEvents();
128	initFeatureWideOverThree();
129	}
130	
131	catch(e)	{
132		return;
133	}
134	
135}
136
137/* Start of Print Preview code */
138function isPrintPreviewPage()
139{
140var urlInfo = window.location.href.indexOf("print=true");
141
142if(urlInfo != -1)
143  {	
144
145    var element = document.createElement("link");
146    element.href="/bin-public/060_www_fidelity_com/css/print.css";
147    element.type="text/css";
148    element.rel="stylesheet";
149    element.media="screen, print";
150    var headelement = document.getElementsByTagName('head')[0];
151    headelement.appendChild(element);	
152
153    var printElement = "<div id='print-preview-region-1'><div class='header-region'><div class='align-logo'> " +
154    "<img src='/bin-public/060_www_fidelity_com/images/css/fidelityDotBlack.gif' alt='Fidelity Logo' title='Fidelity Logo'/></div>" +
155    "<input id='btnPrint' type='button' value='Print' onclick='printPage();'/></div><div class='Double-Horizontal-Rule'>"+
156    "<hr class='hr-for-ie'/></div></div>";
157
158    document.getElementById('layout-region-page-controls').innerHTML = printElement;
159
160    var rightSideRail = document.getElementById('layout-region-right-rail').innerHTML;
161
162    document.getElementById('layout-region-right-rail').innerHTML = document.getElementById('layout-region-page-disclosure').innerHTML;
163    document.getElementById('layout-region-page-disclosure').innerHTML = rightSideRail;
164    replaceVideo();
165    disableLinks();
166  }
167}
168
169function loadPrintPreview()
170{
171    var urlInfo = window.location.href.split("?");
172    if(urlInfo.length == 1)
173    {
174      var url = window.location.href.split("#")[0] + "?print=true";
175    }
176    else
177    {	
178	var url = window.location.href.split("#")[0] + "&print=true";
179    }
180
181    var printWindow = window.open(url, 'printWindow', 'menubar=0,location=0,resizable=0,scrollbars=1,status=0,width=696,height=500');
182
183    if (window.focus) {
184	printWindow.focus();		
185    }
186}
187function printPage() {   
188	window.print();
189}
190
191function disableLinks()
192{
193//retrieve links on the page
194	objLinks = document.links;
195	var i = objLinks.length;	
196	while (i)
197	{
198	modifyLinkCSS(objLinks[i - 1]);
199	i--;
200	}
201}
202
203function modifyLinkCSS(argLink)
204{
205	argLink.style.color = "#000000";
206	argLink.style.cursor = "default";
207	argLink.style.textDecoration = "underline";
208}
209/* End of Print Preview code */
210// Maintain height consistency between article and sidebar
211function sideBarHeight()	{
212	// If page type equals article page then ensure the sidebar and article are the same height
213    try{
214		if (pageGlobals.pageTemplateType == "article")	{
215		
216			// Get height of article layout region
217			var articleHeight = document.getElementById('layout-region-3').offsetHeight - 1;
218			// Set height of sidebar layout region equal to article layout region
219			document.getElementById('layout-region-4').style.height = articleHeight + 'px';
220			
221		}
222		
223		else	{
224		
225			return;
226			
227		}
228   }	catch(e)	{ return ;}
229}
230function attachValidationEvents()
231{
232try{
233
234//var btnGo =document.getElementById("go");
235var form = document.getElementById('zipCodeForm');;
236 
237addEvent(form, 'submit', function () {
238			
239			zipCodeValidation();
240			
241			});
242 }
243 catch(e){return;}
244
245}
246function zipCodeValidation()
247{
248   
249		   var txtZipCode = document.getElementById("zipCode").value;
250		   if((IsNumeric(txtZipCode)== false) || (txtZipCode.length<5))
251		   {
252		    
253			 document.getElementById("errorMessage").style.display='block';
254             stopEvent();
255			 
256		   }
257		   else
258		   {
259		 
260			document.getElementById("errorMessage").style.display='none';
261			
262		   }
263   
264}
265function IsNumeric(input){
266  var reg = new RegExp("^[0-9]{1,5}$");
267    return (reg.test(input));
268}
269
270function stopEvent() {
271
272	   var e = getEvent();
273	
274	//e.cancelBubble is supported by IE - this will kill the bubbling process.
275	e.cancelBubble = true;
276	e.returnValue = false;
277
278	//e.stopPropagation works only in Firefox.
279	if (e.stopPropagation) {
280		e.stopPropagation();
281		e.preventDefault();
282	}
283	return false;
284}
285
286function getEvent() {
287
288 //if(typeof window.event  == "undefined") 
289 // return advancedlink.caller.arguments[0];
290 if (window.event) return window.event;
291 else return zipCodeValidation.caller.arguments[0];
292}
293
294function attachMouseEvents(){
295
296  try
297  {
298		var courseLink = getElementsByClassName('courseLessonLink','A');
299		var courseLinkPopups = getElementsByClassName('course-details-popup','div');
300		//alert(courseLinkPopups.length);
301		//var divId = document.getElementById('courselessons');
302		for (var i = 0; i < courseLink.length; i++) {
303			{
304				courseLink[i].popupId = courseLinkPopups[i];
305			
306				addEvent(courseLink[i], 'mouseover', function(){
307						ShowCourseDetails(this);
308					});
309						
310				addEvent(courseLink[i], 'focus', function(){
311				
312					ShowCourseDetails(this);
313						});
314						
315				addEvent(courseLink[i], 'mouseout', function(){
316				
317					HideCourseDetails(this);
318					
319
320						});
321						
322				addEvent(courseLink[i], 'blur', function(){
323				
324					
325					
326						HideCourseDetails(this);
327						});
328			}
329			
330		}
331	}
332	catch(e){return;}
333}
334
335
336
337//UTILITY FUNCTIONS
338	function getAbsoluteLeft(o) {    
339		oLeft = o.offsetLeft	
340		while(o.offsetParent!=null) {	
341			oParent = o.offsetParent	
342			oLeft += oParent.offsetLeft	
343			o = oParent	
344		}	
345		return oLeft	
346	}
347	
348	function getAbsoluteTop(o) {	
349		oTop = o.offsetTop	
350		while(o.offsetParent!=null) {	
351			oParent = o.offsetParent	
352			oTop += oParent.offsetTop	
353			o = oParent	
354		}	
355		return oTop	
356	}
357
358
359	
360	
361	
362	
363//For showing the pop-up on mouse Hover
364function ShowCourseDetails(linkID) {
365	
366	var divblk = linkID.popupId;
367	var xDiff =0;
368	var yDiff = 25;
369	var posX = linkID.offsetLeft;
370	//alert(linkID.offsetLeft);
371	var posY = linkID.offsetTop;
372		if(divblk.className =='course-details-popup')
373		xDiff = 30;
374		else
375		xDiff = 220;
376	divblk.style.display="block";
377	divblk.style.left = (getAbsoluteLeft(linkID)- xDiff)+"px";	
378	divblk.style.top = (getAbsoluteTop(linkID) + yDiff) +"px";	
379		var targTop = parseInt(divblk.style.top);
380		var targLeft = parseInt(divblk.style.left);
381		if((targLeft + divblk.offsetWidth) > screen.right){				
382		divblk.style.left = (getAbsoluteLeft(linkID)-(targLeft + divblk.offsetWidth-screen.right)) + "px";
383		}
384		if((targTop) < screen.top){				
385		 
386		divblk.style.top = (getAbsoluteTop(linkID)+ linkID.offsetHeight) + "px";
387		}
388	
389	
390}
391
392//For hiding the pop-up on mouse out
393function HideCourseDetails(linkID){
394
395	var divblk = linkID.popupId;
396	
397	if (divblk.style.display == "block") {
398		divblk.style.display = "none";
399	}
400}
401
402
403//UTILITY FUNCTIONS
404	function getAbsoluteLeft(o) {    
405		oLeft = o.offsetLeft	
406		while(o.offsetParent!=null) {	
407			oParent = o.offsetParent	
408			oLeft += oParent.offsetLeft	
409			o = oParent	
410		}	
411		return oLeft	
412	}
413	
414	function getAbsoluteTop(o) {	
415		oTop = o.offsetTop	
416		while(o.offsetParent!=null) {	
417			oParent = o.offsetParent	
418			oTop += oParent.offsetTop	
419			o = oParent	
420		}	
421		return oTop	
422	}
423	
424		function getScrollXY() {
425	  var scrOfX = 0, scrOfY = 0;
426	  if(typeof(window.pageYOffset) == 'number') {
427	    //Netscape compliant
428	    scrOfY = window.pageYOffset;
429	    scrOfX = window.pageXOffset;
430	  } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
431	    //DOM compliant
432	    scrOfY = document.body.scrollTop;
433	    scrOfX = document.body.scrollLeft;
434	  } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop) ) {
435	    //IE6 standards compliant mode
436	    scrOfY = document.documentElement.scrollTop;
437	    scrOfX = document.documentElement.scrollLeft;
438	  }
439	  return [ scrOfX, scrOfY ];
440	}
441	
442	function getWindowSize(){	
443	  var winWidth = 0, winHeight = 0;
444	  if( typeof( window.innerWidth ) == 'number' ) {
445	    //Non-IE
446	    winWidth = window.innerWidth;
447	    winHeight = window.innerHeight;
448	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
449	    //IE 6+ in 'standards compliant mode'
450	    winWidth = document.documentElement.clientWidth;
451	    winHeight = document.documentElement.clientHeight;
452	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
453	    //IE 4 compatible
454	    winWidth = document.body.clientWidth;
455	    winHeight = document.body.clientHeight;
456	  }
457	 return [winWidth,winHeight];
458	}
459
460	function ScreenObject(){		
461		var _docHeight = (document.height || document.body.offsetHeight);
462		var _docWidth = (document.width || document.body.offsetWidth);
463		
464		this.left = getScrollXY()[0];
465		this.right = _docWidth > getWindowSize()[0] ? getWindowSize()[0] + getScrollXY()[0]:_docWidth;
466		this.top =  getScrollXY()[1];
467		this.bottom =   _docHeight > getWindowSize()[1]?getWindowSize()[1] + getScrollXY()[1]:_docHeight;		
468		return this;
469	}
470
471
472/*function displayLinkName(){
473		var courseLink = document.getElementsByTagName('A');
474		
475		for (var i = 0; i < courseLink.length; i++) {
476			if (courseLink[i].id == 'courseLessonLink') 
477				courseLink[i].innerHTML = '6 lessons';
478			}
479	}*/
480
481	
482	var getElementsByClassName = function (classname,tag) {	
483	 	if(!tag) tag = "*";
484	 	var elements =  document.getElementsByTagName(tag);
485	 	var total_elements = elements.length;
486	 	var regexp = new RegExp('\\b' + classname + '\\b');
487	 	var class_elements = new Array();
488	  	//Go thru all the links seaching for the class name
489	 	for(var i = 0; i < total_elements; i++) { 
490	 		var this_element = elements[i];
491	 		if(regexp.test(this_element.className)) {
492	 			class_elements.push(this_element);
493	  	}
494	 }
495	 
496	 return class_elements;
497		 
498	}
499	
500	
501	function displaySelectedClass()
502	{
503	   try
504	   {
505			var mainDiv = getElementsByClassName('collection-navigation-right','div')[0];
506			var contentComponent = document.getElementById('fmr-content-component');
507			if (mainDiv)
508			{
509				var divLi   = mainDiv.getElementsByTagName('li');
510		
511				
512				for(var i = 0; i < divLi.length; i++)
513				{
514					if (divLi[i].getAttribute('data-fmrTcmId') == contentComponent.getAttribute('data-fmrTcmId'))
515					{
516						divLi[i].className += " selected";
517					}
518					else
519					{
520						if (divLi[i].className.indexOf('selected') != -1) 
521							divLi[i].className.replace('selected', '');
522					}
523				}
524			}
525	   }
526	   catch(e){return;}
527		
528	}
529
530
531	
532
533
534
535
536/* Page Control JS */
537
538var articleControl = {};
539 
540var Destination = {};
541var timeoutId;
542
543Destination.displayPopIn = function(e, id){
544	clearTimeout(timeoutId);
545	timeoutId = setTimeout(function()
546	{
547		Destination.displayPopIn(e, id);
548	}, 1000);
549}
550
551/**
552 * Returns the left offset got a givem element
553 * @param {Object} This
554 */
555Destination.getOffsetLeft = function(This) {
556	var el = This;
557	var pL = 0;
558	while (el) {
559		pL += el.offsetLeft;
560		el = el.offsetParent;
561	}
562	return pL;
563};
564    
565/**
566 * Returns the top offset got a givem element
567 * @param {Object} This
568 */
569Destination.getOffsetTop = function(This) {
570	var el = This;
571	var pT = 0;
572	while (el) {
573		pT += el.offsetTop;
574		el = el.offsetParent;
575	}
576	return pT;
577}
578
579Destination.getTarget = function(e) {
580	var targ;
581	if (!e) var e = window.event;
582	if (e.target) targ = e.target;
583	else if (e.srcElement) targ = e.srcElement;
584	if (targ.nodeType == 3) { 
585		targ = targ.parentNode;
586	}
587	return targ;
588}
589
590Destination.getCurrentStyle = function(el,styleProp) {
591	if (el.currentStyle)
592		var y = el.currentStyle[styleProp];
593	else if (window.getComputedStyle)
594		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
595	return y;
596}
597
598/*
599* Initialize the email fields so that they can work without double clicking on submit
600*/
601try {
602	document.getElementById("friendEmail_status").innerHTML = "<div class='email_valid'<ul><li>Your e-mail address appears valid</li></ul></div>";
603	document.getElementById("friendEmail_status").className = "hiddenDiv";	
604	document.getElementById("friendemail-form").className = "friendemail-form-row";
605
606	document.getElementById("userEmail_status").innerHTML = "<div class='email_valid'<ul><li>Your e-mail address appears valid</li></ul></div>";
607	document.getElementById("userEmail_status").className = "hiddenDiv";
608	document.getElementById("useremail-form").className = "useremail-form-row";
609	
610	var recipient = document.getElementById("friendEmail");
611	if (!(typeof recipient == "undefined" || recipient == null))
612	{
613		// This value should coordinate with CS-203 validations for feeds
614		recipient.setAttribute('maxLength', 500);
615	}
616
617	var sender = document.getElementById("userEmail");
618	if (!(typeof sender == "undefined" || sender == null))
619	{
620		// This value should coordinate with CS-203 validations for feeds
621		sender.setAttribute('maxLength', 50);
622	}
623} catch (e) {}
624
625
626
627articleControl.formValidation = function(formId,formType) {
628	var friend_flag = false || formType != "email" ;
629	var user_flag = false || formType != "email";
630	var message_flag = false || formType == "email" ;
631	
632	if(articleControl.validate_email("userEmail",formId)) {
633		user_flag = true;
634	}
635	
636	if(!friend_flag){
637		if(articleControl.validate_email("friendEmail",formId)) {
638			friend_flag = true;
639		}
640	}		
641	if(!message_flag){
642		if(articleControl.validate_email("messageBox",formId)) {
643					message_flag = true;
644		}
645	}	
646	if(!friend_flag || !user_flag || !message_flag) {
647		return false;
648	}	
649	return true;
650}
651/**
652 * Retrieves all of the necessary article data and submits the form to pagecontrol service
653 */
654articleControl.submitemail = function() {
655	var formId = "emailFormArea";
656	var formDivId = "emailform";
657	var confirmFormId = "emailConfirm";
658	var formType = "email";
659
660	if(arguments.length == 3) {
661		formDivId = arguments[0];
662		formId  = arguments[1];
663		confirmFormId = arguments[2];
664	}
665
666	var formElement = document.getElementById(formId );
667
668	if(typeof formElement.formtype == "undefined" || formElement.formtype == null) {
669		formType = "email";
670	}else{
671		formType = formElement.formtype.value;
672	}	
673
674	if(!articleControl.formValidation(formId,formType)){
675		return false;
676	}
677	
678	var articleSummary = "";
679	var articleAuthor = "";
680	var articleDate = articleControl.Date;
681	var articleUrl = window.location.href;
682
683	if((articleUrl.indexOf("ccsource") == -1) && formType == "email")
684	{
685		if(articleUrl.indexOf("?") == -1)
686		{
687			articleUrl += "?ccsource=email";
688		}
689		else{
690			articleUrl += "&ccsource=email";
691		}
692	}
693
694	//FMX doesnt support the port, hence striping of from the url,
695	//This is only for testing purpose
696	//Ideally port wont be there in prod urls
697	articleUrl = articleUrl.replace(/:[0-9]+/ig,"");
698	
699
700	if(typeof formElement == "undefined" || formElement == null) {
701
702		return false;
703	}
704	else {
705		
706
707		var userEmail_value = formElement.userEmail.value;
708		var messageBox_value = formElement.messageBox.value;
709
710		var mail_service = "/pf/service/pagecontrol/email";
711		var params = "article_url=" + encodeURIComponent(articleUrl)  +
712							"&message=" + escape(messageBox_value);
713
714			if(formType == "email"){
715
716				var pageTitle = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "Fidelity Investments" : pgCorePageTitle;
717				var friendEmail_value = formElement.friendEmail.value;
718
719				params += "&sender=" + escape(userEmail_value) +								
720								"&recipient=" + escape(friendEmail_value) +
721								"&article_title=" + escape(pageTitle);
722
723				if(formElement.emailfooter != null && formElement.emailfooter != "undefined")
724				{
725					params += "&emailfooter=" + escape(formElement.emailfooter.value);
726				}
727				
728
729			} else {
730				//get title within this form div
731				var pageTitle = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "Fidelity Investments" : pgCorePageTitle;
732				params +="&emailtoken=" + escape(formElement.emailtoken.value) +
733								"&emailsubjectline=" + escape(formElement.emailsubjectline.value) +
734								"&formtype=" + escape(formElement.formtype.value) +
735								"&article_title=" + escape(pageTitle);			
736			}
737		articleControl.callWebService(mail_service, params,formDivId, confirmFormId);		
738
739	}
740}
741/**
742 * Validates the e-mail which the user has entered
743 * @param field - the input field that is currently being validated
744 */
745articleControl.validate_email = function(field) {
746	if(arguments.length > 1) {
747		formId  = arguments[1];	
748	}
749	else
750	{
751		formId = "emailFormArea";
752	}
753	
754	var formArea = null;
755	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
756
757	try {		
758		formArea = document.getElementById(formId);
759		if(typeof formArea == "undefined" || formArea == null) 
760		{
761			return false;
762		}
763		else 
764		{
765			var outerDiv = "emailPopin";
766			if(!formArea.formtype)
767			{
768				//default is email
769				outerDiv = "emailPopin";
770			}			
771						
772			if(typeof field == "undefined" && field == null )	
773			{
774				return false;
775			}
776			else if(field == "friendEmail" || field == "userEmail")
777			{
778				var successMsg = "";
779				var failureMsg = "<div class='email_invalid'><ul><li>Please enter a valid e-mail address</li></ul></div>";
780	
781				if(field == "friendEmail")
782				{
783					formArea[field].value = formArea[field].value.split(", ").join(",").split("").join("");
784					var emailArr =  formArea[field].value.split(",");
785				
786					var addressesValid = true;
787					
788					for (var i=0, il=emailArr.length; i<il; i++) {
789						if(!filter.test(emailArr[i])) {
790							addressesValid = false;
791							break;
792						}
793					}
794					
795					if (addressesValid) 
796					{
797						articleControl.friendEmail_valid = true;
798						writeToInnerDiv(outerDiv,"friendEmail_status", "","hiddenDiv");
799						document.getElementById('friendemail-form').className='friendemail-form-row';
800							
801					}
802					else {
803						articleControl.friendEmail_valid = false;
804						writeToInnerDiv(outerDiv,"friendEmail_status", failureMsg, "visibleDiv");
805						document.getElementById('friendemail-form').className='friendemail-form-row error';
806													
807					}
808					
809					document.getElementById('blankdiv').style.height = document.getElementById('emailform').offsetHeight + 20 + "px";
810					return articleControl.friendEmail_valid;
811					
812					
813				}
814				else if(field == "userEmail") 
815				{
816					if(filter.test(formArea.userEmail.value)) 
817					{
818						articleControl.userEmail_valid = true;
819						writeToInnerDiv(outerDiv,"userEmail_status", "","hiddenDiv");
820						document.getElementById('useremail-form').className='useremail-form-row';
821
822					}
823					else 
824					{
825						articleControl.userEmail_valid  = false;
826						writeToInnerDiv(outerDiv,"userEmail_status", failureMsg, "visibleDiv");
827						document.getElementById('useremail-form').className= 'useremail-form-row error';																		
828					}
829					document.getElementById('blankdiv').style.height = document.getElementById('emailform').offsetHeight + 20 + "px";	
830					return articleControl.userEmail_valid;
831				}
832				
833
834			}
835			if(formId != "emailFormArea")
836			{
837				if(field == "messageBox") 
838				{
839					if(formArea.formtype.value == "question")
840					{
841						var failureMsg = "<div class='email_invalid'><ul><li>Please enter your question</li></ul></div>";
842					}
843					else if(formArea.formtype.value == "feedback")
844					{	
845						var failureMsg = "<div class='email_invalid'><ul><li>Please enter your feedback</li></ul></div>";
846					}
847					
848					var message = document.getElementById(formId).messageBox.value;
849							
850					if(message !=null && message.trim() != "" ) 
851					{
852						articleControl.messageBox_valid = true;
853						//clear error messgae
854						writeToInnerDiv(outerDiv,"messageBox_status", "", "hiddenDiv");
855							
856					}
857					else
858					{
859						articleControl.messageBox_valid = false;
860						writeToInnerDiv(outerDiv,"messageBox_status", failureMsg, "visibleDiv");
861					}
862					return articleControl.messageBox_valid;
863				}
864			}
865		}
866	}
867	catch(e) {
868		articleControl	.shoutError(e, "validate_email()");
869	}
870}
871
872/**
873 * Clears the e-mail form
874 */
875articleControl.clearEmail = function(divId) {
876
877	//default
878	var outerDiv = "emailPopin";
879	try {
880		articleControl.userEmail_valid = false;
881		articleControl.friendEmail_valid = false;
882		articleControl.messageBox_valid = false;
883		
884		var formDiv = document.getElementById(divId);
885		var thisFormId = formDiv.getAttribute("formid");
886		if(!thisFormId)
887		{
888			thisFormId = "emailFormArea";
889		}
890		
891		var formArea = document.getElementById(thisFormId);
892		
893		if(typeof formArea == "undefined" || formArea == null) 
894		{
895			return false;
896		}
897		else 
898		{	
899			if(formArea.friendEmail)
900			{
901				formArea.friendEmail.value = "";
902				writeToInnerDivById(divId, "friendEmail_status", "", "hiddenDiv","div");
903				document.getElementById("friendemail-form").className = "friendemail-form-row";
904			}
905			if(formArea.userEmail)
906			{
907				formArea.userEmail.value = "";
908				writeToInnerDivById(divId, "userEmail_status", "", "hiddenDiv","div");
909				document.getElementById("useremail-form").className = "useremail-form-row";
910			}
911			if(formArea.messageBox)
912			{
913				formArea.messageBox.value = "";
914				writeToInnerDivById(divId, "messageBox_status", "", "hiddenDiv","div");
915			}
916		}
917			
918		
919	}
920	catch(e) {
921		articleControl.shoutError(e, "clearEmail()");
922	}
923}
924
925/*
926 * Cross browser function for retrieving global/external CSS properties   
927 */
928
929function isFixedSupported()
930{
931    var testDiv = document.createElement("div");
932    testDiv.id = "testingPositionFixed";
933    testDiv.style.position = "fixed";
934    testDiv.style.top = "0px";
935    testDiv.style.right = "0px";
936    document.body.appendChild(testDiv);
937	
938    var offset = 1;
939	
940    if (typeof testDiv.offsetTop == "number" &&
941    testDiv.offsetTop != null &&
942    testDiv.offsetTop != "undefined") 
943    {
944        offset = parseInt(testDiv.offsetTop);
945    }
946    if (offset == 0)
947    {
948        return true;
949    }
950    
951    return false;
952};
953
954
955function getStyle(element, cssprop)
956{
957
958
959
960    if (element.currentStyle) //IE
961	{
962
963		return element.currentStyle[cssprop];
964	}
965	else 
966	{
967
968		if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
969		{
970
971			return document.defaultView.getComputedStyle(element, "")[cssprop];
972		}
973		else //try and get inline style
974 		{
975
976			return element.style[cssprop];
977		}
978	}
979}
980
981/*
982 * Wrapper function for getStyle to return int value for position specific styles
983 */
984function getPosition(element, position)
985{
986
987	var pixelValue = getStyle(element, position);
988	
989	if (pixelValue != "") 
990	{
991		var intValue = pixelValue.replace(/px/i, "");
992		
993		if (isNaN(intValue)) 
994		{
995			return "";
996		}
997		else 
998		{
999			return intValue;
1000		}
1001	}
1002	else
1003	{
1004		return pixelValue;
1005	}
1006}
1007
1008function getElementsByClass(searchClass, node, tag)
1009{
1010	var classElements = new Array();
1011	if ( node == null )
1012		node = document;
1013	if ( tag == null )
1014		tag = '*';
1015	var els = node.getElementsByTagName(tag);
1016	var elsLen = els.length;
1017	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
1018	for (i = 0, j = 0; i < elsLen; i++) {
1019		if ( pattern.test(els[i].className) ) {
1020			classElements[j] = els[i];
1021			j++;
1022		}
1023	}
1024	return classElements;
1025}
1026
1027/*
1028 * Adds a div to the page within parentDiv;
1029 * Can give it an ID and a Class
1030 * @author a474372
1031 */
1032function appendDiv(parentDiv, divId, className) {
1033	var divTag = document.createElement("div");
1034	var parentDiv = document.getElementById(parentDiv);
1035	parentDiv.appendChild(divTag);
1036	
1037	if(divId != null) {
1038		divTag.id = divId;
1039	}
1040	if(className != null) {
1041		divTag.className = className;
1042	}
1043}	
1044
1045/*
1046 * Global flag to cache the fact that the browser supports fixed positioning
1047 * Should be set to null here and will be intialized by the first FloatingDiv
1048 * object created
1049 */
1050var browserSupportsFixed = null;
1051
1052/*
1053 * Creates a floating div object based on the given content div that floats 
1054 * the content at a position specified by CSS corresponding to the div
1055 *
1056 * Usage:
1057 * var floatingDiv = new FloatingDiv("someId");
1058 * floatingDiv.init();
1059 * ............
1060 * floatingDiv.reset();
1061 * You would need to cache the reference to be able call reset in a different part of your co
1061de
1062 */
1063var FloatingDiv = function(floatingDivId)
1064{
1065	// Cache a reference to the current object
1066	var floatingDivObj = this;
1067	
1068	// Browser capabilities	
1069	this.hasInner = (typeof(window.innerWidth) == 'number');
1070
1071	this.hasElement = ((document.documentElement != null) && (document.documentElement.clientWidth));
1072	
1073	// Getting a reference to the actual content div 
1074	this.content = (document.getElementById ? document.getElementById(floatingDivId) : document.all ? document.all[floatingDivId] : document.layers[floatingDivId]);
1075	
1076	// Positioning variables
1077	this.currentX = 0;
1078	this.currentY = 0;
1079	this.shiftX = 0;
1080	this.shiftY = 0;
1081	this.defaultTargetLeft = NaN;
1082	this.defaultTargetTop = NaN;
1083	this.defaultTargetRight = NaN;
1084	this.defaultTargetBottom = NaN;	
1085	this.targetLeft = 0;
1086	this.targetTop = 0;
1087	this.targetRight = 0;
1088	this.targetBottom = 0;
1089	
1090	
1091	// Initialize the global flag only once
1092	if (browserSupportsFixed == null) 
1093	{
1094		browserSupportsFixed = isFixedSupported();
1095	}
1096	
1097	/*
1098	 * Callback function for registering as a scroll event listener
1099	 */ 
1100	this.floatContent = function()
1101	{
1102		floatingDivObj.moveContent();
1103	};
1104	
1105	/*
1106	 * Deferred initialization function
1107	 * Registers a scroll event listener in case the browser does not support fixed
1108	 */ 
1109	this.init = function()
1110	{
1111
1112		this.currentX = 0;
1113		this.currentY = 0;
1114		this.shiftX = 0;
1115		this.shiftY = 0;
1116		this.targetLeft = 0;
1117		this.targetTop = 0;
1118		this.targetRight = 0;
1119		this.targetBottom = 0;
1120		
1121		// IE7+, FF
1122		if (browserSupportsFixed) 
1123		{
1124
1125			//this.content.style.position = "fixed";
1126		}
1127		else 
1128		{	// IE6
1129
1130			// Uses getPosition from styleUtil to get the evaluated CSS styles
1131			this.targetLeft = parseInt(getPosition(this.content, 'left'));
1132			this.targetTop = parseInt(getPosition(this.content, 'top'));
1133			this.targetRight = parseInt(getPosition(this.content, 'right'));
1134			this.targetBottom = parseInt(getPosition(this.content, 'bottom'));
1135			
1136			this.defaultTargetLeft = this.targetLeft;
1137			this.defaultTargetTop = this.targetTop;
1138			this.defaultTargetRight = this.targetRight;
1139			this.defaultTargetBottom = this.targetBottom;
1140			
1141			if (document.layers) 
1142			{
1143
1144				content.left = 0;
1145				content.top = 0;
1146			}
1147			
1148			// Register a listener for the scroll event 
1149			this.addEvent(window, 'onscroll', floatingDivObj.floatContent);
1150			
1151			// Move the content now
1152			floatingDivObj.moveContent();
1153
1154		}
1155	};
1156	
1157	/*
1158	 * Unregisters the event listener registered in init()
1159	 * Restores positioning
1160	 */
1161	this.reset = function()
1162	{
1163
1164		this.currentX = 0;
1165		this.currentY = 0;
1166		this.shiftX = 0;
1167		this.shiftY = 0;
1168		this.targetLeft = 0;
1169		this.targetTop = 0;
1170		this.targetRight = 0;
1171		this.targetBottom = 0;
1172		
1173		if (!isNaN(this.defaultTargetLeft)) 
1174		{
1175			this.content.style.left = this.defaultTargetLeft + 'px';
1176		}
1177
1178		if (!isNaN(this.defaultTargetTop)) 
1179		{
1180			this.content.style.top = this.defaultTargetTop + 'px';
1181		}
1182
1183		if (!isNaN(this.defaultTargetRight)) 
1184		{
1185			this.content.style.right = this.defaultTargetRight + 'px';
1186		}
1187
1188		if (!isNaN(this.defaultTargetBottom)) 
1189		{
1190			this.content.style.bottom = this.defaultTargetBottom + 'px';
1191		}
1192		
1193		this.removeEvent(window, 'onscroll', floatingDivObj.floatContent);
1194	};
1195
1196
1197};
1198
1199/*
1200 * Computation for positioning of floating div
1201 */
1202FloatingDiv.prototype.computeShifts = function()
1203{
1204	this.shiftX = this.hasInner ? pageXOffset : this.hasElement ? document.documentElement.scrollLeft : document.body.scrollLeft;
1205	
1206	if (this.targetLeft > 0) 
1207	{
1208		this.shiftX += this.targetLeft;
1209	}
1210	else 
1211	{
1212		this.shiftX += (this.hasElement ? document.documentElement.clientWidth : this.hasInner ? window.innerWidth - 20 : document.body.clientWidth) -
1213		this.targetRight -
1214		this.content.offsetWidth;
1215	}
1216	
1217	this.shiftY = this.hasInner ? pageYOffset : this.hasElement ? document.documentElement.scrollTop : document.body.scrollTop;
1218	if (this.targetTop > 0) 
1219		this.shiftY += this.targetTop;
1220	else 
1221	{
1222		this.shiftY += (this.hasElement ? document.documentElement.clientHeight : this.hasInner ? window.innerHeight - 20 : document.body.clientHeight) -
1223		this.targetBottom -
1224		this.content.offsetHeight;
1225	}
1226};
1227
1228/*
1229 * Computation for positioning of floating div
1230 */
1231FloatingDiv.prototype.moveContent = function()
1232{
1233	this.computeShifts();
1234	
1235	if (this.currentX != this.shiftX || this.currentY != this.shiftY) 
1236	{
1237		this.currentX = this.shiftX;
1238		this.currentY = this.shiftY;
1239		
1240		if (document.layers) 
1241		{
1242			this.content.left = this.currentX;
1243			this.content.top = this.currentY;
1244		}
1245		else 
1246		{
1247			this.content.style.left = this.currentX + 'px';
1248			this.content.style.top = this.currentY + 'px';
1249		}
1250	}
1251	
1252	this.content.style.right = '';
1253	this.content.style.bottom = '';
1254};
1255
1256/*
1257 * addEvent and removeEvent, designed by Aaron Moore
1258 */
1259FloatingDiv.prototype.addEvent = function(element, listener, handler)
1260{
1261	if (typeof element[listener] != 'function' ||
1262	typeof element[listener + '_num'] == 'undefined') 
1263	{
1264		element[listener + '_num'] = 0;
1265		if (typeof element[listener] == 'function') 
1266		{
1267			element[listener + 0] = element[listener];
1268			element[listener + '_num']++;
1269		}
1270		element[listener] = function(e)
1271		{
1272			var r = true;
1273			e = (e) ? e : window.event;
1274			for (var i = 0; i < element[listener + '_num']; i++) 
1275				if (element[listener + i](e) === false) 
1276					r = false;
1277			return r;
1278		}
1279	}
1280	
1281	//if handler is not already stored, assign it
1282	for (var i = 0; i < element[listener + '_num']; i++) 
1283		if (element[listener + i] == handler) 
1284			return;
1285	element[listener + element[listener + '_num']] = handler;
1286	element[listener + '_num']++;
1287};
1288
1289FloatingDiv.prototype.removeEvent = function(element, listener, handler)
1290{
1291	//if the system is not set up, or there are no handlers to remove, exit
1292	if (typeof element[listener] != 'function' ||
1293	typeof element[listener + '_num'] == 'undefined' ||
1294	element[listener + '_num'] == 0) 
1295		return;
1296	//loop through handlers,
1297	//  if target handler is reached, begin overwriting each
1298	//  handler with the handler in front of it until one before the last
1299	var found = false;
1300	for (var i = 0; i < element[listener + '_num']; i++) 
1301	{
1302		if (!found) 
1303			found = element[listener + i] == handler;
1304		if (found && (i + 1) < element[listener + '_num']) 
1305			element[listener + i] = element[listener + (i + 1)];
1306	}
1307	//if handler was found, decrement the handler count
1308	if (found) 
1309		element[listener + '_num']--;
1310};
1311
1312/**
1313 * @author a434006
1314 */
1315 
1316/**
1317 * Turn on/off debug
1318 * value - true/false
1319 */
1320articleControl.debug = false; 
1321
1322/**
1323 * Retrieves the articles json object and stores it
1324 */
1325articleControl.articleContent = (typeof articlePageTags == "undefined") ? null : articlePageTags;
1326
1327/**
1328 * Default global timer
1329 */
1330articleControl.globalTimer = null;
1331
1332/**
1333 * Default article body text
1334 */
1335articleControl.bodyText = "";
1336
1337/**
1338 * Default article author
1339 */
1340articleControl.Author = "";
1341
1342/**
1343 * Default article publisher
1344 */
1345articleControl.Publisher = "";
1346
1347/**
1348 * Default article date
1349 */
1350articleControl.Date = "";
1351
1352/**
1353 * Default send to e-mail address form value
1354 */
1355articleControl.friendEmail_valid = false;
1356
1357/**
1358 * Default send to e-mail address form value
1359 */
1360articleControl.userEmail_valid = false;
1361
1362/*
1363 * Z-index across multiple popins
1364 */
1365articleControl.lastUsedZIndex = 99999;
1366
1367
1368/**
1369 * Displays a popin onto the page
1370 * @param e - the event which called this function
1371 * @param id - the id of the container to be closed
1372 */
1373 articleControl.displayPopIn = function(e,id) {
1374 	articleControl.displayPopin(e,id);
1375 }
1376articleControl.displayPopin = function(e,id) {
1377	// set global parameters
1378	var elmID = null;
1379	var currLink = null;
1380
1381	var callCloseMouseOver = null;
1382	var callClearTimeout = null;
1383	
1384	var left = null;
1385	var top = null;
1386
1387	try {
1388		// set the target element of this event
1389	
1390			
1391		// set the popin elements id
1392		elmID = id;
1393		
1394		// get the left and top position of the event element
1395		if( e != null){
1396			currLink = Destination.getTarget(e);
1397			left = Destination.getOffsetLeft(currLink);
1398			top	= Destination.getOffsetTop(currLink);
1399		}	
1400
1401		
1402		
1403		
1404		if(typeof elmID == "undefined" || elmID == null) {
1405			return false;
1406		}
1407		else {	
1408		if(elmID == "pgcontrolshareform") {
1409				// retrieve the current shareform popin to be displayed
1410				var pgControlsharePopin = document.getElementById(elmID);
1411				
1412				pgControlsharePopin.style.top = top - 6 + "px";
1413				pgControlsharePopin.style.left = left - 409 + "px";
1414				pgControlsharePopin.style.zIndex = 1000;
1415				
1416				pgControlsharePopin.className = "pgcontrolshareform";
1417				document.getElementById('article_title_share').innerHTML = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "" : pgCorePageTitle;
1418				document.getElementById('blankdivshare').style.top = top - 16 + "px";
1419				document.getElementById('blankdivshare').style.left = left - 419 + "px";
1420				document.getElementById('blankdivshare').style.height = pgControlsharePopin.offsetHeight + 20 + "px";
1421				document.getElementById('blankdivshare').style.display = "block";
1422				if(document.getElementById('pgcontrolshareformfirstanchor')){
1423					var anchorInactiveScreen = document.getElementById('pgcontrolshareformfirstanchor');
1424					anchorInactiveScreen.focus();
1425				}  
1426								
1427			}
1428			else if(elmID == "emailform") {
1429
1430				var emailPopin = document.getElementById(elmID);
1431
1432				if (document.createEventObject){
1433
1434					articleControl.savedEmailEvent = document.createEventObject(e);
1435				} else {
1436
1437					articleControl.savedEmailEvent = e;
1438
1439				}
1440				
1441				var floatingDivRef = "floatingDiv" + elmID;
1442
1443				if (window[floatingDivRef])
1444				{
1445					// Reset the underlying content to default state
1446
1447					window[floatingDivRef].reset();
1448				}
1449				else
1450				{
1451
1452					window[floatingDivRef] = new FloatingDiv(elmID);	
1453				}
1454				
1455				emailPopin.style.top = top - 6 + "px";
1456				emailPopin.style.left = left -354 + "px";
1457				emailPopin.className = "emailPopin";
1458				emailPopin.style.position = "absolute";
1459				
1460				document.getElementById('article_title_email').innerHTML = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "Fidelity Investments" : pgCorePageTitle;								
1461				document.getElementById('blankdiv').style.display = "block";
1462				document.getElementById('blankdiv').style.top = top - 16 + "px";
1463				document.getElementById('blankdiv').style.left = left - 364 + "px";
1464				document.getElementById('blankdiv').style.height = emailPopin.offsetHeight + 20 + "px";
1465				emailPopin.style.zIndex = articleControl.lastUsedZIndex++;
1466					
1467				window[floatingDivRef].init();
1468				
1469				
1470			}
1471			else if (elmID == "emailConfirm") {
1472				// retrieve the current popin to be displayed
1473				var emailConfirm = document.getElementById(elmID);
1474				
1475				// Sets the opacity of the e-mail confirm div
1476				var floatingDivRef = "floatingDiv" + elmID;
1477						
1478				if (window[floatingDivRef])
1479				{
1480					window[floatingDivRef].reset();				
1481				}
1482				else
1483				{
1484					window[floatingDivRef] = new FloatingDiv(elmID);	
1485				}
1486				emailConfirm.style.top = top - 6 + "px";
1487				emailConfirm.style.left = left -354 + "px";
1488				emailConfirm.className = "emailConfirmPopin";
1489				emailConfirm.style.position = "absolute";
1490				document.getElementById('article_title_email').innerHTML = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "Fidelity Investments" : pgCorePageTitle;
1491				
1492				document.getElementById('blankdiv').style.display = "block";
1493				document.getElementById('blankdiv').style.top = top - 16 + "px";
1494				document.getElementById('blankdiv').style.left = left - 364 + "px";
1495				document.getElementById('blankdiv').style.height = emailConfirm.offsetHeight + 20 + "px";
1496				emailConfirm.style.zIndex = articleControl.lastUsedZIndex++;
1497				articleControl.setDivOpacity(100, elmID);
1498				window[floatingDivRef].init();
1499				
1500				
1501            	if(document.attachEvent) {
1502            	    emailConfirm.attachEvent ('onmouseover', callClearTimeout);
1503            	} else {
1504            		emailConfirm.addEventListener ('mouseover', callClearTimeout, false);
1505            	}
1506				
1507			}			
1508			else if(elmID == "shareform") {
1509				// retrieve the current shareform popin to be displayed
1510				var sharePopin = document.getElementById(elmID);
1511				
1512				sharePopin.style.top = top + 15 + "px";
1513				sharePopin.style.left = left + 1 + "px";
1514				sharePopin.style.zIndex = 1000;
1515				sharePopin.className = "shareform";
1516				
1517				
1518				if(document.getElementById('shareformfirstanchor')){
1519					var anchorInactiveScreen = document.getElementById('shareformfirstanchor');
1520					anchorInactiveScreen.focus();
1521				}
1522           	   
1523			}			
1524			 else {
1525				var popin = document.getElementById(elmID);
1526				if(typeof popin == null || popin == "undefined") {
1527					return false;
1528				}
1529				
1530				var floatingDivRef = "floatingDiv" + elmID; 
1531				if (window[floatingDivRef]) 
1532				{
1533					// Reset the underlying content to default state
1534					window[floatingDivRef].reset();
1535				}
1536				else
1537				{
1538					window[floatingDivRef] = new FloatingDiv(elmID);	
1539				}
1540				
1541				popin.className = "emailPopin";
1542				popin.style.zIndex = articleControl.lastUsedZIndex++;
1543				window[floatingDivRef].init();
1544			}
1545		}
1546
1547	}
1548	catch(e) {	
1549		articleControl.shoutError(e, "displayPopIn()");
1550	}
1551}
1552
1553/**
1554 * Hides the popin currently on the page
1555 * @param id - the id of the container to be closed
1556 */	
1557articleControl.hidePopIn = function(id) {
1558	var elmID = null;
1559	
1560	try {
1561		elmID = id;		
1562		if(typeof elmID == null || elmID == "undefined") {
1563			return false;
1564		}
1565		else {			
1566			if(elmID == "emailform") {
1567				var emailPopin = document.getElementById(elmID);
1568				emailPopin.className = "hidden";
1569				document.getElementById('blankdiv').style.display = "none";
1570				articleControl.clearEmail("emailform");
1571				
1572				var floatingDivRef = "floatingDiv" + elmID;
1573				if (window[floatingDivRef])
1574				{
1575					window[floatingDivRef].reset();
1576				}
1577			}
1578			else if(elmID == "emailConfirm" ) {				
1579				articleControl.fadeOutDiv(elmID);
1580				var floatingDivRef = "floatingDiv" + elmID;
1581				if (window[floatingDivRef])
1582				{
1583					window[floatingDivRef].reset();
1584				}
1585			}			
1586			else {
1587				var popin = document.getElementById(elmID);
1588				popin.className = "hidden";
1589				articleControl.clearEmail(elmID);
1590				var floatingDivRef = "floatingDiv" + elmID;
1591				if (window[floatingDivRef])
1592				{
1593					window[floatingDivRef].reset();
1594				}
1595			} 
1596		}
1597	}
1598	catch(e) {
1599		articleControl.shoutError(e, "hidePopIn()");
1600	}
1601}
1602		
1603
1604/**
1605* TBD Make sure once all updated to hidePopInForm remove hidePopIn function. 
1606* It is safer not to remove hidePopIn because if some one is using the same it will be huge impact
1607 * This was added to change the class name from hidden to hidden-form, 
1608 * Hides the popinform currently on the page
1609 * @param id - the id of the container to be closed
1610 */	
1611articleControl.hidePopInForm = function(id) {
1612	var elmID = null;
1613	
1614	try {
1615		elmID = id;			
1616		if(typeof elmID == null || elmID == "undefined") {
1617			return false;
1618		}
1619		else {
1620			
1621			if(elmID == "pgcontrolshareform") {
1622				var pgcontrolsharePopin = document.getElementById(elmID);
1623				pgcontrolsharePopin.className = "hidden-form";
1624				document.getElementById('blankdivshare').style.display = "none";
1625				if(document.getElementById('pgcontrolshareformsourcelink')){
1626					var anchorInactiveScreen = document.getElementById('pgcontrolshareformsourcelink');
1627					anchorInactiveScreen.focus();
1628				}
1629			}
1630			else if(elmID == "emailConfirm" ) {
1631				articleControl.fadeOutDiv(elmID);
1632				var floatingDivRef = "floatingDiv" + elmID;
1633				document.getElementById('blankdiv').style.display = "none";
1634				if (window[floatingDivRef])
1635				{
1636					window[floatingDivRef].reset();
1637				}
1638			}
1639			else if(elmID == "emailform") {
1640				
1641				var emailPopin = document.getElementById(elmID);
1642				emailPopin.className = "hidden-form";
1643				document.getElementById('blankdiv').style.display = "none";
1644				articleControl.clearEmail("emailform");
1645				
1646				var floatingDivRef = "floatingDiv" + elmID;
1647				if (window[floatingDivRef])
1648				{
1649					window[floatingDivRef].reset();
1650				}
1651			}
1652			else if(elmID == "shareform") {
1653				var sharePopin = document.getElementById(elmID);
1654				sharePopin.className = "hidden-form";
1655				if(document.getElementById('shareformsourcelink')){
1656					var anchorInactiveScreen = document.getElementById('shareformsourcelink');
1657					anchorInactiveScreen.focus();
1658				}
1659			}
1660			else {
1661				var popin = document.getElementById(elmID);
1662				popin.className = "hidden-form";
1663				articleControl.clearEmail(elmID);
1664				var floatingDivRef = "floatingDiv" + elmID;
1665				if (window[floatingDivRef])
1666				{
1667					window[floatingDivRef].reset();
1668				}
1669			}
1670			
1671			
1672		}
1673	}
1674	catch(e) {
1675		articleControl.shoutError(e, "hidePopIn()");
1676	}
1677}
1678
1679/**
1680 * Sets a timer to close the popups
1681 * @param id - the id of the container to be closed
1682 */
1683articleControl.closeMouseOver = function(id, time) 
1684{
1685
1686	if (articleControl.globalTimer)
1687	{
1688		if (articleControl.globalTimer[id]) 
1689		{
1690			clearTimeout(articleControl.globalTimer[id]);
1691		}
1692	}
1693	else 
1694	{
1695		articleControl.globalTimer = new Object();
1696		articleControl.globalTimer[id] = 0;
1697	}
1698	
1699	articleControl.globalTimer[id] = setTimeout("articleControl.hidePopIn('" + id + "')", time);
1700}
1701
1702/**
1703 * Calls the pagecontrol service
1704 * @param service_uri - the url of the web service
1705 * @param params - the parameters to pass to the web service
1706 */
1707articleControl.callWebService = function(service_uri, params, formDivId, confirmDivId) {
1708		
1709	if(typeof service_uri == null || service_uri == "undefined" 
1710	   || typeof params == null || params == "undefined")
1711	{
1712		return false;
1713	}
1714	else {
1715		var http_request = false;
1716	
1717		if(window.XMLHttpRequest) {
1718			http_request = new XMLHttpRequest();
1719		}
1720		else if(window.ActiveXObject) {
1721	       	try {
1722	        	http_request = new ActiveXObject("Msxml2.XMLHTTP");
1723	      	} 
1724	      	catch(e) {
1725	      		try {
1726	        		http_request = new ActiveXObject("Microsoft.XMLHTTP");
1727	        	} 
1728	        	catch(e) {
1729	      			http_request = false;
1730	      		}
1731			}
1732		}
1733	
1734		if(http_request) {		
1735			http_request.open("POST", service_uri, true);
1736			http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1737			http_request.setRequestHeader("Content-length", params.length);
1738			http_request.send(params);						
1739			articleControl.hidePopIn(formDivId);
1740			articleControl.displayPopIn(articleControl.savedEmailEvent,confirmDivId);
1741			articleControl.clearEmail(formDivId);
1742			setTimeout("articleControl.hidePopInForm('" + confirmDivId + "')", 5000);		
1743		} else {
1744			return false;
1745		}
1746	}
1747}
1748
1749/**
1750 * Sets the max length of a message box and stops 
1751 * the user from adding more text than what is defined
1752 */
1753articleControl.maxlength = function(form, countId)
1754{
1755	var limitSpan = null;
1756	var maxLenth = 1000;
1757	
1758	try {
1759		// get the count display element from the document
1760		if(document.getElementById(countId)) {
1761			limitSpan = document.getElementById(countId);
1762		}
1763		
1764		if(typeof form == 'undefined' || form == null) {
1765			return false;
1766		}
1767		else {
1768			if(form.getAttribute('maxlength')) {
1769				maxLenth = form.getAttribute('maxlength');
1770			}
1771			
1772			if (form.value.length > maxLenth)
1773			{
1774				form.value = form.value.substring(0, maxLenth);
1775			}
1776			else
1777			{	
1778				if(typeof limitSpan != 'undefined' && limitSpan != null)
1779				{
1780					limitSpan.innerHTML = maxLenth - form.value.length;
1781				}
1782			}
1783		}
1784	}	
1785	catch(e) {
1786		articleControl.shoutError(e, "maxlength()");
1787	}
1788}
1789
1790/**
1791 * fades a div out
1792 * @param divId - id of the container to be faded
1793 */	
1794articleControl.fadeOutDiv = function(divId) { 
1795
1796    var speed = Math.round(10);
1797    var timer = 0;
1798
1799    for(i=100; i >= 0; i--) {
1800        setTimeout("articleControl.setDivOpacity(" + i + ",'" + divId + "')",(timer * speed));
1801        timer++;
1802    }
1803}
1804
1805/**
1806 * change the opacity for different browsers
1807 * @param opacity - the current opacity of the container being faded
1808 * @param divId - id of the container to be faded
1809 */
1810articleControl.setDivOpacity = function(opacity, divId) {
1811
1812    var object = document.getElementById(divId).style;
1813    object.opacity = (opacity / 100);
1814    object.MozOpacity = (opacity / 100);
1815    object.KhtmlOpacity = (opacity / 100);
1816    object.filter = "alpha(opacity=" + opacity + ")";
1817    
1818	switch (opacity) {
1819		case 0: 
1820			object.zIndex = "-100";
1821			break;
1822	}    
1823}
1824
1825/**
1826 * when enabled, shout error throws an alert with information as to the error that occured
1827 * @param err - the error that was thrown
1828 * @param component - the component that throw the error
1829 */
1830articleControl.shoutError = function(err, component) {
1831	if(articleControl.debug) {
1832		alert(err + ": in " + component);
1833	}
1834}
1835
1836function writeToInnerDiv(formDivClass,msgClass, errorMsg, msgVis)
1837{
1838	var divClass = getElementsByClass(formDivClass);
1839	var errorNode;
1840	if(divClass)
1841	{
1842		var allInnerDivs = divClass[0].getElementsByTagName("div");
1843
1844		if(allInnerDivs)
1845		{
1846			
1847			for (i = 0, j = 0; i < allInnerDivs.length; i++) {
1848				if(allInnerDivs[i].id == msgClass)
1849				{
1850				errorNode = allInnerDivs[i];
1851				}
1852			}
1853		}
1854		
1855		if(errorNode)
1856		{
1857			errorNode.innerHTML = errorMsg;
1858			errorNode.className = msgVis;
1859		}
1860	}
1861}
1862
1863function getIdWithinDiv(formDivId,id, tag)
1864{
1865	var elem;
1866	if(tag == null)
1867	{
1868		tag = '*';
1869	}
1870	var divid = document.getElementById(formDivId);
1871	if(divid)
1872	{
1873		var els = divid.getElementsByTagName(tag);
1874		if(els)
1875		{
1876			var elsLen = els.length;
1877			var pattern = new RegExp("(^|\\s)"+id+"(\\s|$)");
1878			for (i = 0; i < elsLen; i++)
1879			{
1880				if ( pattern.test(els[i].id) )
1881				{
1882					elem = els[i];
1883				}
1884			}
1885		}
1886	}
1887	return elem;
1888}
1889
1890function writeToInnerDivById(formDivId,msgId, errorMsg, msgVis,tag)
1891{
1892	try {
1893		var elem;
1894		var errorNode = null;
1895		
1896		if(tag == null)
1897		{
1898			tag = '*';
1899		}
1900		var divid = document.getElementById(formDivId);
1901		if(divid)
1902		{
1903			var els = divid.getElementsByTagName(tag);
1904			if(els)
1905			{
1906				for (i = 0; i < els.length; i++) {
1907					if(els[i].id == msgId)
1908					{
1909						errorNode = els[i];
1910					}
1911				}
1912			}
1913		}
1914		
1915		if(errorNode)
1916		{
1917			errorNode.innerHTML = errorMsg;
1918		}
1919		if(msgVis !=null)
1920		{
1921			errorNode.className = msgVis;
1922		}
1923	}
1924	catch(e)
1925	{
1926		articleControl.shoutError(e, "writeToInnerDivById()");
1927	}
1928}
1929
1930/**
1931 * Changes the font-size of an article
1932 * @param string link - the current font adjuster object
1933 * @param string id - the container that should be affected
1934 * @param string size - the size of the new adjusted font
1935 */
1936articleControl.adjustFont = function() {
1937
1938	var elmID = null;
1939	var newSize = null;
1940	var currentLink = null;
1941	var container = null;
1942	try {
1943
1944		currentLink = arguments[0];		
1945		newSize  = arguments[1];
1946
1947		if(	typeof newSize == null || newSize == "undefined" ||
1948			typeof currentLink == null || currentLink == "undefined" ||
1949			typeof elmID == null || elmID == "undefined" || elmID == ""){
1950			return false;
1951		}else {
1952
1953			for(i=2;i<arguments.length;i++){
1954				container =	document.getElementById(arguments[i]);
1955				if(container != null && container != "undefined") {					
1956					container.style.fontSize = newSize + "px";
1957				}
1958			}
1959			articleControl.changeAnchorText(currentLink);
1960
1961		}
1962
1963	}catch(e) {
1964		articleControl.shoutError(e, "adjustFont()");
1965	}
1966}
1967
1968/**
1969 * Changes the Anchor text size
1970 * @param string currentLink - the current font adjuster object
1971 */
1972articleControl.changeAnchorText = function(currentLink) {
1973	var linkArr = new Array();
1974	try {
1975	alert("hi");
1976		linkArr[0] = document.getElementById("text1");
1977		linkArr[1] = document.getElementById("text2");
1978		linkArr[2] = document.getElementById("text3");
1979	
1980		for(i = 0; i < linkArr.length ; i++) {
1981			if(typeof linkArr[i] == null || linkArr[i] == "undefined") {
1982				return false; 
1983			}		
1984			else {
1985				if(linkArr[i].id == currentLink) {
1986					linkArr[i].className = currentLink + " active";
1987				}
1988				else {
1989					linkArr[i].className = linkArr[i].id;
1990				}
1991
1992			}
1993		}
1994	}
1995	catch(e) {
1996		articleControl.shoutError(e, "changeAnchorText()");
1997	}	
1998}
1999
2000/**
2001 * Opens the print version of current article
2002 */
2003articleControl.print = function() {
2004	//if there are no other parameters you must also add a ?
2005	
2006	var urlInfo = window.location.href.split("?");
2007	if(urlInfo.length == 1)
2008	{
2009		var url = window.location.href.split("#")[0] + "?print=true";
2010	}
2011	else
2012	{	
2013		//make sure there is no hash in the url, i.e. when the user clicked on an index(disclaimer) first
2014		//as the print parameter cannot just blindly be added after that
2015		var url = window.location.href.split("#")[0] + "&print=true";
2016	}
2017	var printWindow = window.open(url, 'printWindow', 'menubar=0,location=0,resizable=0,scrollbars=1,status=0,width=696,height=500');
2018	
2019	if (window.focus) {
2020		printWindow.focus();
2021	}
2022}
2023
2024/*************SHARE*************/
2025
2026	/**
2027	*Function used to build the feature 3rd party url. Also calls invokeFeatureUrl 
2028	*function take user to 3rd part site
2029	*/
2030	articleControl.shareArticle = function(feature) {
2031		
2032		 var facebook_url 		= "http://www.facebook.com/share.php?u=";
2033		 var twitter_url 		= "http://twitter.com/?status=";
2034		 var linkedIn_url 		= "http://www.linkedin.com/shareArticle?mini=true&url=";
2035
2036		 var fcbook_ccsource 	= "facebook_share";
2037		 var twitter_ccsource 	= "twitter_share";
2038		 var linked_ccsource 	= "linkedin_share";
2039		 
2040		 var currentPagePath = document.location.href;
2041		 
2042		 var seperator = " ";
2043		 
2044		try
2045		{
2046			var feature_token = (typeof feature == "undefined") ? "" : feature;
2047			
2048			var page_title = (typeof pgCorePageTitle == "undefined" || pgCorePageTitle == "") ? "" : pgCorePageTitle;
2049			var page_desc = (typeof pgCorePageDescription == "undefined" || pgCorePageDescription == "") ? "" : pgCorePageDescription;
2050
2051			var pg_title = "";
2052			var pg_desc = "";			
2053			
2054			// If page title or page description is not found donot pass these parameters to 3rd party
2055			if(page_title != "")
2056			{
2057				pg_title = "&title="+encodeURIComponent(page_title);
2058			}			
2059			if(page_desc != "")
2060			{
2061				pg_desc = "&summary="+encodeURIComponent(page_desc);
2062			}
2063					
2064			if(feature_token == "") {
2065				
2066				return false;
2067				
2068			}else {							
2069				if(feature.toLowerCase() == "facebook") {			
2070					var bud_parm  = articleControl.budParams();					
2071					var fid_url   = getFidUrl(fcbook_ccsource);					
2072					var long_url  = bud_parm+"&long_url="+fid_url;
2073					var metaParam = "";					
2074					articleControl.invokeFeatureUrl(facebook_url,long_url,fid_url,metaParam);					
2075				}else if(feature.toLowerCase() == "twitter"){
2076
2077					var bud_parm   = articleControl.budParams();					
2078					var fid_url    = getFidUrl(twitter_ccsource);						
2079					var long_url   = bud_parm+"&long_url="+fid_url;
2080					var metaParam  = encodeURIComponent(page_title+seperator);
2081					articleControl.invokeFeatureUrl(twitter_url,long_url,fid_url,metaParam);
2082
2083				}else if(feature.toLowerCase() == "linkedin"){
2084
2085					var bud_parm   = articleControl.budParams();					
2086					var fid_url    = getFidUrl(linked_ccsource);
2087					var long_url   = bud_parm+"&long_url="+fid_url;
2088					var metaParam  = pg_title+pg_desc;					
2089					articleControl.invokeFeatureUrl(linkedIn_url,long_url,fid_url,metaParam);
2090					
2091				}				
2092			}
2093			}catch(e) {
2094				articleControl.shoutError(e, " shareArticle()");
2095			}
2096			
2097			/**
2098			*  utility function will make sure to remove additional ccsource parameter getting appended to the pageurl.
2099			*  */
2100			function getFidUrl(ccsource)
2101			{
2102			
2103				var fid_url="";				
2104				var urlpath = currentPagePath.split("ccsource=");								
2105				if(urlpath.length>1) {
2106				
2107					fid_url = currentPagePath.replace(/ccsource=[^&]*/i,'ccsource='+ccsource);
2108					
2109				}else{	
2110				
2111					var cc_source  = "ccsource="+ ccsource;
2112					var pgpath = currentPagePath.split("?");
2113						
2114					if(pgpath.length>1) {					        
2115					
2116						fid_url    = currentPagePath + "&" + cc_source;
2117						
2118					}else{					
2119						
2120						fid_url    = currentPagePath + "?" + cc_source;	
2121						
2122					}					
2123						
2124				}
2125							
2126				return encodeURIComponent(fid_url);
2127			}
2128			
2129			
2130	 };
2131	 
2132	/**
2133	* Function used to get compressed url from go.fidelity.com service and invove the 3rd party site
2134	*/	
2135	articleControl.invokeFeatureUrl = function(feature_url,long_url,fid_url,metaParm){
2136	
2137		// Temp reference
2138		var linkedIn_url 		= "http://www.linkedin.com/shareArticle?mini=true&url=";
2139		
2140		var xmlHttp = articleControl.getAJAX();		
2141		//Make it Synchronous to make sure there is no surprise when facebook/twetter/.... links clicked randomly.
2142		var fid_bud_host    = "/pf/buddy";		
2143		xmlHttp.open("GET",fid_bud_host+long_url,true);		
2144		
2145		xmlHttp.onreadystatechange = function() {
2146		
2147			if(xmlHttp.readyState == 4){			
2148				if(xmlHttp.status==200 && (xmlHttp.responseText != null && xmlHttp.responseText.length > 0)) {
2149			    		processRequest(xmlHttp.responseText);
2150			    	}
2151			    	//use the actual page url (bud request has failed)
2152			    	else{											
2153			    		processRequest(fid_url);
2154
2155			    	}
2156			}
2157		}
2158	
2159		xmlHttp.send();
2160		
2161		function processRequest(pageurl)
2162		{	
2163			var encode_url = "";
2164			if(feature_url != linkedIn_url)
2165			{
2166				encode_url  = metaParm + pageurl; 
2167			}else
2168			{
2169				encode_url  = pageurl + metaParm;
2170			}
2171			
2172			var share_window = window.open(feature_url + encode_url, 'share_window');
2173			
2174			if (window.focus) {
2175				share_window.focus();
2176			}
2177		}
2178	};	
2179	 
2180	/**
2181	*Utility function used to generate  long url for the current page
2182	*/
2183	articleControl.budParams = function() 
2184	{			
2185			var  token ="/api/v2/links/shrink?api_key=l63kz9al79s37pu6du2a&"+
2186						"dupe_check=1&"+
2187						"format=txt";
2188			
2189			return token;
2190
2191	};
2192
2193	
2194	/**
2195	*Function to return XmlHttpRequest Object
2196	*/
2197	articleControl.getAJAX = function()
2198	{
2199		var xmlHttp;
2200		try
2201		{
2202			// Firefox, Opera 8.0+, Safari
2203			xmlHttp=new XMLHttpRequest();
2204		}
2205		catch (e)
2206		{
2207			// Internet Explorer
2208			try
2209			{
2210				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
2211			}
2212			catch (e)
2213			{
2214				try
2215				{
2216					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
2217				}
2218				catch (e)
2219				{
2220					articleControl.shoutError(e, "Not able to create XMLHttpRequest Object.");
2221					return false;
2222				}
2223			}
2224		}
2225		
2226		return xmlHttp;
2227
2228	};
2229
2230/**  Page Control JS  **/
2231
2232

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.