   /*************************************************************************************
   *Fidelity Confidential Information													*
   *Copyright (c) 2001 FMR Corp.														*
   *																					*
   *  1. File Name			    DeCommon.js												*
   *  2. Description			This Page contains java script							*
   *  3. Modification Log																*
   *  Ver No	Date		    Author							Modification			*
   *  0.0		06-02-2004	    Anindya Bhaduri,Infosys			Original Write			*
   *  1.0		18-02-2004	    Swaroop B Nayak,Infosys			Included Resolution		*
   *															function for adjusting	*
   *															DIV left margin			*
   *  1.1		24-02-2004		Swaroop B Nayak, Infosys		Included fnDivSetVisible*
   *															code to show the Top	*
   *															Scroll Menu on top of	*
   *															Form Objects and PDFs	*
   **************************************************************************************/


//Variable declared for checking Window Resize
var gintClientWidth = 0;
var gintOffsetLeft = 0;


/*function fnEscapeKeyHit()
{
 var intDvCnt,intTotLayer
	if(event.keyCode == 27)
	{
		for(intDvCnt = 1 ; intDvCnt < 40 ; intDvCnt++)
			{
				intTotLayer = "Layer" + intDvCnt
				fnShowHideDropDownHeaderMenu(intTotLayer,'','hide')
			}
	}
}*/


//Disable right mouse click Script - Start
/*function fnRightclickIE()
	{
		if (event.button == 2)
			{
				return false;
			}
	}
 if (document.all && !document.getElementById)
	{
		document.onmousedown = fnRightclickIE ;
	}

document.oncontextmenu = new Function("return false")

//Disable right mouse click Script - End
*/
function fnNormalSubmit()
	{
		var strSearchTextValue , strTrimedValue ;
									 
		strSearchTextValue = document.frmSearch.txtSearchString.value ;
		strTrimedValue = fnTrim(strSearchTextValue) ;

		if( strTrimedValue == "" )
			{
				document.frmSearch.hidSearchFlag.value = "NA";
				document.frmSearch.action = "DeScrnNormalSearch.asp";
				document.frmSearch.submit() ;
			}
		else
			{
				document.frmSearch.hidSearchFlag.value = "Y";
				document.frmSearch.action = "DeScrnNormalSearch.asp";
				document.frmSearch.submit() ;
			}
	}

function fnNavigate(argVar)
	{
		document.frmSearch.method = "POST";
		document.frmSearch.action = "?"+argVar;
		document.frmSearch.hidSearchFlag.value = "Y";
		document.frmSearch.submit();
	}

function fnTrim(UntreamedValue)
	{
		return UntreamedValue.replace(/(^\s*)|(\s*$)/g, "");
	}

function fnHomeLinkClicked()
	{
		document.location.href = "vrScrnVestigoHome.asp" ;
	}

function fnSearchLinkClicked()
	{
		document.location.href = "DeScrnNormalSearch.asp" ;
	}

function fnMyMouseOver(currentID,currentStatus)
	{ 
		if ( document.getElementById(currentID).style.color != 'white' )
			{ 
				document.getElementById(currentID).style.color = '#CC0000' ; 
			} 
		document.getElementById(currentID).style.cursor = 'hand' ; 
		window.status = currentStatus ; 
	}
				
function fnShowHideDropDownHeaderMenu() 
	{
		var iCounter , argListElement , objGetFromArgList , argList ;
		argList = fnShowHideDropDownHeaderMenu.arguments ;
		for ( iCounter = 0 ; iCounter < ( argList.length - 2 ) ; iCounter += 3 ) 
		if (( objGetFromArgList = fnGetObject(argList[ iCounter ])) != null ) 
		{ 
			argListElement = argList[ iCounter + 2 ] ;
			if ( objGetFromArgList.style ) 
				{ 
					objGetFromArgList = objGetFromArgList.style ; 
					argListElement = (argListElement=='show')?'visible':( argListElement=='hide')?'hidden':argListElement ; 
				}
			
			objGetFromArgList.visibility = argListElement ; 
			/*if(argList[ iCounter ] == 'Layer2' && argListElement == 'visible')
			{
				if(!(document.getElementById('DivShim').style.display == 'block'))
				{
					fnDivSetVisible(true,'Layer2') 
				}
			}*/
			/*else
			{
				if(argList[ iCounter ] == 'Layer2')
				fnDivSetVisible(false,'Layer2');
			}*/
			//alertargList[ iCounter ]
			
			//alert(argListElement)
		}
}

function fnGetObject( argReceived ,status ) 
	{ 

		var iCounter , iIndex , objOutParam ;  

		if( !status ) 
			status = document ; 
					   
		if((iIndex = argReceived.indexOf("?"))>0 && parent.frames.length) 
			{
				status = parent.frames[ argReceived.substring(p+1) ].document ; 
				argReceived = argReceived.substring( 0 , iIndex ) ;
			}
					
		if( !(objOutParam = status[ argReceived ]) && status.all ) 
			objOutParam = status.all[ argReceived ]; 
					  
		for (iCounter = 0 ; !objOutParam && iCounter < status.forms.length ; iCounter++ ) 
			objOutParam = status.forms[ iCounter ][ argReceived ];
					  
		for(iCounter = 0 ; !objOutParam && status.layers && iCounter < status.layers.length ; iCounter++ ) 
			objOutParam = fnGetObject( argReceived , status.layers[ iCounter ].document ) ;
					
		if(!objOutParam && status.getElementById) 
			objOutParam = status.getElementById( argReceived ) ; 
					 
		return objOutParam ;
				  
	}


