// Global Variables

var ajax_controller_main = '/lib/ajax/general_contactform_ajax.asp';
var guiForm;
var dictionaryForm;
var guiFormName = '';
var chooserFilter = '';
var queryCount = 1;
var vLoader = '<img src="/images_main/loading.gif" border="0" width="130" height="60">';
var vClientID = '';
var vCart = [];
var vErrorAlert;
var vUsername = '';
var vPassword = '';
var vAction = '';
var vParams = '';

// ------------------------------------------------------------------------------

function renderContactForm(vCampaignName) { 
	v_callmethod = 'renderContactForm';
	strURL = ajax_controller_main + '?' + 'callmethod=' + v_callmethod
	strURL = strURL + '&CampaignName='+escape(vCampaignName);
	//alert(strURL); 
	PassAjaxResponseToFunction(strURL, 'renderContactForm_return', 'null');
	return true;
}

function renderContactForm_return(str_response) {
	//alert('Response: ' + str_response); 
	arr_response = str_response.split('||');
	if ( arr_response[0] == '1') {
	    document.getElementById('divContactForm').innerHTML = arr_response[1];
	} else {
		alert(arr_response[1]);
	}
	return true;
}

// ------------------------------------------------------------------------------

function sendContactForm() { 
	v_callmethod = 'sendContactForm';
	strURL = 'callmethod=' + v_callmethod
	strURL = strURL + '&fldContact=' + escape(document.frmInquiry.fldContact.value);
	strURL = strURL + '&fldName=' + escape(document.frmInquiry.fldName.value);
	strURL = strURL + '&fldEmail=' + escape(document.frmInquiry.fldEmail.value);
	strURL = strURL + '&fldPhone=' + escape(document.frmInquiry.fldPhone.value);
	strURL = strURL + '&fldWebsite=' + escape(document.frmInquiry.fldWebsite.value);
	strURL = strURL + '&fldPriority=' + escape(document.frmInquiry.fldPriority.value);
	strURL = strURL + '&fldMessage=' + escape(document.frmInquiry.fldMessage.value);
	strURL = strURL + '&fldCampaignName=' + escape(document.frmInquiry.fldCampaignName.value);
	strURL = strURL + '&timezone_info=' + encodeURIComponent(document.frmInquiry.timezone_info.value);
	
	
	//alert(strURL); 
	PassAjaxResponseToFunctionUsingPost(ajax_controller_main, strURL, 'sendContactForm_return', 'null');
	return true;
}

function sendContactForm_return(str_response) {
	//alert('Response: ' + str_response); 
	arr_response = str_response.split('||');
	if ( arr_response[0] == '1') {
	    document.getElementById('divContactForm').innerHTML = arr_response[1];
	} else {
		alert(arr_response[1]);
	}
	return true;
}


