//<html>
//<script>
//VERSION 1.05

var footnoteWindow ;
var gbooGoPageSameWindow = false ;
var gstrnewname ;
var dynLeftNav;

//default to false, new left nav will reset it.  This is used to determine if 
//new left nav functions will be present.  This is because we want to be able 
//to roll back without changing a lot of JS
dynLeftNav = false;

//window.onerror = mnuError ;
function callgoPageEx(pgname, params, por, prevpor)
{
		//function called on change of portfolio entity manager
		if (por == -99)
		{
			setChildFrameWidth();
			//go to Portfolio Maintenance page only if 'New Portfolio' is selected
			document.getElementById('childFrame').contentWindow.goPage('frm-por_mnt_new.asp', params + '&por=' + prevpor) ;
		}

}

function updateT1AContextFromThomlet(qryStr)
{
	//The input parameter is expected in the below format for proper functioning of this function
	//'wsNewCurr=EUR&mea=ROE'
	
	//If the # of parameters being passed from Thomlet is not more than 1
	if (qryStr.indexOf('&') == -1)
	{
		arrVals = qryStr.split('=') ; 
		
		//Get the object whose value is to be set
		obj = document.getElementById(arrVals[0]) ;
		
		//Set the value of the object
		if (obj)
			obj.value = arrVals[1] ;
		
	}	
	else
	{	//# of parameters passed from Thomlet greater than one
	
		//Get the items whose values need to be set
		arrItems = qryStr.split('&') ;
		
		//Loop thru the items and set their values
		for (i=0; i<=arrItems.length-1; i++)
		{
			str = arrItems[i] ;
			
			arrVals = str.split('=') ; 
			
			//Get the object whose value is to be set
			obj = document.getElementById(arrVals[0]) ;
			
			//Set the value of the object
			if (obj) 
				obj.value = arrVals[1] ;
			
		}
	}	
}

function imgOn(imgName)
{
	if (document.images)
		{
			document.images[imgName].src = eval(imgName + "_on.src");
			/*
			if ((navigator.appVersion.substring(0,1) > 4) || (navigator.appName!=('Netscape'))) {
				document.images[imgName].src = eval(imgName + "_on.src");
			} else {
				document.layers['title'].document[imgName].src = eval(imgName + "_on.src");
			}
			*/
 		}
}

function imgOff(imgName)
{
	if (document.images)
		{
			document.images[imgName].src = eval(imgName + "_off.src");
			/*
			if ((navigator.appVersion.substring(0,1) > 4) || (navigator.appName!=('Netscape'))) {
				document.images[imgName].src = eval(imgName + "_off.src");
			} else {
				document.layers['title'].document[imgName].src = eval(imgName + "_off.src");
			}
			*/
		}
}

function hold(name)
{
	
	//alert('You have selected a function\n\which is not yet available.\n\n\t\t\(please stay tuned)')//\n\t\t('+ name + ')')
}

function redirect(url,name)
{
	document.location = url ;
}

function goExcel (page)
{
	var d=new Date(); 
	if (navigator.appName==('Netscape'))
	{
		goPage('e-'+page, '') ;
	} else {
		goNewFullPage('e-'+page+'.asp?serial=' + d.getTime()+d.getMilliseconds(), '', d.getTime()+d.getMilliseconds()) ;
	}
}

function goExcelMkt (page, param)
{
	var d=new Date(); 
	if (navigator.appName==('Netscape'))
	{
		goPage('e-'+page, '') ;
	} else {
		goNewFullPage('e-'+page+'.asp?serial=' + d.getTime()+d.getMilliseconds(), param, d.getTime()+d.getMilliseconds()) ;
	}
}

function goCheck (page,stVar,check,msg)
{
	if (check)
	{
		goPage(page,stVar) ;
		return true ;
	} else {
		alert (msg) ;
	}
}

function goPageToSameWindow(booWindow, newname)
{
	gbooGoPageSameWindow = booWindow ;
	gstrnewname = newname ;
}

