/* Passing Variables Using Javascript and Cookies
 * Used in conjunction with qForms API
 * 
 * Created : 02/09/2005
 */
var fldFName;
var fldLName;
var fldAddress;
var fldCity;
var fldState;
var fldZip;
var fldPhone;
var fldEmail;
var fldAge;
var fldEdu;
var fldCourse;
var fldFormat;

function initValues(){
	//Initialize values from cookies if they exist
	fldFName=getCookie("exp_ckfname");
	fldLName=getCookie("exp_cklname");
	fldAddress=getCookie("exp_ckaddress");
	fldCity=getCookie("exp_ckcity");
	fldState=getCookie("exp_ckstate");
	fldZip=getCookie("exp_ckzip");
	fldPhone=getCookie("exp_ckphone");
	fldEmail=getCookie("exp_ckemail");
	fldAge=getCookie("exp_ckage");
	fldEdu=getCookie("exp_ckedu");
	fldCourse=getCookie("exp_ckcourse");
	fldFormat=getCookie("exp_ckformat");
	
	writeFlds();
}
function writeFlds(){
	//Set Form Input data
	objForm.first_name.setValue(fldFName);
	objForm.last_name.setValue(fldLName);
	objForm.address.setValue(fldAddress);
	objForm.city.setValue(fldCity);
	objForm.state.setValue(fldState);
	objForm.zip.setValue(fldZip);
	objForm.phone.setValue(fldPhone);
	objForm.email.setValue(fldEmail);
	objForm.age.setValue(fldAge);
	objForm.education_level.setValue(fldEdu);
	objForm.course.setValue(fldCourse);
	objForm.format.setValue(fldFormat);
}
function writeCookies(){
	//Delete cookies if they exist. May not be needed as default is to overwrite
	//deleteCookies();
	
	//Write/Overwrite Form Data into cookies
	setCookie("exp_ckfname",objForm.first_name.getValue());
	setCookie("exp_cklname",objForm.last_name.getValue());
	setCookie("exp_ckaddress",objForm.address.getValue());
	setCookie("exp_ckcity",objForm.city.getValue());
	setCookie("exp_ckstate",objForm.state.getValue());
	setCookie("exp_ckzip",objForm.zip.getValue());
	setCookie("exp_ckphone",objForm.phone.getValue());
	setCookie("exp_ckemail",objForm.email.getValue());
	setCookie("exp_ckage",objForm.age.getValue());
	setCookie("exp_ckedu",objForm.education_level.getValue());
	setCookie("exp_ckcourse",objForm.course.getValue());
	setCookie("exp_ckformat",objForm.format.getValue());
}
