function windowOpenCQAR(url)
{
	var w = "792";
	var h = 528;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var args = 'status=yes, resizable=yes, scrollbars=yes,height='+h+',width='+w+',top='+wint+',left='+winl	
	var win = window.open( url, 0, args );
	if (win)
	{
		win.focus();
	}
	else
	{
		alert("Error#1: Unable to focus window.");
	}
}

function windowOpenOLS(url)
{
	windowprops = "height=600,width=800,location=yes,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes";
	window.open(url, "Popup", windowprops);
}

function isInteger (s)
{
	var i;
	if (isEmpty(s))
		if (isInteger.arguments.length == 1) return false;
		else return (isInteger.arguments[1] == true);
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (!isDigit(c)) return false;
	}
	return true;
}

function isDigit (c)
{
	return ((c >= '0') && (c <= '9'))
}

function isEmpty(s)
{
	return ((s == null) || (s.length == 0))
}

function validateAndSend ()
{
	var agentcd;
	agentcd=getDriveCode();

	var elem = document.getElementById('drvzip5fld');

	if((elem.value.length ==5)&&(isInteger(elem.value)))
	{
		windowOpenCQAR('http://www.driveinsurance.com/redirect/pg_banner.aspx?action=qt&agt_cd=' + agentcd + '&insd_zip_cd=' + elem.value + '');
	}
	else
	{
		alert("Zip code must be 5 digits long (No non numeric characters allowed).");
		elem.focus();
		elem.select();

	}
	return false;
}
