function checkUsernameAvailability() {
	/* IE Cache Issue: To prevent chace problem with Internet Explorer */
	var nocache=0;
	nocache=Math.random();

	/* This line code use the encodeURI() metod that solve the IE issue tied to wrong encoding special characters passad from a coldfusion page to a javascript variable.*/
	var Username = encodeURI(document.getElementById('Username').value);
	var UserId = (document.getElementById('UserId') != null)?encodeURI(document.getElementById('UserId').value):0;
	http.open('get', 'ajax-helpers/check-username-availability.cfm?Username=' + Username + '&UserId=' + UserId + '&nocache=' + nocache);
	document.getElementById('UsernameAvailabilityResponse').innerHTML = "Checking...";
	http.onreadystatechange = checkUsernameAvailabilityResponse;
	http.send(null);
}
/* load the query result into the layer ajaxResponse */
function checkUsernameAvailabilityResponse() {
	if(http.readyState == 4){
		var response=http.responseText;
		document.getElementById('UsernameAvailabilityResponse').innerHTML = response;
	}	
}


function checkQuoteCount() {
	/* IE Cache Issue: To prevent chace problem with Internet Explorer */
	var nocache=0;
	nocache=Math.random();

	CqotdTags = "";
	tagSelect = document.SubscriptionForm.CqotdTagChooser;
	for (var i=0; i < tagSelect.options.length; i++) {
		if (tagSelect.options[i].selected) {
			CqotdTags += document.SubscriptionForm.CqotdTagChooser.options[i].value + ",";
		}
	}
	CqotdTags = CqotdTags.substring(0, CqotdTags.length-1); // remove last char which will be a comma
	
	CqotdAuthors = "";
	for (var i=0; i < document.SubscriptionForm.CqotdAuthorChooser.options.length; i++) {
		if (document.SubscriptionForm.CqotdAuthorChooser.options[i].selected) {
			CqotdAuthors += (i<document.SubscriptionForm.CqotdAuthorChooser.options.length-1)?document.SubscriptionForm.CqotdAuthorChooser.options[i].value + ",":document.SubscriptionForm.CqotdTagChooser.options[i].value;
		}
	}
	CqotdAuthors = CqotdAuthors.substring(0, CqotdAuthors.length-1); // remove last char which will be a comma
	
	/* This line code use the encodeURI() metod that solve the IE issue tied to wrong encoding special characters passad from a coldfusion page to a javascript variable.*/
	var CqotdTags = encodeURI(CqotdTags);
	var CqotdAuthors = encodeURI(CqotdAuthors);
	http.open('get', 'ajax-helpers/check-quote-count.cfm?CqotdTags=' + CqotdTags + '&CqotdAuthors=' + CqotdAuthors + '&nocache=' + nocache);
	document.getElementById('CheckQuoteCountResponse').innerHTML = "<p>Checking...</p>";
	http.onreadystatechange = checkQuoteCountResponse;
	http.send(null);
}
/* load the query result into the layer ajaxResponse */
function checkQuoteCountResponse() {
	if(http.readyState == 4){
		var response=http.responseText;
		document.getElementById('CheckQuoteCountResponse').innerHTML = response;
	}	
}