/**

 * POPUP WINDOW CODE

 * Used for displaying DHTML only popups instead of using buggy modal windows.

 *

 * By Seth Banks (webmaster at subimage dot com)

 * http://www.subimage.com/

 *

 * Contributions by Eric Angel (tab index code) and Scott (hiding/showing selects for IE users)

 *

 * Up to date code can be found at http://www.subimage.com/dhtml/subModal

 *

 * This code is free for you to use anywhere, just keep this comment block.
 
 * 2007

 */



// Popup code

var gPopupMask = null;

var gPopupContainer = null;

var gPopFrame = null;

var gReturnFunc;

var gPopupIsShown = false;



var gHideSelects = false;


//New variable for POD signin

var podPers = false;


var gTabIndexes = new Array();

// Pre-defined list of tags we want to disable/enable tabbing into

var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");	



// If using Mozilla or Firefox, use Tab-key trap.

if (!document.all) {

	document.onkeypress = keyDownHandler;

}



/**

 * Initializes popup code on load.	

 */

function initPopUp() {
	gPopupMask = document.getElementById("popupMask");

	gPopupContainer = document.getElementById("popupContainer");

	gPopFrame = document.getElementById("popupFrame");	

	//Start modification for RT37543 by IBM
	gPopupContainer.style.marginTop	= "42px";
	//End modification for RT37543 by IBM	

	// check to see if this is IE version 6 or lower. hide select boxes if so

	// maybe they'll fix this in version 7?

	var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);

	if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {

		gHideSelects = true;

	}

}

//addEvent(window, "load", initPopUp);

if (window.attachEvent) 
  {
  	window.attachEvent("onload", initPopUp);
  }
  else
  {
  	window.addEventListener('load', initPopUp,false);
  }



 /**

	* @argument width - int in pixels

	* @argument height - int in pixels

	* @argument url - url to display

	* @argument returnFunc - function to call when returning true from the window.

	*/

function photoCardPopup(url, width, height, returnFunc) {

	podPers = true;
	gPopupIsShown = true;

	disableTabIndexes();

	gPopupMask.style.display = "block";

	gPopupContainer.style.display = "block";

	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	
	gPopupContainer.style.top = 200;
	gPopupContainer.style.left = 360;

	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);

	

	gPopupContainer.style.width = width + "px";

	gPopupContainer.style.height = (height+titleBarHeight) + "px";


	// need to set the width of the iframe to the title bar width because of the dropshadow

	// some oddness was occuring and causing the frame to poke outside the border in IE6

	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";

	gPopFrame.style.height = (height) + "px";

	

	// set the url

	gPopFrame.src = url;

	

	gReturnFunc = returnFunc;

	// for IE

	if (gHideSelects == true) {

		hideSelectBoxes();

	}

	

	window.setTimeout("setPopTitle();", 600);
	//document.getElementById("popupTitleBar").style.display="none";
	
	floatingButton('popupTitleBar');
	if (gPopupIsShown == true) {

		if (width == null || isNaN(width)) {

			width = gPopupContainer.offsetWidth;

		}

		if (height == null) {

			height = gPopupContainer.offsetHeight;

		}

		var fullHeight = getViewportHeight();

		var fullWidth = getViewportWidth();

	
			//scTop = 0;
	
		//scLeft = 0;
		
		var scLeft;
		var scTop;
		
		browserName = navigator.appName;
		if (browserName == "Microsoft Internet Explorer") 
		{
			var theBody = document.documentElement;
			scTop = parseInt(theBody.scrollTop,10);
			scLeft = parseInt(theBody.scrollLeft,10);
			if(scTop == 0)
			{
				var tempBody = document.body;
				//alert(tempBody);
				//alert(tempBody.scrollTop);
				//alert(tempBody.scrollLeft);			
				scTop = tempBody.scrollTop;
			}
		} 
		else 
		{
			scTop = parseInt(window.pageYOffset,10);
			scLeft = parseInt(window.pageXOffset,10);
		}
		
		//alert("scTop" + scTop);
		//alert("scLeft"+scLeft);

		gPopupMask.style.height = fullHeight + "px";

		gPopupMask.style.width = fullWidth + "px";

		gPopupMask.style.top = scTop + "px";

		gPopupMask.style.left = scLeft + "px";

		

		window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;

		
		var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);

		if(isNaN(titleBarHeight))
		{
			titleBarHeight = 0;
		}
		gPopupContainer.style.top = 194;
		gPopupContainer.style.left = 260;
	}

	
}


