function buildHtml(){
	// cancel any outstanding timer
	if(txtLogoUrl_timerID){
		window.clearTimeout(txtLogoUrl_timerID);
	}
	txtLogoUrl_timerID = 0;

	var oForm = document.forms["oHtmlBuilderForm"];
	var sLogoName = "Secure Site";
	var sLogo = "large";
	var sCode = "SC";
	var sAutoMove = "topright";
	oForm.txtHtml.value = 
	"<!-" + "-\n" 
	+ "TrustLogo Html Builder Code:\n" 
	+ "Shows the logo at URL " + htmlEncode(oForm.txtLogoUrl.value) + "\nLogo type is " 
	+ " (\"HGLOGO\")\n"
	+ "Not Floating\n"
	+ "/" + "/" + "-" + "-" + ">\n"
	+ "<script type=\"text/javascript\">TrustLogo("
	+ "\"" + htmlEncode(oForm.txtLogoUrl.value) + "\", " 
	+ "\"HGLOGO\", "
        + "\"none\"); "
        + "\n</script>"
	 if(oForm.txtLogoUrl.value.match(/^https?\:\/\/.*\/.*/)){
  		document.images["imgLogoUrl"].src = oForm.txtLogoUrl.value;
		 }

}

// HTML-encodes certain characters.
function htmlEncode(str){
	// replace all ' with &apos; and all " with &quot;
	// also all < with &lt; and all > with &gt;
	// but first all &amp; with &amp;
	return String(str)
		.replace(/\&/g, "&amp;")
		.replace(/\</g, "&lt;")
		.replace(/\>/g, "&gt;")
		.replace(/\'/g, "&#27;")
		.replace(/\"/g, "&#22;")
		;
}


function form_onsubmit(){
	buildHtml();
}

var txtLogoUrl_timerID = 0;
function txtLogoUrl_onKeyPress(){
	if(txtLogoUrl_timerID){
		window.clearTimeout(txtLogoUrl_timerID);
		txtLogoUrl_timerID = 0;
	}
	txtLogoUrl_timerID = window.setTimeout("buildHtml();", 500);
	
}

