function submitenter(affil_id,theme_id,campaign_id,type,zipcode,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
	   {
	   return quote(affil_id,theme_id,campaign_id,type,zipcode);
	   return false;
	   }
	else
	   return true;
}

function quote(affil_id,theme_id,campaign_id,type,zipcode)
{
	var url;
	url = 'https://forms.insuranceagents.com/'+ type+ '?a='+ affil_id+ '&t='+ theme_id +'&c='+ campaign_id + '&t=1474';
		if (/^\d{5}$/.test(zipcode))
		{
			url += '&zip='+ zipcode;
		}
	window.open(url,'mywindow','fullscreen=yes,scrollbars=yes')
	document.location.href = 'http://www.renters-insurance-quotes.com/Thankyou.php?zip=' + zipcode;
	return false;
}


function ia_qb(aff_id,theme_id,campaign_id,type,version)
{
document.write("<div style=\"background-image:url(http://img.insuranceagents.com/design/img/aff/bq/"+type+version+"/i/background.gif); background-repeat:no-repeat; width:318px; height:210px; position:relative;\"><form name=\"quoteform\" id=\"quoteform\" method=\"post\" action=\"\"><table cellpadding=\"0\" cellspacing=\"0\" style=\"position:absolute; top:85px; left:28px; font-family:Arial, Helvetica, sans-serif;\"><tr><td valign=\"bottom\" style=\"padding-bottom:3px; font-size:12px; color:"); if (version=="2") document.write("#3479b4;"); else document.write("white;"); document.write("\">Zip Code</td><td style=\"padding-left:5px; padding-bottom:3px; font-size:12px; color:"); if (version=="2") document.write("#3479b4"); else document.write("white"); document.write("\" valign=\"bottom\">Type of Insurance</td></tr><tr><td><input type=\"text\" name=\"zipcode\" id=\"ia_zipcode_" + campaign_id + "\" maxlength=\"5\" style=\"font-size:16px; width:60px; height:26px; margin-right:4px; border:1px solid #9bbcd8; padding:4px\" onKeyPress=\"return submitenter('"+aff_id+"','"+theme_id+"','"+campaign_id+"',document.getElementById('ia_type_" + campaign_id + "').value,document.getElementById('ia_zipcode_" + campaign_id + "').value,event)\" /></td><td><select name=\"type\" id=\"ia_type_" + campaign_id + "\" style=\"font-size:16px; height:26px; width:180px; border:1px solid #9bbcd8; padding:2px; margin-left:5px;\" onKeyPress=\"return submitenter('"+aff_id+"','"+theme_id+"','"+campaign_id+"',document.getElementById('ia_type_" + campaign_id + "').value,document.getElementById('ia_zipcode_" + campaign_id + "').value,event)\"><option value=\"auto\""); if (type=="auto") document.write(" selected=\"selected\""); document.write(">Auto Insurance</option><option value=\"home\""); if (type=="home") document.write(" selected=\"selected\""); document.write(">Home Insurance</option><option value=\"health\""); if (type=="health") document.write(" selected=\"selected\""); document.write(">Health Insurance</option><option value=\"life\""); if (type=="life") document.write(" selected=\"selected\""); document.write(">Life Insurance</option><option value=\"condo\""); if (type=="condo") document.write(" selected=\"selected\""); document.write(">Condo Insurance</option><option value=\"renters\""); if (type=="renters") document.write(" selected=\"selected\""); document.write("> Renters Insurance</option><option value=\"annuity\""); if (type=="annuity") document.write(" selected=\"selected\""); document.write("> Annuity</option></select></td></tr><tr><td colspan=\"2\" style=\"padding-top:12px;\"><a href=\"#\" onclick=\"quote('"+aff_id+"','"+theme_id+"','"+campaign_id+"',document.getElementById('ia_type_" + campaign_id + "').value,document.getElementById('ia_zipcode_" + campaign_id + "').value)\"><img src=\"http://img.insuranceagents.com/design/img/aff/bq/"+type+version+"/i/button.gif\" alt=\"Compare Free Quotes\" border=\"0\" /></a></td></tr></table></form></div>");
}

function ia_qs(aff_id,theme_id,campaign_id,type,version)
{
document.write("<div style=\"background-image:url(http://img.insuranceagents.com/design/img/aff/sq/"+type+version+"/i/background.gif); background-repeat:no-repeat; width:215px; height:150px; position:relative;\"><form name=\"quoteform\" id=\"quoteform\" method=\"post\" action=\"\"><table cellpadding=\"0\" cellspacing=\"0\" style=\"position:absolute; top:67px; left:24px; font-family:Arial, Helvetica, sans-serif;\"><tr><td valign=\"bottom\" style=\"font-size:12px; color:"); if (version=="2") document.write("#3479b4;"); else document.write("white;"); document.write("\">Zip Code</td><td rowspan=\"2\" style=\"padding-top:16px; padding-left:5px;\"><a href=\"#\" onclick=\"quote('"+aff_id+"','"+theme_id+"','"+campaign_id+"','"+type+"',document.getElementById('ia_sm_zipcode').value)\"><img src=\"http://img.insuranceagents.com/design/img/aff/sq/"+type+version+"/i/button.gif\" alt=\"Compare Free Quotes\" border=\"0\" /></a></td></tr><tr><td><input type=\"text\" name=\"zipcode\" id=\"ia_sm_zipcode\" maxlength=\"5\" style=\"font-size:16px; width:60px; height:26px; margin-right:4px; border:1px solid #9bbcd8; padding:4px;\" onKeyPress=\"return submitenter('"+aff_id+"','"+theme_id+"','"+campaign_id+"','"+type+"',document.getElementById('ia_sm_zipcode').value,event)\" /></td></tr></table></form></div>");
}