function showPopWin(url, width, height, returnFunc) {

	gPopupIsShown = true;

	disableTabIndexes();
	// Start RT-36235 by IBM for email validation
	if(gPopupMask!=null)
	{
	gPopupMask.style.display = "block";
	}
	// End RT-36235 by IBM for email validation
	gPopupContainer.style.display = "block";

	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen

	centerPopWin(width, height);

	

	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);

	

	gPopupContainer.style.width = width + "px";

	gPopupContainer.style.height = (height+titleBarHeight) + "px";


	// need to set the width of the iframe to the title bar width because of the dropshadow

	// some oddness was occuring and causing the frame to poke outside the border in IE6

	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";

	gPopFrame.style.height = (height) + "px";

	

	// set the url

	gPopFrame.src = url;

	

	gReturnFunc = returnFunc;

	// for IE

	if (gHideSelects == true) {

		hideSelectBoxes();

	}

	
	window.setTimeout("setPopTitle();", 600);
	//document.getElementById("popupTitleBar").style.display="none";
	
	floatingButton('popupTitleBar');

}

//Start of Modification by Infosys for 37317
function showPopPreviewWin(url, width, height, returnFunc)
 {

	// Start of changes on 11-Mar-2009
	initPopUp();
	// End of changes on 11-Mar-2009
	gPopupIsShown = true;

	disableTabIndexes();
	// Start RT-36235 by IBM for email validation
	if(gPopupMask!=null)
	{
	gPopupMask.style.display = "block";
	}

	//Start RT38721 modification by Infosys

	//Set the URL
	gPopFrame.src = url;

	// End RT-36235 by IBM for email validation
	gPopupContainer.style.display = "block";

	//document.getElementById("popupTitleBar").style.display="none";
	// calculate where to place the window on screen

	centerPopWin(width, height);

	

	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);

	var titleBarHeight = 0;

	gPopupContainer.style.width = width + "px";

	gPopupContainer.style.height = (height) + "px";


	// need to set the width of the iframe to the title bar width because of the dropshadow

	// some oddness was occuring and causing the frame to poke outside the border in IE6

	gPopFrame.style.width = width + "px";

	gPopFrame.style.height = (height) + "px";

	
	// set the url

	//gPopFrame.src = url;
	//End RT38721 modification by Infosys

	

	gReturnFunc = returnFunc;

	// for IE

	if (gHideSelects == true) {

		hideSelectBoxes();

	}

	
	window.setTimeout("setPopTitle();", 600);
	document.getElementById("popupTitleBar").style.display="none";
	
	//floatingButton('popupTitleBar');

}

//End of Modification by Infosys for 37317


/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */

/* Start of Modification by Infosys - RT 33807 - 02/12/2008 */
// Seperate JavaScript function for ECards for addressing Mac Safari 2.0.4 browser issue
function showPopWinforECard(url, width, height, returnFunc) {
	initPopUp();
	try
	{
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
	catch(e)
	{
		if(document.getElementById("pageMask"))
		{
			document.body.style.overflow='auto';
			document.getElementById("pageMask").style.display = "none" ;
		}
	}
}
/* End of Modification by Infosys - RT 33807 - 02/12/2008 */
function showPopWinforPersonalization(url, width, height, returnFunc) {
	initPopUp();
	try
	{
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWinForPers(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupInner = document.getElementById("popupInner");
	gPopupInner.style.width = width + "px";
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";

	
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
	}
	catch(e)
	{
		if(document.getElementById("pageMask"))
		{
			document.body.style.overflow='auto';
			document.getElementById("pageMask").style.display = "none" ;
		}
	}
}
//Start of modification by Infosys for RT37078
function showPopWinforAddressBook(url, width, height, returnFunc) {
	gPopupIsShown = true;
	disableTabIndexes();
	gPopupMask.style.display = "block";
	gPopupContainer.style.display = "block";
	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen
	centerPopWin(width, height);
	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";
	gPopupContainer.style.height = (height+titleBarHeight) + "px";
	// need to set the width of the iframe to the title bar width because of the dropshadow
	// some oddness was occuring and causing the frame to poke outside the border in IE6
	gPopFrame.style.width = (width) + "px";
	gPopFrame.style.height = (height) + "px";
	// set the url
	gPopFrame.src = url;
	gReturnFunc = returnFunc;
	// for IE
	if (gHideSelects == true) {
		hideSelectBoxes();
	}
	floatingButton('popupTitleBar');
}
//End of modification by Infosys for RT37078

function floatingButton(relImg) {
		 var elemFontEdit = document.getElementById('floatingButton');
		 var elemRelImg = document.getElementById( relImg );
		 elemRelImg.getTrueXPosition = DL_GetElementLeft;
		 elemRelImg.getTrueYPosition = DL_GetElementTop;
		 //elemFontEdit.style.position = 'absolute';
		 //elemFontEdit.style.top = elemRelImg.getTrueYPosition() + 100 + 'px';
		 //elemFontEdit.style.left = elemRelImg.getTrueXPosition() + 100 + 'px';
		 //elemFontEdit.style.zIndex = '1000';
	 }

function DL_GetElementLeft(eElement)
	{
	   if (!eElement && this)                    // if argument is invalid
	   {                                         // (not specified, is null or is 0)
		  eElement = this;                       // and function is a method
	   }                                         // identify the element as the method owner
	
	   var DL_bIE = document.all ? true : false; // initialize var to identify IE
	
	   var nLeftPos = eElement.offsetLeft;       // initialize var to store calculations
	   var eParElement = eElement.offsetParent;  // identify first offset parent element
	
	   while (eParElement != null)
	   {                                         // move up through element hierarchy
		  if(DL_bIE)
		  {
			 if(eParElement.tagName == "TD")     // if parent a table cell, then...
			 {
				nLeftPos += eParElement.clientLeft; // append cell border width to calcs
			 }
		  }
	
		  nLeftPos += eParElement.offsetLeft;    // append left offset of parent
		  eParElement = eParElement.offsetParent; // and move up the element hierarchy
	   }                                         // until no more offset parents exist
	   return nLeftPos;                          // return the number calculated
	}
	
	function DL_GetElementTop(eElement)
	{
	   if (!eElement && this)                    // if argument is invalid
	   {                                         // (not specified, is null or is 0)
		  eElement = this;                       // and function is a method
	   }                                         // identify the element as the method owner
	
	   var DL_bIE = document.all ? true : false; // initialize var to identify IE
	
	   var nTopPos = eElement.offsetTop;       // initialize var to store calculations
	   var eParElement = eElement.offsetParent;  // identify first offset parent element
	
	   while (eParElement != null)
	   {                                         // move up through element hierarchy
		  if(DL_bIE)
		  {
			 if(eParElement.tagName == "TD")     // if parent a table cell, then...
			 {
				nTopPos += eParElement.clientTop; // append cell border width to calcs
			 }
		  }
	
		  nTopPos += eParElement.offsetTop;    // append top offset of parent
		  eParElement = eParElement.offsetParent; // and move up the element hierarchy
	   }                                         // until no more offset parents exist
	   return nTopPos;                          // return the number calculated
	}

//

var gi = 0;

function centerPopWin(width, height) {
	if (podPers)
	{
		return;
	}
	podPers = false;
	if (gPopupIsShown == true) {
		browserName = navigator.appName;
		//Start of Modification by Infosys for RT37927 - TMEII
		if(navigator.appVersion.indexOf("MSIE 7") == -1)
		//if (browserName != "Microsoft Internet Explorer") 
		{
			window.document.documentElement.style.overflow='auto';
			document.body.style.overflow='auto';
		}
		//End of Modification by Infosys for RT37927 - TMEII

		if (width == null || isNaN(width)) {

			width = gPopupContainer.offsetWidth;

		}

		if (height == null) {

			height = gPopupContainer.offsetHeight;

		}

		

		var fullHeight = getViewportHeight();

		var fullWidth = getViewportWidth();

	
			//scTop = 0;
	
		//scLeft = 0;
		
		var scLeft;
		var scTop;
		
		browserName = navigator.appName;
		if (browserName == "Microsoft Internet Explorer") 
		{
			var theBody = document.documentElement;
			scTop = parseInt(theBody.scrollTop,10);
			scLeft = parseInt(theBody.scrollLeft,10);
			if(scTop == 0)
			{
				var tempBody = document.body;
				//alert(tempBody);
				//alert(tempBody.scrollTop);
				//alert(tempBody.scrollLeft);			
				scTop = tempBody.scrollTop;
			}
		} 
		else 
		{
			scTop = parseInt(window.pageYOffset,10);
			scLeft = parseInt(window.pageXOffset,10);
		}
		
		//alert("scTop" + scTop);
		//alert("scLeft"+scLeft);

		gPopupMask.style.height = fullHeight + "px";

		gPopupMask.style.width = fullWidth + "px";

		gPopupMask.style.top = scTop + "px";

		gPopupMask.style.left = scLeft + "px";

		

		window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;

		

		var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
		//Start of Modification by Infosys for RT37927 - TMEII
//		var titleHeight = parseInt(document.getElementById("popupTitle").offsetHeight, 10);
	//	if(titleHeight>titleBarHeight)titleBarHeight=titleHeight;
		//End of Modification by Infosys for RT37927 - TMEII
		if(isNaN(titleBarHeight))
		{
			titleBarHeight = 0;
		}

		gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px";

		gPopupContainer.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
		
		//alert("top: "+gPopupContainer.style.top+"left: "+gPopupContainer.style.left);

		//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);

		//alert("height: " + fullHeight + " " + "fullWidth:" + fullWidth);
		//Start of Modification by Infosys for RT37927 - TMEII
		window.document.documentElement.style.overflow='hidden';
		document.body.style.overflow='hidden';
		//End of Modification by Infosys for RT37927 - TMEII
	}
}


function centerPopWinForPers(width, height) {
	podPers = true;
	if (gPopupIsShown == true) {
		browserName = navigator.appName;
		//Start of Modification by Infosys for RT37927 - TMEII

		//End of Modification by Infosys for RT37927 - TMEII

		if (width == null || isNaN(width)) {

			width = gPopupContainer.offsetWidth;

		}

		if (height == null) {

			height = gPopupContainer.offsetHeight;

	}

		

		var fullHeight = getViewportHeight();

		var fullWidth = getViewportWidth();

	
			//scTop = 0;
	
		//scLeft = 0;
		
		var scLeft;
		var scTop;
		
		browserName = navigator.appName;
		if (browserName == "Microsoft Internet Explorer") 
		{
			var theBody = document.documentElement;
			scTop = parseInt(theBody.scrollTop,10);
			scLeft = parseInt(theBody.scrollLeft,10);
			if(scTop == 0)
			{
				var tempBody = document.body;
				//alert(tempBody);
				//alert(tempBody.scrollTop);
				//alert(tempBody.scrollLeft);			
				scTop = tempBody.scrollTop;
}
		} 
		else 
		{
			scTop = parseInt(window.pageYOffset,10);
			scLeft = parseInt(window.pageXOffset,10);
		}
		
		//alert("scTop" + scTop);
		//alert("scLeft"+scLeft);

		gPopupMask.style.height = fullHeight + "px";

		gPopupMask.style.width = fullWidth + "px";

		gPopupMask.style.top = scTop + "px";

		gPopupMask.style.left = scLeft + "px";

		

		window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;

		

		var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
		//Start of Modification by Infosys for RT37927 - TMEII
//		var titleHeight = parseInt(document.getElementById("popupTitle").offsetHeight, 10);
	//	if(titleHeight>titleBarHeight)titleBarHeight=titleHeight;
		//End of Modification by Infosys for RT37927 - TMEII
		if(isNaN(titleBarHeight))
		{
			titleBarHeight = 0;
		}

		gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px";

		gPopupContainer.style.left =  (scLeft + ((fullWidth - width) / 2)) + "px";
		
		//alert("top: "+gPopupContainer.style.top+"left: "+gPopupContainer.style.left);

		//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);

		//alert("height: " + fullHeight + " " + "fullWidth:" + fullWidth);
		//Start of Modification by Infosys for RT37927 - TMEII
		//End of Modification by Infosys for RT37927 - TMEII
	}
}
//addEvent(window, "resize", centerPopWin);

/*if (window.attachEvent) 
  {
  	window.attachEvent("onresize", centerPopWin);
  }
  else
  {
  	window.addEventListener("resize", centerPopWin,false);
  }
*/
//addEvent(window, "scroll", centerPopWin);

window.onscroll = centerPopWin;


/**

 * @argument callReturnFunc - bool - determines if we call the return function specified

 * @argument returnVal - anything - return value 

 */

function hidePopWin(callReturnFunc) {

	gPopupIsShown = false;


	restoreTabIndexes();

	gPopupMask = document.getElementById("popupMask");
	gPopupContainer = document.getElementById("popupContainer");
	//gPopFrame = document.getElementById("popupFrame");	
	
	if (gPopupMask == null) {

		return;

	}
	gPopupMask.style.display = "none";

	gPopupContainer.style.display = "none";
	//Start of Modification by Infosys for RT37927 - TMEII
	if (!podPers)
	{
		document.body.style.overflow='auto';
		window.document.documentElement.style.overflow='auto';
	}
	//End of Modification by Infosys for RT37927 - TMEII
	if (callReturnFunc == true && gReturnFunc != null) {
		gReturnFunc(window.frames["popupFrame"].returnVal);
	}
	gPopFrame = document.getElementById("popupFrame");
	gPopFrame.src = 'HallmarkStore/Membership/Loading.jsp';

	// display all select boxes

	if (gHideSelects == true) {

		displaySelectBoxes();

	}

}



/**

 * Sets the popup title based on the title of the html document it contains.

 * Uses a timeout to keep checking until the title is valid.

 */

function setPopTitle() {

	if (window.frames["popupFrame"].document.title == null) {

		window.setTimeout("setPopTitle();", 10);

	} else {

		document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title;

	}

}



// Tab key trap. iff popup is shown and key was [TAB], suppress it.

// @argument e - event - keyboard event that caused this function to be called.

function keyDownHandler(e) {

    if (gPopupIsShown && e.keyCode == 9)  return false;

}



// For IE.  Go through predefined tags and disable tabbing into them.

function disableTabIndexes() {

	if (document.all) {

		var i = 0;

		for (var j = 0; j < gTabbableTags.length; j++) {

			var tagElements = document.getElementsByTagName(gTabbableTags[j]);

			for (var k = 0 ; k < tagElements.length; k++) {

				gTabIndexes[i] = tagElements[k].tabIndex;

				tagElements[k].tabIndex="-1";

				i++;

			}

		}

	}

}



// For IE. Restore tab-indexes.

function restoreTabIndexes() {

	if (document.all) {

		var i = 0;

		for (var j = 0; j < gTabbableTags.length; j++) {

			var tagElements = document.getElementsByTagName(gTabbableTags[j]);

			for (var k = 0 ; k < tagElements.length; k++) {

				tagElements[k].tabIndex = gTabIndexes[i];

				tagElements[k].tabEnabled = true;

				i++;

			}

		}

	}

}





/**

* Hides all drop down form select boxes on the screen so they do not appear above the mask layer.

* IE has a problem with wanted select form tags to always be the topmost z-index or layer

*

* Thanks for the code Scott!

*/

function hideSelectBoxes() {

	/*for(var i = 0; i < document.forms.length; i++) {

		for(var e = 0; e < document.forms[i].length; e++){

			if(document.forms[i].elements[e].tagName == "SELECT") {

				document.forms[i].elements[e].style.visibility="hidden";

			}

		}

	}*/
	var selectBoxes = document.getElementsByTagName("SELECT");
	for(var e = 0; e < selectBoxes.length; e++){

				selectBoxes[e].style.visibility="hidden";

	}

}



/**

* Makes all drop down form select boxes on the screen visible so they do not reappear after the dialog is closed.

* IE has a problem with wanted select form tags to always be the topmost z-index or layer

*/

function displaySelectBoxes() {

	/*for(var i = 0; i < document.forms.length; i++) {

		for(var e = 0; e < document.forms[i].length; e++){

			if(document.forms[i].elements[e].tagName == "SELECT") {

			document.forms[i].elements[e].style.visibility="visible";

			}

		}

	}*/
	
	var selectBoxes = document.getElementsByTagName("SELECT");
	for(var e = 0; e < selectBoxes.length; e++){

				selectBoxes[e].style.visibility="visible";

			}

}

function showPopSignInWin(url, width, height, returnFunc) {
	

	gPopupIsShown = true;

	disableTabIndexes();
	// Start RT-36235 by IBM for email validation
	if(gPopupMask!=null)
	{
	gPopupMask.style.display = "block";
	}
	// End RT-36235 by IBM for email validation
	gPopupContainer.style.display = "block";

	document.getElementById("popupTitleBar").style.display="block";
	// calculate where to place the window on screen

	centerPopWin(width, height);

	

	var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10);
	gPopupContainer.style.width = width + "px";

	gPopupContainer.style.height = height + "px";

	// need to set the width of the iframe to the title bar width because of the dropshadow

	// some oddness was occuring and causing the frame to poke outside the border in IE6
	
	
	document.getElementById("popupTitle").innerHTML = "";
	document.getElementById("popupTitleBar").style.width = width + "px" ;
	document.getElementById("popupInner").style.width = width + "px" ;
	
	//gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px";
	gPopFrame.style.width = width + "px";
	
	gPopFrame.style.height = (height) + "px";

	
	// set the url

	gPopFrame.src = url;

	

	gReturnFunc = returnFunc;

	// for IE

	if (gHideSelects == true) {

		hideSelectBoxes();

}

	
	window.setTimeout("setPopTitle();", 600);
	//document.getElementById("popupTitleBar").style.display="none";
	
	floatingButton('popupTitleBar');

}
