/*
BEGIN configuration Script
*/


lpUASimagesPath = "/creditcards/chat_deployment_local-card/images";

lpdbButtonImageHeight = "16";

lpdbButtonImageWidth = "177";


if (typeof(lpUASlanguage)=="undefined") lpUASlanguage = "english";


if (typeof(lpUASunit)=="undefined") lpUASunit = "card";

if (typeof(lpUASunit_Type)=="undefined"){
	lpUASunit_Type = "card_regular";

	lpdbRedirectActionURLSuffix="&SESSIONVAR!S_Unit_Type=card_regular";
}

if(typeof(lpUASimagesFolder)=="undefined"){

	lpUASimagesFolder = "card-" + lpUASlanguage;

}

var lpUAScontext = document.title;


var lpUASinvitePositionX = 347;

/* WR25525 Reduced the position from the top by 20 pixels. Previous value 314 */
var lpUASinvitePositionY = 294;


var lpUASbuttonTitle = "Live Chat";

var lpUASinvitationTitle="Invitation popup window for live chat with a sales representative";

var lpUASinvitationCloseTitle="Close chat invitation";


var lpUASalternateButtonImageName = "repoffline.gif";


function lpUASalternateButtonFunction(){

	window.open("https://www.bankofamerica.com/contact/?lob=cc_sales&contact_returnto=h","BOFAbusyOfflineWin");

}

/* 
NOTE: Optional - Define width and height for button image 
      In the code below you may provide configuration-specific button image height/width (in pixels)	
*/
if (typeof(lpdbButtonImageHeight)=="undefined" || lpdbButtonImageHeight.indexOf('<')>=0)
	lpdbButtonImageHeight = "16";
if (typeof(lpdbButtonImageWidth)=="undefined" || lpdbButtonImageWidth.indexOf('<')>=0)
	lpdbButtonImageWidth = "177";

/*
END configuration Script
*/
	
function showHide(obj,action){
	
	var obj    = arguments[0];
	var action = arguments[1];
	obj = document.getElementById(obj);

	if(arguments.length == 1){
				
		if(document.layers)
			var display = obj.style.visibility ? 'show' : 'hide';
		else
			var display = obj.style.display ? '' : 'none';
		obj.style.display = display;
	}else{
		if(document.layers){	
			
			if(action == 'show')
				obj.style.visibility='show';
			else		
				obj.style.visibility='hide';
		}else{	
			
			if(action == 'show')
				obj.style.display='';
			else		
				obj.style.display='none';
		}		
	}
}

function toggleLPModule(){
	if(document.getElementById('hcDynamicIcon').src.indexOf('reponline') == -1){
		showHide('LP_MODULE','hide');
	}else{
		showHide('LP_MODULE','show');
	}		
	return void(0);
}

function checkLPImage(timesChecked, imageStyle, debugliveperson){	
 
	if(document.getElementById('LP_MODULE') != null){

		if(debugliveperson == 'yes'){
			alert(document.getElementById('hcDynamicIcon').src);
		}

		t = timesChecked + 1;
		var imgLoadTimeout = 30; // seconds	
		var imgCheck = 1; 		 // seconds

		// if the reponline image is loaded display the text chat module.
		// only execute on first call to function.
		if(timesChecked == 0){
			if(imageStyle == 'inline'){
				setLPInlineModule();
			}
			toggleLPModule();
		}
	 
		if(document.getElementById('hcDynamicIcon').src.indexOf('reponline') == -1){
			if(t <= imgLoadTimeout){
				// if the transparent image is returned and within timeout range check again for final image in x seconds.				
				setTimeout('checkLPImage(t, ' + '\'' + imageStyle + '\'' + ', ' + '\'' + debugliveperson + '\'' + ')', imgCheck*1000);				
			}
		}else{
			// if the reponline image is loaded display the text chat module.			
			if(imageStyle == 'inline'){
				setLPInlineModule();
			}
			toggleLPModule();			
		}
		
	}else{
		return void(0);
	}
}

function setLPInlineModule(){
	
	/* 12/14/2005 - Commented in case we need to re-use later.
	if (document.getElementById('hcDynamicIcon').src.indexOf('transparent') != -1){
		lpUASCustomButtonImageName = "repoffline-inline.gif";
		lpdbCustomButtonImageHeight = "16";
		lpdbCustomButtonImageWidth = "118";
	}else{
		if (document.getElementById('hcDynamicIcon').src.indexOf('reponline') != -1){
			lpUASCustomButtonImageName = 'reponline-inline.gif';
			lpdbCustomButtonImageHeight = "16";
			lpdbCustomButtonImageWidth = "93";
		}else if(document.getElementById('hcDynamicIcon').src.indexOf('repoffline') != -1 || document.getElementById('hcDynamicIcon').src.indexOf('repoccupied') != -1){
			if(document.getElementById('hcDynamicIcon').src.indexOf('repoffline') != -1){
				lpUASCustomButtonImageName = 'repoffline-inline.gif';
			}else{
				lpUASCustomButtonImageName = 'repoccupied-inline.gif';
			}
			lpdbCustomButtonImageHeight = "16"; 
			lpdbCustomButtonImageWidth = "118"; 
		}
	}
		 
	document.getElementById('hcDynamicIcon').src = lpUASimagesPath + "/" + lpUASbuttonImagesFolder + "/" + lpUASCustomButtonImageName;
	document.getElementById('hcDynamicIcon').height = lpdbCustomButtonImageHeight;
	document.getElementById('hcDynamicIcon').width = lpdbCustomButtonImageWidth;
	document.getElementById('hcDynamicIcon').style.marginTop = '0px';
	document.getElementById('hcDynamicIcon').style.marginBottom = '0px';
	*/
	
	if (document.getElementById('hcDynamicIcon').src.indexOf('reponline') != -1){
	
		document.getElementById('hcDynamicIcon').src = lpUASimagesPath + "/" + lpUASbuttonImagesFolder + "/" + 'reponline-inline.gif';
		document.getElementById('hcDynamicIcon').height = "16";
		document.getElementById('hcDynamicIcon').width = "93";
		document.getElementById('hcDynamicIcon').style.marginTop = '0px';
		document.getElementById('hcDynamicIcon').style.marginBottom = '0px';		
		
	}
	
}