function goPageRenameParent ()
{
	//RENAME PARENT WINDOW SO THAT NO CONFUSION CAN OCCUR WITH CTRL-N WINDOWS
	if (window.opener)
	{
		//var strparentname = window.opener.window.name + '_parent' ;
		//window.opener.window.name = strparentname ;
		var strname ;
		//if (navigator.userAgent.test(/MSIE 6\.0\;/))
		//{
		//	try 
		//	{
				strname = window.opener.name ;
		//	}
		//	catch (e)
		//	{
		//		alert ('unable to rename parent') ;
		//		return ;
		//	}
		//}
		//else
		//{
		//	strname = window.opener.name ;
		//}
		var strparentname = strname + '_parent' ;
		window.opener.name = strparentname ;
		if (document.forms.MainForm)
		{
			document.forms.MainForm.target = strparentname ;
		} else {
			document.forms[0].target = strparentname ;
		}
		//alert('Parent\'s name: ' + strparentname);
	}
}

function goRedirect()
{
}

//Function to load a thomlet into the iFrame
function goThomlet(strThomletURL)
{
	document.getElementById('childFrame').src = strThomletURL ;
	
}

//Function to set the entity selected
function setEntity(intEntity)
{
	/*
	The following are the possible intEntity values that can be passed.
	0 : Reset Entity Manager
	1 : Portfolio
	2 : Security
	3 : Market
	*/
	var bgClr ;
	//bgClr = "#CBCDE1" 
	//Changed the background color of the selected entity based on Eric's feedback!
	bgClr = "#F7D001" ;
	
	document.forms.MainForm.porEntity.value = 0 ;
	document.forms.MainForm.secEntity.value = 0 ;
	document.forms.MainForm.mktEntity.value = 0 ;
	
	switch(parseInt(intEntity))
	{
	
	case 0 :
			//The setEntity function is called with parameter 0 to reset the Entity Manager.
			resetEntityMgr() ;
			break ;
			
	case  parseInt(getOutLineIdFromPageId("com")) :
			document.forms.MainForm.secEntity.value = 1 ;
			obj = document.getElementById('secEntityMgr') ;
			obj.style.background = bgClr ;
			obj = document.getElementById('secHdr') ;
			obj.style.color = "#000963" ;
			obj = document.getElementById('SecGoImg') ;
			obj.src = "images/go_yellow.gif" ;
			hiLightEntity(intEntity) ;
			break ;
			
	case  parseInt(getOutLineIdFromPageId("por")) :
			document.forms.MainForm.porEntity.value = 1 ;
			obj = document.getElementById('porEntityMgr') ;
			obj.style.background = bgClr ;
			obj = document.getElementById('porHdr') ;
			obj.style.color = "#000963" ;
			obj = document.getElementById('PorGoImg') ;
			obj.src = "images/go_yellow.gif" ;
			hiLightEntity(intEntity) ;
			break ;
	
	case  parseInt(getOutLineIdFromPageId("mkt")) :
			document.forms.MainForm.mktEntity.value = 1 ;
			obj = document.getElementById('mktEntityMgr') ;
			obj.style.background =  bgClr;
			obj = document.getElementById('mktHdr') ;
			obj.style.color = "#000963" ;
			obj = document.getElementById('MktGoImg') ;
			obj.src = "images/go_yellow.gif" ;
			hiLightEntity(intEntity) ;
			break ;
	}
}

//Function to reset the Entity Manager.

function resetEntityMgr()
{
	
	obj = document.getElementById('secEntityMgr') ;
	obj.style.background = "#303791" ;
	obj = document.getElementById('porEntityMgr') ;
	obj.style.background = "#303791" ;
	obj = document.getElementById('mktEntityMgr') ;
	obj.style.background = "#303791" ;
	
	obj = document.getElementById('porHdr') ;
	obj.style.color = "#EFEFEF" ;
	obj = document.getElementById('secHdr') ;
	obj.style.color = "#EFEFEF" ;
	obj = document.getElementById('mktHdr') ;
	obj.style.color = "#EFEFEF" ;
	
	obj = document.getElementById('SecGoImg') ;
	obj.src = "images/go_blue.gif" ;
	obj = document.getElementById('PorGoImg') ;
	obj.src = "images/go_blue.gif" ;
	obj = document.getElementById('MktGoImg') ;
	obj.src = "images/go_blue.gif" ;
	
}