function ChangeCell(cell)
	{
		cell.bgColor = "#FFFFFF" ;
	}

function RevertCell(cell)
	{
		cell.bgColor = "#E7E7EF" ;
	}

//Code Added by Swaroop to make the screen 800 X 600 and 1024 X 768 compatible

function fnChkResolution()
{
	var intWidthOff = 0;
	gintClientWidth = parseInt(document.body.clientWidth);
	if(screen.height == 600 && screen.width == 800)
	{
		intWidthOff = 780 - parseInt(document.body.clientWidth);
		if (parseInt(intWidthOff) > 32)
		{
			intWidthOff = 32;
		}
		for(var iCount=0;iCount<document.all.length;iCount++)
		{
			if(fnChkLayer(document.all[iCount].id))
			{
				document.all[iCount].style.left = (parseInt(fnFormatHeight(document.all[iCount].style.left))-112-intWidthOff);
			}
		}
		//Assign the Left Position value to global vaiable gintOffsetLeft
		gintOffsetLeft = (32 - intWidthOff);
	}
	else
	{
		if(screen.height == 768 && screen.width == 1024)
		{
			intWidthOff = parseInt((1004 - parseInt(document.body.clientWidth))/2);
			if (parseInt(intWidthOff) > 144)
			{
				intWidthOff = 144;
			}
			for(var iCount=0;iCount<document.all.length;iCount++)
			{
				if(fnChkLayer(document.all[iCount].id))
				{
					document.all[iCount].style.left = (parseInt(fnFormatHeight(document.all[iCount].style.left))-intWidthOff);
				}
			}
			//Assign the Left Position value to global vaiable gintOffsetLeft
			gintOffsetLeft = (144 - intWidthOff);
		}
	}
}
function fnChkLayer(argString)
	{
		var arrScreen = argString.split("")
		var strBldString = ""
		for(var iCount=0;iCount<5;iCount++)
		{
			strBldString = strBldString + arrScreen[iCount]
		}
		if (strBldString == "Layer")
			return true;
		else
			return false;
	}

function fnFormatHeight(argString)
	{
		var arrScreen = argString.split("")
		var strBldString = ""
		for(var iCount=0;iCount<arrScreen.length-2;iCount++)
		{
			strBldString = strBldString + arrScreen[iCount]
		}
		return strBldString;
	}

//Code Added by Swaroop to Open Reprt in a separate maximized window
function fnReport(strURL,strTitle)
	{
		var myWindow;
		var strTempString = "";
		myWindow = window.open("",null,'status=no,titlebar=no,toolbar=no,menubar=no,resizable=yes');
		myWindow.moveTo(0,0);
		myWindow.resizeTo(screen.availwidth,screen.availheight);
		strTempString = "<HTML><TITLE>" + strTitle + "</TITLE>";
		strTempString = strTempString + " <SCRIPT language=JavaScript src='/asp/include/DeCommon.js' type=text/javascript></SCRIPT>"
		strTempString = strTempString + " <BODY BgColor = Red topMargin = 0 bottomMargin = 0 LeftMargin = 0 RightMargin = 0>"
		strTempString = strTempString + " <IFRAME ID=IFrameRep SRC = " + strURL
		strTempString = strTempString + " FRAMEBORDER=0 SCROLLING=NO height=100% width=100%></IFRAME>"
		strTempString = strTempString + " </BODY></HTML>"
		myWindow.document.write(strTempString);
		myWindow.document.close() ;
	}

function fnOnResize()
{
	var intOffsetLeft = 0;
	intOffsetLeft = document.getElementById('divMaster').offsetLeft;
	for(var iCount=0;iCount<document.all.length;iCount++)
			{
				if(fnChkLayer(document.all[iCount].id))
				{
					document.all[iCount].style.left = (parseInt(fnFormatHeight(document.all[iCount].style.left))-gintOffsetLeft+intOffsetLeft);
				}
			}
	gintOffsetLeft = intOffsetLeft;
}

function fnDivSetVisible(state,strTargetDiv) 
{ 
	var DivRef = document.getElementById(strTargetDiv); 
	var IfrRef = document.getElementById('DivShim'); 
	if(state) 
	{ 
		DivRef.style.display = "block";
		IfrRef.style.width = DivRef.offsetWidth; 
		IfrRef.style.height = DivRef.offsetHeight; 
		IfrRef.style.top = DivRef.style.top; 
		IfrRef.style.left = DivRef.style.left; 
		IfrRef.style.zIndex = DivRef.style.zIndex - 1;
		//alert(DivRef.style.visibility)
		if(DivRef.style.visibility=='visible')
		{
			IfrRef.style.display = "block";
			//IfrRef.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
		}
		else
		{
			IfrRef.style.display = "none"; 
		}
	} 
	else 
	{ 
		//DivRef.style.visibility = 'visible'; 
		IfrRef.style.display = "none"; 
	} 
}

