var fullname = '';
var email = '';
var state = '';
var vehicle = '';
var mileage = '';
var leadid = '';

function openChatWindow()
{
	var w=490;
	var h=404;
	var l=(screen.availWidth-w)/2;
	var t=(screen.availHeight-h)/3;
	var f = 'left='+l+',top='+t+',width='+w+',height='+h+',toolbar=0,location=0,directories=0,menubar=0,status=0,scrollbars=0,resizable=0,replace=0';
	var url = 'https://chat.smartautowarranty.com:446/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=1&queueID=1';
	url += '&fullname=' + escape(fullname);
	url += '&email=' + escape(email);
	url += '&state=' + escape(state);
	url += '&vehicle=' + escape(vehicle);
	url += '&mileage=' + escape(mileage);
	url += '&leadid=' + escape(leadid);
	url += '&autosubmit=true';
	var win_chat = window.open(url, 'chatWindow', f);
	win_chat.focus();
}

function popup(url, windowName, width, height)
{
	if (windowName==null) windowName = '_blank';
	if (width==null) width=612;
	if (height==null) height=300;
	if (width==0) width=document.body.offsetWidth;
	if (height==0) height=document.body.offsetHeight;
	if (width>screen.availWidth-16) width=screen.availWidth-16;
	if (height>screen.availHeight-24) width=screen.availHeight-24;
	var left   = (screen.availWidth - width) / 2;
	var top    = (screen.availHeight - height) / 3;

	var popup = window.open(
		url,
		windowName,
		'left=' + left + ',top=' + top + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=no,toolbar=no,location=no',
		'replace = true'
	);
	if (popup==null) alert('You must allow popup windows for this site.');
	else popup.focus();
}



