// popup from /find-realtor/, /real-estate/realtors/, and /ssl/find-house/
function cashAwardFaq() {
	window.open('/popup/cash-award-faq/','','width=600,scrollbars,resizable');
}

// popup from /find-realtor/, /real-estate/realtors/, and /ssl/find-house/
function howItWorks() {
	window.open('/popup/find-realtor-howitworks/','','width=580,scrollbars,resizable');
}

// popup from /ssl/find-house/?type=sell
function howItWorksSell() {
	window.open('popup/how-it-works-sell/','','width=580,scrollbars,resizable')
}	

// popup from /find-realtor/ and /real-estate/realtors/
function liveHelp() {
	window.open('/popup/live-help/','','width=700,scrollbars,resizable');
}

// popup from Customer testimonials sidebar on /find-realtor/
function moreQuotes() {
	window.open('/popup/find-realtor-testimonials/','','scrollbars,resizable,width=600,height=550');
}

// popup from /find-realtor/ and /ssl/find-house/
function prescreenedNote() {
	window.open('/popup/prescreened-realtor/','','scrollbars,resizable,width=600,height=550');
}

// popup from /find-house/ and /find-realtor/
function realtorTestimonials() {
	window.open('/popup/find-realtor-testimonials/','','scrollbars,resizable,width=600,height=550');
}


function buySellRedirect() {
	var f = document.getElementById("form1");
	var dest = "";
	
	var queryString = "&pg=" + ((f.pg && f.pg.value != "") ? f.pg.value : "index") +
		((f.c && f.c.value != "") ? "&c="+f.c.value : "") +
		((f.s && f.s.value != "") ? "&s="+f.s.value : "") +
		((f.nbr && f.nbr.value != "") ? "&nbr="+f.nbr.value : "") +
		((f.polyid && f.polyid.value != "") ? "&polyid="+f.polyid.value : "");		
	
	try {
		if (f.dest[0].checked) //buy
			window.location.href = "/ssl/find-house/?type=buy"+queryString;
		else if (f.dest[1].checked) //sell         
			window.location.href = "/ssl/find-house/?type=sell"+queryString;
			else if (f.dest[2].checked) //both
			window.location.href = "/ssl/find-house/?type=both"+queryString;
		else
			alert("Please select an option above.");
	 } catch (e) {
		alert("An error has occured. Please reload the page and try again.");
	 }
	 
	return false;
}
