function openPopupWindow(title, text){
	var formatText = "width=455,height=455,scrollbars=yes"
	tipwin = window.open("","productshot",formatText);
	var htmlText = "<html><head><title>" + title +
  "</title><style type=\"text/css\">@import url(/css/global.css);@import url(/css/content.css); div#content {width:400px;}</style><body><div id=\"content\"><br><h1>"
  +title+"</h1><div class=hr></div><p>"+text+"</p><a href=\'JavaScript:window.close()\'><img src=/img/buttons/return_to_advisor.gif border=0></a></div></body></html>";
	tipwin.document.write(htmlText);

	if (document.images){tipwin.focus()};
	tipwin.document.close();
}

function submitClosest() {
	document.closest.submit();
}

function submitSortForm() {
	document.sort.submit();
}

function GoVendorUrl(url,prodId, catId, bankId, productName, bankName) {

	if(catId!=2 && url.search(/wellsfargo.com/i)>0){
	  tipwin = window.open("","productshot","width=455,height=455,scrollbars=auto");
		var htmlText = "<html><head><title>Proceed?</title><style type=\"text/css\">@import url(/css/global.css);@import url(/css/content.css); div#content {width:400px;}</style><body><div id=\"content\"><br><h1>"
    +"<img src=\"/img/logo_visa.gif\" width=\"67\" height=\"39\" alt=\"usa.visa.com\" /></h1><div class=hr></div><p>"
			+"<b>Note: The online application for Wells Fargo is available only to individuals who have an existing Wells Fargo banking relationship.</b>"
			+"<!-- BEGIN: AARF Beacon  -->"
			+"<!-- DESC: VisaMediaCenter - Generic -->"
			+"<script language=JavaScript> var NTPT_PGEXTRA = 'desc=CardAdvisorInterstitial&productId="+escape(prodId)+"&categoryId="+escape(catId)+"&bankId="+escape(bankId)+"&productName="+escape(productName)+"&displayBankName="+escape(bankName)+"&url="+escape(url)+"';</script"
			+"><script language=JavaScript src=https://usa.visa.com/trk/js/aarfbc.js></script"
			+"><!-- END: AARF Beacon GEN:Manual1 -->"
			+"<form name=apply action=jsp/personal/card_apply.jsp target=productWindow>"
			+"<input type=hidden name=productId value='"+prodId+"'><input type=hidden name=categoryId value='"+catId+"'><input type=hidden name=bankId value='"+bankId+"'>"
			+"<input type=hidden name=productName value='"+productName+"'><input type=hidden name=displayBankName value='"+bankName+"'><input type=hidden name=url value='"+url+"'></form>"
			+"</p><a href=\'JavaScript:document.apply.submit();window.close();\'><img src=/img/buttons/continue.gif border=0 class=imgover></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'JavaScript:window.close()\'><img src=/img/buttons/return_to_advisor.gif border=0 valign=top></a></div></body></html>";
		tipwin.document.open("text/html", "replace");
		tipwin.document.write(htmlText);
		tipwin.document.close();
	}else{
		document.apply.url.value = url;
		document.apply.productId.value = prodId;
		document.apply.categoryId.value = catId;
		document.apply.bankId.value = bankId;
		document.apply.productName.value = productName;
		document.apply.displayBankName.value = bankName;
	  document.apply.submit();
	}	
}
		
function clearForm() {
    // clear "state" dropdown
	document.f.QP1.selectedIndex = 0;
	// clear credit history radio buttons
    for(var i = 0; i < document.f.QP4.length; i++) {
        document.f.QP4[i].checked = false;
    }
	// clear rewards checkboxes
    for(i = 0; i < document.f.QP2.length; i++) {
        document.f.QP2[i].checked = false;
    }
	// clear credit card use checkboxes
    for(i = 0; i < document.f.QP3.length; i++) {
        document.f.QP3[i].checked = false;
    }
}		