function EscapeApostrophes(str){
 try {
// return str.split("'").join("''");
return str.split("'").join("\'");
 }
 catch(err){
  //alert("The error " + err + " occured with " + str);
 }
}
function qnapost(){
var idxvalue = document.getElementById('idx').value;
var questionvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('question').value));
var avalue = encodeURIComponent(EscapeApostrophes(document.getElementById('a').value));
var bvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('b').value));
var cvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('c').value));
var dvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('d').value));
var correctvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('correct').value));

var parameters = "idx=" + idxvalue + "&question=" + questionvalue + "&a=" + avalue + "&b=" + bvalue + "&c=" + cvalue + "&d=" + dvalue + "&correct=" + correctvalue;
return parameters;
}

function mailpost(){
var namevalue = encodeURIComponent(EscapeApostrophes(document.getElementById('name').value));
var addressvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('address').value));
var townvalue = encodeURIComponent(EscapeApostrophes(document.getElementById('town').value));
var phonevalue= encodeURIComponent(EscapeApostrophes(document.getElementById('phone').value));
var emailvalue= encodeURIComponent(EscapeApostrophes(document.getElementById('email').value));
var messagevalue= encodeURIComponent(EscapeApostrophes(document.getElementById('message').value));
var parameters = "name=" + namevalue + "&address=" + addressvalue + "&town=" + townvalue + "&phone=" + phonevalue + "&email=" + emailvalue + "&message=" + messagevalue;
return parameters;
}
function eventpost(i){
//alert ("in eventpost with i = " + i);
var idvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("eidx"+i).value));
var edatevalue = encodeURIComponent(EscapeApostrophes(document.getElementById("dateview").value));
var timestartvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("datetimestr"+i).innerHTML));
var timeendvalue = "";
var instructoridvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("iid").value));
var studentidvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("sid"+i).value));
var hourvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("hour"+i).value));
var notesvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("desc"+i).value));

var parameters = "id=" + idvalue + "&edate=" + edatevalue + "&timestart=" + timestartvalue + "&instrid=" + instructoridvalue + "&studentid=" + studentidvalue + "&hours=" + hourvalue + "&notes=" + notesvalue;

// "&timeend=" + timeendvalue+ "&type=" & typevalue  
//alert ("These are the parameters in the function eventpost: " + parameters);

return parameters;
}


function pagepost(){
var idxvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("idx").value));
var pagetitlevalue = encodeURIComponent(EscapeApostrophes(document.getElementById("pagetitle").value));
var pagetextareavalue = encodeURIComponent(EscapeApostrophes(document.getElementById("pagetextarea").value));
var parameters = "idx=" + idxvalue + "&title=" + pagetitlevalue + "&body=" + pagetextareavalue;
return parameters;
}
function studentpost(){
var idxvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("idx").value));
var firstNamevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("firstName").value));
var lastNamevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("lastName").value));
var streetAddress1value=encodeURIComponent(EscapeApostrophes(document.getElementById("streetAddress1").value));
var cityvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("city").value));
var statevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("state").value));
var zipvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("zip").value));
var roadtestdatevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("roadtestdate").value));
var FinishedDatevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("FinishedDate").value));
//var AppSentDatevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("AppSentDate").value));
var eMailvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("eMail").value));
var roadtestlocvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("RoadTestLoc").value));
var phonevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("phone").value));
var pricevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("price").value));
var PermitNumbervalue=encodeURIComponent(EscapeApostrophes(document.getElementById("PermitNumber").value));
var ValidationNumbervalue=encodeURIComponent(EscapeApostrophes(document.getElementById("ValidationNumber").value));
var cellvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("cell").value));
var statusvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("status").value));
var notesvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("notes").value));
var p1val=encodeURIComponent(EscapeApostrophes(document.getElementById("p1").value));
var p2val=encodeURIComponent(EscapeApostrophes(document.getElementById("p2").value));
var p3val=encodeURIComponent(EscapeApostrophes(document.getElementById("p3").value));
var c1val=encodeURIComponent(EscapeApostrophes(document.getElementById("c1").value));
var c2val=encodeURIComponent(EscapeApostrophes(document.getElementById("c2").value));
var c3val=encodeURIComponent(EscapeApostrophes(document.getElementById("c3").value));
var d1val=encodeURIComponent(EscapeApostrophes(document.getElementById("d1").value));
var d2val=encodeURIComponent(EscapeApostrophes(document.getElementById("d2").value));
var d3val=encodeURIComponent(EscapeApostrophes(document.getElementById("d3").value));


