﻿// JavaScript Document
if(typeof gzoe == "undefined") var gzoe = new Object();
if(typeof gzoe.ce_contact == "undefined") gzoe.ce_contact = new Object();

// Constructor
gzoe.ce_contact = function() {
}

/// Class members
gzoe.ce_contact.prototype = {
/// Properties

/// Methods
	request: function(form, cmsdata_id) { 
		if( typeof http == "undefined" ) {
			alert("JSMX not included!");
			return;
		}
		document.getElementById("loading_" + cmsdata_id).style.display = 'block';
		http( "GET" , "form_components.cfc?method=formEmail" , this.response, form ); //notice the third argument = list_response. This is the callback function below.
	}
	,
	response: function(obj) { //callback functions always take one argument. This is the result passed back from the server.
		document.getElementById("loading_" + obj.cmsdata_id).style.display = 'none';
		if (obj.error == "true") {
			document.getElementById("contact_form_" + obj.cmsdata_id + "_error").style.color = "#ff0000";
			document.getElementById("contact_form_" + obj.cmsdata_id + "_error").innerHTML = obj.result;
			
		} else {
		/*document.getElementById("contact_form_" + obj.cmsdata_id ).style.color = "#009900";*/
			document.getElementById("contact_form_" + obj.cmsdata_id ).innerHTML = obj.result;
		}
	}
	, 
	reloadCaptcha: function(idnum) {
		if( typeof http == "undefined" ) {
			alert("JSMX not included!");
			return;
		}
		/// parameter
		var params = new Object();
		params.idnum = idnum;
		/// request
		http( "GET" , "form_components.cfc?method=reloadCaptcha" , this.reloadCaptchaResponse, params ); //notice the third argument = list_response. This is the callback function below.
	}
	,
	reloadCaptchaResponse: function(cfc_result) { //callback functions always take one argument. This is the result passed back from the server.
		if (cfc_result.new_captcha_hash != "") {
			document.getElementById("captchaImage" + cfc_result.idnum).src = "captchaImage.cfm?captchaHash=" + cfc_result.new_captcha_hash;
		}
	}
}

ce_contact = new gzoe.ce_contact();