function hiLightEntity(intEntity)
{
	var bgClr ;
	
	bgClr = "#303791" ;
	
	switch(intEntity)
	{
	case parseInt(getOutLineIdFromPageId("com")) :
			obj = document.getElementById('porEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('porHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('PorGoImg') ;
			obj.src = "images/go_blue.gif" ;
			
			obj = document.getElementById('mktEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('mktHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('MktGoImg') ;
			obj.src = "images/go_blue.gif" ;
			break ;
			
	case  parseInt(getOutLineIdFromPageId("por")) :
			obj = document.getElementById('mktEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('mktHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('MktGoImg') ;
			obj.src = "images/go_blue.gif" ;
			
			obj = document.getElementById('secEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('secHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('SecGoImg') ;
			obj.src = "images/go_blue.gif" ;
			break ;
	
	case  parseInt(getOutLineIdFromPageId("mkt")) :
			obj = document.getElementById('porEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('porHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('PorGoImg') ;
			obj.src = "images/go_blue.gif" ;
			
			obj = document.getElementById('secEntityMgr') ;
			obj.style.background = bgClr  ;
			obj = document.getElementById('secHdr') ;
			obj.style.color = "#EFEFEF" ;
			obj = document.getElementById('SecGoImg') ;
			obj.src = "images/go_blue.gif" ;
			break ;
	}
	
}


function writePathLocator(path)
{
	obj = document.getElementById('pathLocator') ;
	obj.innerHTML = path ;
}


function goPage(page, stVar) 
{

	try {
	
parent.document.getElementById('loadingMsg').style.display='block'
parent.document.loadingMessage.src='images/reboot_load.gif' ;
} catch(e) {}

	if (document.forms.MainForm) 
	{
		FiredOnce=true;
		//alert(window.opener);
		//outer IF for IE
		//inner IF for NS
		// for both IFs you need the same ELSE statement
		if (window.opener && !gbooGoPageSameWindow)
		{
			var strEval ;
			// Protection against applications launching WAF sites - window.opener.name is unavailable and causes javascript error "access denied"
			if (navigator.appName == 'Netscape' && navigator.appVersion.search(/^4\.7/) )
			{
				//NS 4.7x does not allow use of try keyword - let it handle the error
				strEval = 'if (typeof(window.opener.name) != "undefined") {goPageRenameParent();}' ;
			} else {
				strEval = 'try { if (typeof(window.opener.name) != "undefined") {goPageRenameParent();} } catch (e) { alert ("error trapped") ; }'
			}
			
			if (gstrnewname) {
				//alert('Opener is self under a new name: ' + gstrnewname) ;
	  			document.forms.MainForm.target = gstrnewname ; //'AEmain' ;
	  			self.name = gstrnewname ;
	  		} else {
				//alert('Opener is self: ' + self.name) ;
	  			document.forms.MainForm.target = self.name ; //'AEmain' ;
	  			//alert('window name: ' + window.name);
	  		}

		} else if (gstrnewname) {
				//alert('Opener is self under a new name: ' + gstrnewname) ;
	  			document.forms.MainForm.target = gstrnewname ; //'AEmain' ;
	  			self.name = gstrnewname ;
	  	} else {
			//alert('Opener is self: ' + self.name) ;
	  		document.forms.MainForm.target = self.name ; //'AEmain' ;
	  		//alert('window name: ' + window.name);
	  	}

		if (self.name=='pubBreakFrame') document.forms.MainForm.target = '_top'  //break out of the frameset for Web Author
		if (self.name=='AlertsTop') document.forms.MainForm.target = '_top'  //break out of the frameset for Alerts
		
	  	if (navigator.appName=='Microsoft Internet Explorer') {
	  		document.forms.MainForm.action = ''
			if (footnoteWindow) {footnoteWindow.close()}
		}
		
	  	var ret = goTemplate (page, stVar) ;
	  	
	} else {
			alert('this page (' + page + ') does not load correctly\n\(err goP) passing to default.asp');
			document.location.replace('default.asp');
	}
// 	return ret ;
}

function goNewFullPage(page,stVar,name,xsize,ysize) {
	if (document.forms.MainForm) {
		//winOpen = window.open('', name, 'resizable=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,menubar=yes,width='+xsize+',height='+ysize);
		document.forms.MainForm.target = name;
		goTemplate (page,stVar) ;
	} else {
			document.location.replace('default.asp');
	}
	
} 

function goNewPageExt(url, name, xsize, ysize, toolbar, menubar, scrollbar, resizable)
{
	var win
	win = window.open(url, name, 'resizable='+resizable+',toolbar='+toolbar+',location=no,scrollbars='+scrollbar+',status=no,menubar='+menubar+',directories=no,width='+xsize+',height='+ysize);
	win.focus();
}

//Changed by Venkatesh babu
//This function is a subset of goNewPage function. 
//Purpose of this function --> In goNewPage funcation we used to get a alert message whenever u try to view PDF documents.
//								In order to avoid the alert message we have written this function.
function goNewPageWithoutWarningMsg(page,stVar,name,xsize,ysize,scrollbar)
{
     if ((page.substring(page.length-3, page.length)!="asp") && (page!="") && (page.substring(page.length-1, page.length)!="?")) 
      {
            if (page == "ManageAlerts")
                  page=page+".aspx";
            else
                  page=page+".asp";
      }

      page = page+'?' + stVar
      
      var winOpen = window.open(page, name, 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',status=no,menubar=no,directories=no,width='+xsize+',height='+ysize);
}



function goNewPage(page,stVar,name,xsize,ysize,scrollbar)
{
/*	if (navigator.appName=='Netscape')
		{	var winName = open('', name, 'width=1,height=1');
			winName.close();
		} 
*/	
try
{
	var chStVar
	chStVar=stVar.indexOf("popup");
	if (chStVar==-1) {stVar=stVar+'&popup=popup'}
		
	if ((document.forms.MainForm) ||(document.forms.anaCov))
	{
		var dotPos;
		//dotPos = stVar.indexOf(".");
		//if ( dotPos >= 0)
		//{
		//	alert (stVar + "Contains an invalid Char.. ");
		/*	stVar = stVar.substring(0, dotPos)+ stVar.substring(dotPos + 1, stVar.length);
			alert ("Changed to .. " + stVar); */
//			dotPos = name.indexOf(".");
//			if (dotPos >= 0) 
//			{
//				name = name.substring(0, dotPos) + name.substring(dotPos + 1, name.length);
				//alert ("name changed to ... " + name); 
//			}
				
		//}

//***************************************Changed by bhamini for Document View option **********************************************		
		
		var strDocumentView 
         if (name != 'LookUp')
		{
			if (name != 'calwin')
			{
				strDocumentView = document.getElementById('docview').innerHTML;
			}
		}   
		
		if (strDocumentView == '')
		{
			strDocumentView = 'new';
		}
		if (name == 'analyst' || strDocumentView == 'new' || name == 'LookUp' || name == 'calwin')
		{
				name=name.replace(/[.]/g, "");
				winOpen = window.open('', name, 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',status=no,menubar=no,directories=no,width='+xsize+',height='+ysize);
		}
		else
		{
				winOpen = window.open('', 'Research', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',status=no,menubar=no,directories=no,width='+xsize+',height='+ysize);
		}	
		
//		if (document.forms.anaCov)
		document.forms.MainForm.target = name;
		if (name != 'analyst' && name != 'LookUp' && name != 'calwin')
		{	
			if (strDocumentView =='new'){document.forms.MainForm.target = name;}
			else {document.forms.MainForm.target = 'Research'; }
		}
		goTemplate (page,stVar) ;
	} else {
			alert('this page (' + page + ') does not load correctly\n\(err goP) passing to default.asp');
			document.location.replace('default.asp');
	}	
}
catch(e){}	
} 

/*
function tgoNewPage(page,stVar,xsize,ysize,scrollbar) 
{
	if (navigator.appName=='Netscape')
		{	var footnoteWindow = open('', 'footnoteWindow');
			footnoteWindow.close();
		}    
	footnoteWindow = window.open('', 'footnoteWindow', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',status=no,menubar=no,directories=no,width='+xsize+',height='+ysize);
//	var old_target = document.forms.MainForm.target ;
//	var old_page = document.forms.MainForm.action ;
	document.forms.MainForm.target = 'footnoteWindow';
	goTemplate (page,stVar) ;
} 
*/


function goNewPageToolMnuBar(page,stVar,name,xsize,ysize,toolbar,menubar,scrollbar)
{

	var chStVar
	chStVar=stVar.indexOf("popup");
	if (chStVar==-1) {stVar=stVar+'&popup=popup'}
		
	if (document.forms.MainForm) 
	{
	
			dotPos = name.indexOf(".");
			if (dotPos >= 0) 
			{
				name = name.substring(0, dotPos) + name.substring(dotPos + 1, name.length);
			}
							 
		winOpen = window.open('', name, 'resizable=yes,toolbar='+toolbar+',location=no,scrollbars='+scrollbar+',status=no,menubar='+menubar+',directories=no,width='+xsize+',height='+ysize);
		document.forms.MainForm.target = name;
		goTemplate (page,stVar) ;
	} else {
			alert('this page (' + page + ') does not load correctly\n\(err goP) passing to default.asp');
			document.location.replace('default.asp');
	}	
} 





function goTemplate (page , stVar)
{
	//This logic checks for if the user is in beta mode and then changes the page and corresponding arguments
	//to the new page as defined under beta mode.
	//commented to allow beta pages to appear along with normal mode //gaurav 20 aug 07
///	if(parent.betaMode)
//	{
//		var betaPage, betaStVar,pipeIndex;
		//get the new beta page name along with arguments for the given page.
//		betaPage = parent.getPageNameFromAlias(page);
		//check if the beta page returned is equal to old page passed.
//		if(betaPage != page)
//		{	//seperate the page and arguments which are seperated by pipe(|)
//			pipeIndex = betaPage.indexOf("|");
//	 		betaStVar = betaPage.slice(pipeIndex+1);
//			betaPage = betaPage.slice(0,pipeIndex);
//			page = betaPage;
//			stVar = betaStVar;
//		}
		 				
//	}
	
	if (checkRowNav(stVar) == false) {return false} ;
	if ((page.substring(page.length-3, page.length)!="asp") && (page!="") && (page.substring(page.length-1, page.length)!="?")) 
	{
		if (page == "ManageAlerts")
			page=page+".aspx";
		else
			page=page+".asp";
	}
	if (stVar.substring(0,2) == "NA") {
		hold()

	} else {
		if ((document.forms.MainForm) || (document.forms.anaCov)) {
			var frmMain;
			if (document.forms.anaCov)
			{
				frmMain = window.opener.document.forms.MainForm ;
			}
			else
			{
				frmMain = document.forms.MainForm ;
			}
			
			if (document.forms.changeForm) {
				var frmChange = document.forms.changeForm ;
				
				for (i=0; i < frmChange.length; i++)
				{
					var item = frmChange[i].name ;
					if (item == 'changes')
					{
						if (frmChange[i].value != '')
						{
							if (stVar!='') {stVar += "&" ;}
							stVar += frmChange[i].value
						}
					} else if (frmMain[item]) {
						frmMain[item].value = frmChange[i].value
					} else {
						if (stVar.search(item + "=")<0) {
							if (stVar!='') {stVar += "&" ;}
							stVar += item + "=" + frmChange[i].value

							if (stVar.indexOf("com=") > -1) {
								if (stVar.indexOf("tkr=") == -1)
								{
									stVar += "&tkr=-#"
								}
							}

						}
					}						
				}
			}
			
			if (frmMain.changes) {
				frmMain.changes.value=stVar ;
			}


			if (page=='') {
				page=new String(''+document.location) ;
				page=(page.replace(/^[^?]*\/([^\/?]*)(.*)$/, "$1$2")) ;					
			}
			
			if (page=='s-log_in.asp') {
				page='https://' + DNSName + '/s-log_in.asp';
			}
		
			
			
			frmMain.action=page;
			frmMain.submit();
			return true;
			
		} else {
			alert('this page (' + page + ') does not load correctly\n\(err goT)passing to default.asp');
			document.location.replace('default.asp');
			}
	}
}

function addToChanges (name, value)
{
	if (document.forms.changeForm)
	{
		var changes = document.forms.changeForm.changes ;
		if (changes.value != '') {changes.value += '&'}
		changes.value += name + '=' + value ;
	}
}


//PAGING
function checkRowNav(stVar)
{
	var check = true ;
	if (stVar.search(/(^|\&)nav=/) != -1)
	{
		var nav = stVar.replace(/(^|^.*\&)nav=([^\&]*).*$/,'$2');
		var beg = Number(stVar.replace(/(^|^.*\&)STARTROW=([^\&]*).*$/,'$2'));
		var end = Number(stVar.replace(/(^|^.*\&)ENDROW=([^\&]*).*$/,'$2'));
		var step = Number(stVar.replace(/(^|^.*\&)ROWSTEP=([^\&]*).*$/,'$2'));
		if (nav == 'nxt' && beg+step > end)
		{
			check = confirm('You have gone past the last row; the first ' + step + ' headlines will now be displayed\nIf this is not what you want, click Cancel') ;
			
		} else if (nav == 'prv' && beg-step < 1)
		{
			check = confirm('You have gone past the first row; the last ' + step + ' headlines will now be displayed\nIf this is not what you want, click Cancel')
		} else {
		}
		
	}
	return check ;
}


//COLUMN SORTING
function setOrder(order, stVar)
{
	var dir=document.forms.MainForm.dir.value
	if (document.forms.MainForm.ord.value==order){
		if (dir=="ASC") {
			 dir="DESC"
		}		
		else {
			 dir="ASC" 
		}
	} else {
		dir="ASC" 
	}
	document.forms.MainForm.ord.value=order
	document.forms.MainForm.dir.value=dir
	
	if (typeof(stVar) == 'undefined'){
		stVar= 'ord='+order+'&dir='+dir
	}
	else{
		stVar= 'ord='+order+'&dir='+dir + '&' + stVar
	}	
	
	stVar = stVar + '&pageNumber=1';
	
	goPage('', stVar)
}


function searchCompany()
{
	var name = document.forms.frmComSrch.name.value ;
	//alert(name) ;
	goPage('a-search_com','name='+name) ;
	return false;
}



function invalidChars(check) {
		var regEx=new RegExp("[<>;:%&\"]")
			if ((regEx.test(check))||(check=='')) {
				return true;
			} else {
				return false;
			}
}



function showHistory()
{
	if (navigator.appName=='Netscape'){
		if (window.history.length > 1){
			window.history.back();
		} else {
			window.close() ;
		}
	}
	else{
		if (window.history.length > 0)	{
			window.history.back();
		} else {
			window.close() ;
		}
	}
		
}

//this function gets callled by the external thomlet pages , when the t1a session expires. This will display a session expiry message
//and redirect the user to t1a login page.
function signOff()
{
	goPage('s-log_in.asp','log=out&mnu=-#&scrsmn=-#&utlsmn=-#&pubsmn=-#&mktsmn=-#&comsmn=-#&porsmn=-#&UsrProtocol=https') ;
}

function mnuError(msg, url, lno)
{
	// general error handling in case of unexpected errors
	var frmMain = document.forms.MainForm ;
	if (frmMain)
	{
		var changes = document.forms.MainForm.changes ;
		if (changes)
		{
			if (changes.value == '')
			{
				changes.value = 'err=JS error on previous page' ;
			} else {
				changes.value += '&err=JS error on previous page' ;
			}
		}
		frmMain.action = 'v-home_ovr.asp' ;
		frmMain.submit() ;
	}
	//return true ;
}



//This function checks or unchecks the Batch Select All check box, 
//depending on the the actual check boxes checked/unchecked
function CheckBatchSelectAll(vew,formName)
{
	var allchecked;
	allchecked = true;
	for ( i=0;i<document.forms[formName].batchlist.length;i++ )
		{
			if ( !document.forms[formName].batchlist[i].checked ) 
				allchecked = false
		}	
	if (vew == 'headline')	
	{
		if (allchecked)	
			document.getElementById('CheckAllSum').checked = true;
		else
			document.getElementById('CheckAllSum').checked = false;	
	}
	else
	{
		if (allchecked)	
			document.getElementById('CheckAll').checked = true;
		else
			document.getElementById('CheckAll').checked = false;	
	}			
}
	
function CheckUnChkAll(obj,strFormName)
{
	if (obj.checked)
		checkAll(strFormName);
	else
		uncheckAll(strFormName);
	
}


	

	//this function resizes the thomlet(external page)height to fit within the T1A application frameset
	//this function is called by all streetevent pages
	function resizeThomletFrame() 
	{ 
		try
		{
			var obj = document.getElementById('ThomletFrame');
			obj.contentWindow.scroll(1000000,1000000); 
			obj.style.height = obj.contentWindow.document.body.scrollHeight + 3; 
			obj.contentWindow.scroll(0,0); 
			window.parent.setIframeHeight('childFrame');
		}
		catch(e)
		{
		
		}
	}
	
	//this function is used for research thomlets to resize the width besides the height.
	//this function resizes the thomlet(external page) to fit within the T1A application frameset
	function resizeThomletFrameResearch() 
	{ 
		try
		{
			var obj = document.getElementById('ThomletFrame');
			obj.contentWindow.scroll(1000000,1000000); 
			obj.style.height = obj.contentWindow.document.body.scrollHeight + 1; 
			obj.style.width = obj.contentWindow.document.body.scrollWidth ; 
			obj.contentWindow.scroll(0,0); 
			window.parent.setIframeHeightWidth('childFrame');
			
		}
		catch(e)
		{
		
		}
	}
	//this function is used for fundamental thomlets to resize the width besides the height.
	//this function resizes the thomlet(external page) to fit within the T1A application frameset
	function resizeThomletFrameFundamental() 
	{ 
		try
		{
			var obj = document.getElementById('ThomletFrame');
			obj.contentWindow.scroll(1000000,1000000); 
			obj.style.height = obj.contentWindow.document.body.scrollHeight; 
			obj.style.width = obj.contentWindow.document.body.scrollWidth ; 
			obj.contentWindow.scroll(0,0); 
			window.parent.setIframeHeightWidth('childFrame');
			
		}
		catch(e)
		{
		
		}
	}
	
	function resizeThomletFrameReutersFundamental() 
	{ 
		try
		{
			var windowHeight = screen.height - 305;		
			var windowWidth = screen.width - parent.document.getElementById('NavMenuCell').offsetWidth - 45;
			var obj = document.getElementById('RFThomletFrame');
			obj.style.height = windowHeight;
			obj.style.width = windowWidth ; 
			window.parent.setIframeHeightWidth('childFrame');
		}
		catch(e)
		{
		
		}
	}
	
	function getWindowWidth() 
	{
		try
		{
			var windowWidth = 0;
			if (typeof(window.innerWidth) == 'number') 
			{
				windowWidth = window.innerWidth;
			}
			else 
			{
				if (document.documentElement && document.documentElement.clientWidth) 
				{
					windowWidth = document.documentElement.clientWidth;
				}
				else 
				{
					if (document.body && document.body.clientWidth) 
					{
						windowWidth = document.body.clientWidth;
					}
				}
			}
		}
		catch(e)
		{
		
		}
		return windowWidth;
	}

	function getWindowHeight(obj) 
	{
		var windowHeight = 0;
		if (typeof(obj.innerHeight) == 'number') 
		{
			windowHeight = window.innerHeight;
		}
		else 
		{
			if (obj.document.documentElement && obj.document.documentElement.clientHeight) 
			{
				windowHeight = obj.document.documentElement.clientHeight;
			}
			else 
			{
				if (obj.document.body && obj.document.body.clientHeight) 
				{
					windowHeight = obj.document.body.clientHeight;
				}
			}
		}
		return windowHeight;
	}
	
	function getDocHeight(doc)
	{
			var docHt = 0, sh, oh;
			if (doc.height) docHt = doc.height;
			else if (doc.body) 
			{
				if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
				if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
				if (sh && oh) docHt = Math.max(sh, oh);
			}
			return docHt;
	}
	
	function getDocWidth(doc)
	{
			var docWt = 0, sh, oh;
			if (doc.width) docWt = doc.width;
			else if (doc.body) 
			{
				if (doc.body.scrollWidth) docWt = sh = doc.body.scrollWidth;
				if (doc.body.offsetWidth) docWt = oh = doc.body.offsetWidth;
				if (sh && oh) docWt = Math.max(sh, oh);
			}
			return docWt;
	}

	function getDocHeightFirefox(doc)
	{
			var docHt = 0, sh, oh;
			if (doc.body) 
			{
				if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
				if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
				if (sh && oh) docHt = Math.max(sh, oh);
			}
			return docHt;
	}
	
	function getDocWidthFirefox(doc)
	{
			var docWt = 0, sh, oh;
			if (doc.body) 
			{
				if (doc.body.scrollWidth) docWt = sh = doc.body.scrollWidth;
				if (doc.body.offsetWidth) docWt = oh = doc.body.offsetWidth;
				if (sh && oh) docWt = Math.max(sh, oh);
			}
			return docWt;
	}

	//this function resizes both the height and the width and is used by research.
	function setIframeHeightWidth(iframeName) 
	{
		var iframeWin = document.getElementById(iframeName).contentWindow;
		var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
		if (iframeEl && iframeWin)
		 {
			iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
			iframeEl.style.width = "auto" ; //added for width
			if (navigator.userAgent.indexOf("Firefox")!=-1)
			{
				var docHt = getDocHeightFirefox(iframeWin.document);
				var docWt = getDocWidthFirefox(iframeWin.document);
			}
			else
			{
				var docHt = getDocHeight(iframeWin.document);
				var docWt = getDocWidth(iframeWin.document);
			}
			// need to add to height to be sure it will all show
			if (docHt) iframeEl.style.height = docHt + "px";
			if(docWt) iframeEl.style.width = docWt + "px";
		}
	
	}
	//this function just sets the height of the iframe and is used by publisher, estimates
	function setIframeHeight(iframeName) 
	{
		var iframeWin = document.getElementById(iframeName).contentWindow;
		var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
		if (iframeEl && iframeWin)
		 {
			iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
			iframeEl.style.width = "auto" ; //added for width
			var docHt = getDocHeight(iframeWin.document);
			// need to add to height to be sure it will all show
			if (docHt) iframeEl.style.height = docHt + "px";
		}
	
	}
	
	
	//this function is used by security research to populate the current country/ticker in the entity manager when the 
	//research page is pulled.
	function getIBESTkrFromList()
	{
		var i ;
		
		for (i=0;i<=parent.document.frmSearch.identifier.options.length; i++)
		{
			if (parent.document.frmSearch.identifier.options[i].value == 'IBES')
				break ;
		}
		return i ;
	}

	//this function gets called by the market research page to syncronize the market entity manager dropdown.
	function SyncMktEntityMgr(mkt)
	{
		for(i=0;i<parent.document.frmMkt.mkt.length;i++)
		{
			if ( (parent.document.frmMkt.mkt.options[i].value).split('~')[0] == mkt )
			{
				parent.document.frmMkt.mkt.selectedIndex=i;
				break;
			}
		}
	}
	
	//this function gets called by the portfolio research page to syncronize the market entity manager dropdown.

	function SelectPortfolio(portID)
	{
		var IndexofNew = -1;
		var Porlen = parent.document.frmPor.Portfolio.length;
		
		for ( i=0;i<Porlen;i++)
		{
			
			if ( ((parent.document.frmPor.Portfolio.options[i].value).split('~'))[0] == portID )
			{
				IndexofNew = i;
				break;	
			}	
		}
		if (IndexofNew != -1 )
			parent.document.frmPor.Portfolio.selectedIndex=IndexofNew;
	}