var parameters="idx="+idxvalue+
"&firstName="+firstNamevalue+
"&lastName="+lastNamevalue+
"&streetAddress1="+streetAddress1value+
"&city="+cityvalue+
"&state="+statevalue+
"&zip="+zipvalue+
"&roadtestdate="+roadtestdatevalue+
"&FinishedDate="+FinishedDatevalue+
//"&AppSentDate="+AppSentDatevalue+
"&eMailvalue="+eMailvalue+
"&roadtestloc="+roadtestlocvalue+
"&phone="+phonevalue+
"&price="+pricevalue+
"&PermitNumber="+PermitNumbervalue+
"&ValidationNumber="+ValidationNumbervalue+
"&cellvalue="+cellvalue+
"&status="+statusvalue+
"&p1="+p1val+
"&c1="+c1val+
"&d1="+d1val+
"&p2="+p2val+
"&c2="+c2val+
"&d2="+d2val+
"&p3="+p3val+
"&c3="+c3val+
"&d3="+d3val+
"&notes="+notesvalue;

return parameters;
}

function instructorpost(){
var idxvalue = encodeURIComponent(EscapeApostrophes(document.getElementById("idx").value));
var firstNamevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("firstName").value))
var lastNamevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("lastName").value))
var streetAddress1value=encodeURIComponent(EscapeApostrophes(document.getElementById("streetAddress1").value))
var streetAddress2value=encodeURIComponent(EscapeApostrophes(document.getElementById("streetAddress2").value))
var cityvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("city").value))
var countyvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("county").value))
var statevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("state").value))
var zipvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("zip").value))
var birthdatevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("birthdate").value))
var statusvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("status").value))
var eMailvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("eMail").value))
var phonevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("phone").value))
var faxvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("fax").value))
var cellvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("cell").value))
var marriedsinglevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("marriedsingle").value))
var exemptionsvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("exemptions").value))
var DLNumbervalue=encodeURIComponent(EscapeApostrophes(document.getElementById("DLNumber").value))
var ILNumbervalue=encodeURIComponent(EscapeApostrophes(document.getElementById("ILNumber").value))
var sexvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("sex").value))
var eyevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("eye").value))
var racevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("race").value))
var ratevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("rate").value))
var maidenNamevalue=encodeURIComponent(EscapeApostrophes(document.getElementById("maidenName").value))
var heightvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("height").value))
var hairvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("hair").value))
var weightvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("weight").value))
var citizenshipvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("citizenship").value))
var PlaceOfBirthvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("PlaceOfBirth").value))
var SSNumbervalue=encodeURIComponent(EscapeApostrophes(document.getElementById("SSNumber").value))
var notesvalue=encodeURIComponent(EscapeApostrophes(document.getElementById("notes").value))


var parameters="idx="+idxvalue+
"&firstName="+firstNamevalue+
"&lastName="+lastNamevalue+
"&streetAddress1="+streetAddress1value+
"&streetAddress2="+ streetAddress2value+
"&city="+cityvalue+
"&county="+countyvalue+
"&state="+statevalue+
"&zip="+zipvalue+
"&birthdate="+birthdatevalue+
"&status="+statusvalue+
"&eMail="+eMailvalue+
"&phone="+phonevalue+
"&fax="+faxvalue+
"&cell="+cellvalue+
"&marriedsingle="+marriedsinglevalue+
"&exemptions="+exemptionsvalue+
"&DLNumber="+DLNumbervalue+
"&ILNumber="+ILNumbervalue+
"&sex="+sexvalue+
"&eye="+eyevalue+
"&race="+racevalue+
"&rate="+ratevalue+
"&maidenName="+maidenNamevalue+
"&height="+heightvalue+
"&hair="+hairvalue+
"&weight="+weightvalue+
"&citizenship="+citizenshipvalue+
"&PlaceOfBirth="+PlaceOfBirthvalue+
"&SSNumber="+SSNumbervalue+
"&notes="+notesvalue
//alert("In instructorpost with " + parameters);
return parameters;
}

