function launch_chat_form()
{
var chat_form_url="/rei/livehelp/memformsecure1.html?bill_safname=" + document.chk.bill_safname.value + "&amp;bill_salname=" + document.chk.bill_salname.value + "&amp;bill_saaddr1=" + document.chk.bill_saaddr1.value + "&amp;bill_sacity=" + document.chk.bill_sacity.value + "&amp;bill_sazipc=" + document.chk.bill_sazipc.value + "&amp;bill_saphone1=" + document.chk.bill_saphone1.value + "&amp;bill_saemail1=" + document.chk.bill_saemail1.value + "&amp;cm_sp=checkout*livehelp*general";
window.open(chat_form_url,"chat_form","width=600,height=425,scrollbars=1");
}

var isMemberChat;
var isServiceChat; 
var isMemberLookUpChat;
var isGearChat;
var isOrderChat;



function launchMemberChatPopup() {

	isMemberChat = 'yes';
	launchChatPopup();
}


function launchServiceChatPopup() {

	isServiceChat = 'yes';
	launchChatPopup();
}

function launchMemberLookupChatPopup() {
	isMemberLookUpChat = 'yes';
	launchChatPopup();
}


function launchGearChatPopup() {

	isGearChat = 'yes';
	launchChatPopup();
}

function launchOrderChatPopup() {

	isOrderChat = 'yes';
	launchChatPopup();
}


function launchChatPopup() {

	var winW;
	var winH;
	var newH;
	var loadPage;
	
	if (isMemberChat == 'yes'){
		loadPage = 'memformsecure1.html?cm_sp=checkout*livehelp*general';
		isMemberChat = '';
	}
	else if (isServiceChat == 'yes'){
		loadPage = 'memformsecure_service.html';
		isServiceChat = '';
	}	
	else if (isMemberLookUpChat == 'yes'){
		loadPage = 'memformsecure_member.html';
		isMemberLookUpChat = '';
	}		
	else if (isGearChat == 'yes'){
		loadPage = 'genformsecure_gear.html';
		isGearChat = '';
	}
	else if (isOrderChat == 'yes'){
		loadPage = 'genformsecure_order.html';
		isOrderChat = '';
	}	
	else {
		loadPage = 'genformsecure.html?cm_sp=checkout*livehelp*general';
	}

// set a default target height for the window in case we can't calculate one dynamically

	var targetH = 425;

// set default height and width for the screen in case we can't sniff one

	var screenW = 600;
	var screenH = 425;

// get the screen width and height to make sure we don't size things inappropriately



// get window width and height. if we get it, we reset the default target height to
// the current window height.
// first property is IE implementation, second is Moz/Gecko/Saf.
// Moz/Gecko/Saf recognize IE function, but some return bad numbers, so
// calling it second corrects the var values.



// calculate the difference in height between the screen and the window



// we only resize the window if it's too tall to display the popup...

// ...or if it's so short that we think it will need to be resized to cover the popup


// set the new window height

// resize the parent window



// now we get the parent window position and move if absolutely necessary to work well with the popup.
// if we can't get it, we'll move the window to the top left by default

	topP = 1;
	leftP = 1;

// first method Moz/Gecko (Safari?), second method IE. For IE we can only get the position of the display screen,
// so we additionally subtract the height and width of the window frame and toolbars with default installation settings.



// failsafe to correct for unfriendly IE behavior


	
// move parent window and reset it to be resizable, which is sometimes loses in IE



// set top position and tweak width for chat popup window

	var chatTopP = topP + targetH;
	var chatW = winW - 8;
        self.name = "new";
	
//	var chatUrl = httpHost + '/rei/livehelp/genformsecure.html?cm_sp=checkout*livehelp*general'; replaces the line below this for interim.
	var chatUrl = '/rei/livehelp/' + loadPage;
	var newWindow = 'chatPopup';
//	var openParams ='width=800' + chatW +',height=300, top =' + chatTopP + ', left=10' + leftP;

	var openParams ='width=600' + chatW +',height=425, top =' + chatTopP + ', left=10' + leftP + ',resizable=1,scrollbars=1';
	
	chatPopupOpen = window.open(chatUrl, newWindow, openParams);
	if(window.focus){
		chatPopupOpen.focus();
	}
}

