/////  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  
function $_(e) { return document.getElementById(e); }  ;
function $n_(n) { return document.getElementsByName(n); } ; 

function getRadioValue(group)
{
	for (var i = 0; i < group.length; i++)
	{
		if (group[i].checked)
			return group[i].value;
	}
	return "";
} ; 

/////////////////////////////////////////////////////

function hideintroTxt() {  $("#introTxt").fadeOut("slow"); };
function hidedivBesides(){  $("div.DivMarker:visible").fadeOut("slow"); };
function presentdiv(steps) {  hidedivBesides(); $(steps).fadeIn("slow"); 
$_("currentStep").value = steps.substr(5,1); 
}  ;
 
function presentdiv_hold_others(steps) { $(steps).fadeIn("slow"); } ;
function hidediv_hold_others(steps) { $(steps).fadeOut("slow"); } ; 

/////////////////////////////////////////////////////
function post_uniqueID1()
{ $.post("includes/_step1_uniqueID.php", { programs: $_("programs").value }, 
function(varuniqueID) { $("span").remove(".txt_uniqueID");$("#uniqueID").append(varuniqueID); } ); } ;
/////////////////////////////////////////////////////
function post_Programs1()
{ $.post("includes/_step1_programs.php", { programs: $_("programs").value }, function(varPrograms) { $("span").remove(".txt_Programs");$("#Program_Name").append(varPrograms); } ); } ;
/////////////////////////////////////////////////////
function post_OfferCodeDeclare1()
{ $.post("includes/_step1_OfferCodeDeclare.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value }, function(varoffercodeDeclare) { $("span").remove(".txt_offercodeDeclare");$("#offercodeDeclare").append(varoffercodeDeclare); } ); };
/////////////////////////////////////////////////////
function post_FullPaymentSavings1()
{ $.post("includes/_step1_FullPaymentSavings.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value  },
function(varFullPaymentSavings) { $("span").remove(".txt_FullPaymentSavings");$("#FullPaymentSavings").append(varFullPaymentSavings); } ); };

/////////////////////////////////////////////////////
function post_MonthlyPaymentSavings1()
{ $.post("includes/_step1_MonthlyPaymentSavings.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value  },
function(varMonthlyPaymentSavings) { $("span").remove(".txt_MonthlyPaymentSavings");$("#MonthlyPaymentSavings").append(varMonthlyPaymentSavings); } ); };

/////////////////////////////////////////////////////
function post_FullPaymentPrices1()
{ $.post("includes/_step1_FullPaymentPrices.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value },
function(varFullPaymentPrices) { $("span").remove(".txt_FullPaymentPrices");$("#FullPaymentPrices").append(varFullPaymentPrices); } ); };
/////////////////////////////////////////////////////
function post_AutomaticPaymentPrices1()
{ $.post("includes/_step1_AutomaticPaymentPrices.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value },
function(varAutomaticPaymentPrices) { $("span").remove(".txt_AutomaticPaymentPrices");$("#AutomaticPaymentPrices").append(varAutomaticPaymentPrices); } ); };
/////////////////////////////////////////////////////
function post_StandardPaymentPrices1()
{$.post("includes/_step1_StandardPaymentPrices.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value },function(varStandardPaymentPrices) { $("span").remove(".txt_StandardPaymentPrices");$("#StandardPaymentPrices").append(varStandardPaymentPrices); } ); };
/////////////////////////////////////////////////////
function post_TotalCoursePrice1()
{$.post("includes/_step1_TotalCoursePrice.php", { programs: $_("programs").value, offer_code: $_("offer_code").value, country: $_("country").value },function(varTotalCoursePrice) { $("span").remove(".txt_TotalCoursePrice");$("#TotalCoursePrice").append(varTotalCoursePrice); } ); };
/////////////////////////////////////////////////////
function post_PriceBreakDown1()
{ $.post("includes/_step1_Price_Breakdown.php", { programs: $_("programs").value }, 
function(varPriceBreakDown) { $("span").remove(".txt_PriceBreakDown"); $("#PriceBreakDown").append(varPriceBreakDown); } ); };
/////////////////////////////////////////////////////
function post_InternationalNote1()
{ $.post("includes/_step2_InternationalNote.php", { country: $_("country").value }, 
function(varInternationalNote) { $("span").remove(".txt_InternationalNote"); $("#InternationalNote").append(varInternationalNote); } ); };
/////////////////////////////////////////////////////
function post_UniqueIdentifier1()
{ $.post("includes/_step3_UniqueIdentifier.php", { country: $_("country").value }, 
function(varUniqueIdentifier) { $("span").remove(".txt_UniqueIdentifier"); $("#UniqueIdentifier").append(varUniqueIdentifier); } ); };
/////////////////////////////////////////////////////
function post_age_check_Guardian()
{ $.post("includes/step1_age_check.php", {    first_name: $_("first_name").value,  birth_month: $_("birth_month").value, birth_day: $_("birth_day").value, birth_year: $_("birth_year").value    }, 
function(var_check_Guardian) { $("span").remove(".txt_check_Guardian"); $("#check_Guardian").append(var_check_Guardian); } ); };

/////////////////////////////////////////////////////

function populate_billing_Address()
{ 
$_("billing_address").value = "" ; $_("billing_address").value = $_("address").value ;
$_("billing_address2").value = "" ; $_("billing_address2").value = $_("address2").value ;
$_("billing_city").value = "" ; $_("billing_city").value = $_("city").value ; 
$_("billing_state").value = "" ; $_("billing_state").value = $_("state").value ; 
$_("billing_zip").value = "" ; $_("billing_zip").value = $_("zip").value ;
$_("billing_country").value = "" ; $_("billing_country").value = $_("country").value ;
} ;

function clear_billing_Address()
{ 
$_("billing_address").value = "" ; 
$_("billing_address2").value = "" ; 
$_("billing_city").value = "" ; 
$_("billing_state").value = "" ; 
$_("billing_zip").value = "" ; 
$_("billing_country").value = "United States" ; 
}  ;

/////////////////////////////////////////////////////
function post_ChargedAmount2()
{ $.post("includes/_step2_Charged_Amount.php", { PaymentOptions: getRadioValue($n_("PaymentOptions")), fullpayment_INITIALCHARGE: $_("fullpayment_INITIALCHARGE").value, automaticpayment_INITIALCHARGE: $_("automaticpayment_INITIALCHARGE").value, standardpayment_INITIALCHARGE: $_("standardpayment_INITIALCHARGE").value  },
function(varcharged_amount) { $("span").remove(".txt_charged_amount");$("#charged_amount").append(varcharged_amount); } ); };

////////  FINAL ITEMS REVIEW POST   ////////////////

//////////// step 1 final

function step_1_of_5_review()
{ $.post("includes/step1_review.php", 
{ programs: $_("programs").value, first_name: $_("first_name").value,last_name: $_("last_name").value,  maiden_name: $_("maiden_name").value, address: $_("address").value, address2: $_("address2").value, city: $_("city").value, state: $_("state").value, zip: $_("zip").value, country: $_("country").value, dayphone: $_("dayphone").value, eveningphone: $_("eveningphone").value, email: $_("email").value, birth_month: $_("birth_month").value,birth_day: $_("birth_day").value, birth_year: $_("birth_year").value, offer_code: $_("offer_code").value }, function(varstep1_REVIEW) { $("span").remove(".txt_step1_REVIEW");$("#step1_REVIEW").append(varstep1_REVIEW); } ); };

//////////// step 2 final  ///////////////

function step_2_of_5_review()
{
$.post("includes/step2_review.php", 
{ 
/////////////
PaymentOptions: getRadioValue($n_("PaymentOptions")), 
fullpayment_INITIALCHARGE: $_("fullpayment_INITIALCHARGE").value, 
automaticpayment_INITIALCHARGE: $_("automaticpayment_INITIALCHARGE").value,
standardpayment_INITIALCHARGE: $_("standardpayment_INITIALCHARGE").value,
///////
programs: $_("programs").value,
country: $_("country").value,
offer_code: $_("offer_code").value

/////////////
}, function(varstep2_REVIEW) { $("span").remove(".txt_step2_REVIEW");$("#step2_REVIEW").append(varstep2_REVIEW); } ); };

//////////// step 3 final

function step_3_of_5_review()
{
$.post("includes/step3_review.php", 
{ 
///////////// 
signature_name: $_("signature_name").value, 
signature_date: $_("signature_date").value,
//unique_identifier: $_("unique_identifier").value,
unique_identifier_value: $_("unique_identifier_value").value,
parent_name: $_("parent_name").value,
parent_relationship: $_("parent_relationship").value, 
parent_date: $_("parent_date").value,
parent_address: $_("parent_address").value,
parent_city: $_("parent_city").value,
parent_state: $_("parent_state").value,
parent_zip: $_("parent_zip").value,
parent_country: $_("parent_country").value,
country: $_("country").value
/////////////
}, function(varstep3_REVIEW) { $("span").remove(".txt_step3_REVIEW");$("#step3_REVIEW").append(varstep3_REVIEW); } ); };

//////////// step 4 final

function step_4_of_5_review()
{
$.post("includes/step4_review.php", 
{ 
///////////// 
PaymentOptions: getRadioValue($n_("PaymentOptions")), 
fullpayment_INITIALCHARGE: $_("fullpayment_INITIALCHARGE").value, 
automaticpayment_INITIALCHARGE: $_("automaticpayment_INITIALCHARGE").value,
standardpayment_INITIALCHARGE: $_("standardpayment_INITIALCHARGE").value,
cardholder_firstname: $_("cardholder_firstname").value, 
cardholder_lastname: $_("cardholder_lastname").value, 
creditcard_type: $_("creditcard_type").value, 
cc_number: $_("cc_number").value, 
cc_expire_month: $_("cc_expire_month").value, 
cc_expire_year: $_("cc_expire_year").value, 
cc_verification: $_("cc_verification").value, 
billing_address_checkbox: $_("billing_address_checkbox").checked, 
billing_address: $_("billing_address").value, 
billing_address2: $_("billing_address2").value, 
billing_city: $_("billing_city").value, 
billing_state: $_("billing_state").value, 
billing_zip: $_("billing_zip").value, 
billing_country: $_("billing_country").value
/////////////
}, function(varstep4_REVIEW) { $("span").remove(".txt_step4_REVIEW");$("#step4_REVIEW").append(varstep4_REVIEW); } ); }  ;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function postAJAXvars1()
{
post_Programs1(); 
post_OfferCodeDeclare1(); 
post_FullPaymentSavings1(); 
post_MonthlyPaymentSavings1(); 
post_FullPaymentPrices1(); 
post_AutomaticPaymentPrices1();
post_StandardPaymentPrices1();
post_TotalCoursePrice1();
post_PriceBreakDown1();
post_InternationalNote1();
post_UniqueIdentifier1();
step_1_of_5_review();
} ;
 
function postAJAXvars2()
{
post_ChargedAmount2();
step_2_of_5_review();
} ;

/////    SEND STEPS... 

function sendSTEP1() { validatestep1();  } ;
function sendSTEP2() { validatestep2();  } ;  
function sendSTEP3() { validatestep3();  } ;  
function sendSTEP3_G() { validatestep3_G();  } ;   
function sendSTEP4() { validatestep4();  } ;
function post_all() { postAJAXvars1(); postAJAXvars2(); step_3_of_5_review(); step_4_of_5_review(); finalSubmit_BUTTON();  } ;

//////   mail Lead   ///////////////////////////////////

function mail_Lead()
{ $.post("includes/step1_lead_sent.php", 
{ programs: $_("programs").value, first_name: $_("first_name").value,last_name: $_("last_name").value,  maiden_name: $_("maiden_name").value, address: $_("address").value, address2: $_("address2").value, city: $_("city").value, state: $_("state").value, zip: $_("zip").value, country: $_("country").value, dayphone: $_("dayphone").value, eveningphone: $_("eveningphone").value, email: $_("email").value, birth_month: $_("birth_month").value,birth_day: $_("birth_day").value, birth_year: $_("birth_year").value, 
offer_code: $_("offer_code").value,  unique_idCALL: $_("unique_idCALL").value
}, 

function(var_mail_Lead) { $("span").remove(".txt_mail_Lead");$("#mail_Lead)").append(var_mail_Lead); } ); };

///////////////////////////+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function finalSubmit_BUTTON()
{ $.post("includes/final_Submit_button.php", 

{
programs: $_("programs").value,
PaymentOptions: getRadioValue($n_("PaymentOptions")), 
fullpayment_INITIALCHARGE: $_("fullpayment_INITIALCHARGE").value, 
automaticpayment_INITIALCHARGE: $_("automaticpayment_INITIALCHARGE").value, 
standardpayment_INITIALCHARGE: $_("standardpayment_INITIALCHARGE").value,  
signature_name: $_("signature_name").value,  
cardholder_firstname: $_("cardholder_firstname").value 
 },
 
function(varfinalSubmit_BUTTON) { $("span").remove(".txt_finalSubmit_BUTTON");$("#finalSubmit_BUTTON").append(varfinalSubmit_BUTTON); } ); };

///////////////////////////+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

/////////////////  SuBNav    //////////////////////////////

function subnav_update()
{
	$.post("includes/subnav.php", 
		{ 
			programs: $_("programs").value,
			PaymentOptions: getRadioValue($n_("PaymentOptions")), 
			signature_name: $_("signature_name").value, 
			cardholder_firstname: $_("cardholder_firstname").value,
			// previousStep: $_("previousStep").value,
			currentStep: $_("currentStep").value
		},
		function(varsubnav) { $("span").remove(".txt_subnav");  $("#subnav").append(varsubnav); }
	); 
};


/////////////////////////


/////////////////////////////////////////////////////
function display_Guardian()
{  $("#Guardian_info").css({display: "block"}); };

function hide_Guardian()
{  $("#Guardian_info").css({display: "none"}); };
/////////////////////////////////////////////////////

