<!doctype html>
<html>
<head>
<title>What English Case is That? - Nominative, Genitive, Accusative, Dative - RJM Programming - February, 2017</title>
<script type='text/javascript'>
var score=0, goes=0, lastone=-1;
var thissentence='', thisverb='', thiswordtoaskabout='', extras='', extradelim='';

var sentences=["Sarah <i>gave</i> <b>me</b> a chocolate. ",
"<b>Li</b> <i>cycles</i> to work regularly. ",
"The jockey <i>whipped</i> <b>the horse</b> in the home straight. ",
"<b>Their</b> attitude towards the neighbours <i>surprises</i> me.</i>. ",
"The secretary <i>forwarded</i> <b>him</b> three weeks worth of wages. ",
"Rhonda <i>passed</i> <b>Ricky</b> a fan. ",
"<b>People</b> <i>vote</i> for that candidate in droves. ",
"<b>Celia's</b> curls are something <i>to behold</i>. ",
"That woman <i>took</i> <b>a photograph</b> of the waterfall. ",
"Everybody <i>complimented</i> the school student on <b>his</b> hairstyle. ",
"Unsurprisingly, Gabe <i>served</i> <b>Kim</b> an ace. ",
"<b>Frogs</b> <i>chirrup</i> for hours in that drain. ",
"They <i>nicknamed</i> the palace meadows the <b>princess'</b> dairies. ",
"The landscaper <i>hauled</i> <b>a hose</b> down to the backyard. ",
"<b>Antelopes</b> <i>run</i> very fast, when at full speed. ",
"The cat <i>chased</i> <b>the mouse</b>. "
];

var mores = (location.search.split('casesentences=')[1] ? decodeURIComponent(location.search.split('casesentences=')[1].split('&')[0]) : '');

function cs_setCookie(thisg) { // thanks to JavaScript and Ajax by Tom Negrino and Dori Smith
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth()+6);
document.cookie = "casesentences=" + encodeURIComponent(thisg) + ";expires=" + expireDate.toGMTString();
}

function cs_cookieVal(firstcall) {
if (firstcall && mores != '') {
if (document.cookie == '') {
extras=mores;
cs_setCookie(mores);
} else {
extras=cs_cookieVal(false) + ',' + mores;
var xms=decodeURIComponent(extras).split(' ,');
var xextras='';
var xextradelim='';
for (var ixms=0; ixms<xms.length; ixms++) {
if (eval(ixms + 1) == xms.length) {
if (sentences.indexOf(xms[ixms]) == -1) {
xextras+=xextradelim + xms[ixms];
xextradelim=",";
sentences.push(xms[ixms]);
}
} else {
if (sentences.indexOf(xms[ixms] + ' ') == -1) {
xextras+=xextradelim + xms[ixms] + ' ';
xextradelim=",";
sentences.push(xms[ixms] + ' ');
}
}
}
if (xextras != extras) {
cs_setCookie(xextras);
extras=xextras;
mores='';
return extras;
}
}
mores='';
}
if (document.cookie != '') {
var tCookie=document.cookie.split("; ");
for (var j=0; j<tCookie.length; j++) {
if ("casesentences" == tCookie[j].split("=")[0]) {
if (firstcall && decodeURIComponent(tCookie[j].split("=")[1]) != "") {
var ms=decodeURIComponent(tCookie[j].split("=")[1]).split(' ,');
for (var ims=0; ims<ms.length; ims++) {
if (eval(ims + 1) == ms.length) {
extras+=extradelim + ms[ims];
extradelim=",";
sentences.push(ms[ims]);
} else {
extras+=extradelim + ms[ims] + ' ';
extradelim=",";
sentences.push(ms[ims] + ' ');
}
}
}
return decodeURIComponent(tCookie[j].split("=")[1]);
}
}
}
return '';
}

function add(thisone) {
var proposed="";
if (thisone == "Accusative") {
proposed=prompt("Please enter your own " + thisone + " sentence that you could model on the default answer below. Please notice you need to encase <b>noun</b> or <b>pronoun</b> of interest with <b></b> and <i>verb</i> of interest with <i></i>.", "The mother <i>chided</i> <b>the child</b> for bad behaviour.");
if (proposed == null) proposed="";
if (proposed.trim().indexOf(' ') != -1 && extras.indexOf(proposed.trim() + " ") == -1) {
lastone=sentences.length;
extras+=extradelim + proposed.trim() + " ";
extradelim=",";
cs_setCookie(extras);
sentences.push(proposed.trim() + " ");
}
} else if (thisone == "Dative") {
proposed=prompt("Please enter your own " + thisone + " sentence that you could model on the default answer below. Please notice you need to encase <b>noun</b> or <b>pronoun</b> of interest with <b></b> and <i>verb</i> of interest with <i></i>.", "The janitor <i>handed</i> <b>her</b> a basket.");
if (proposed == null) proposed="";
if (proposed.trim().indexOf(' ') != -1 && extras.indexOf(proposed.trim() + " ") == -1) {
lastone=sentences.length;
extras+=extradelim + proposed.trim() + " ";
extradelim=",";
cs_setCookie(extras);
sentences.push(proposed.trim() + " ");
}
} else if (thisone == "Nominative") {
proposed=prompt("Please enter your own " + thisone + " sentence that you could model on the default answer below. Please notice you need to encase <b>noun</b> or <b>pronoun</b> of interest with <b></b> and <i>verb</i> of interest with <i></i>.", "Dogs <i>love</i> <b>bones</b>.");
if (proposed == null) proposed="";
if (proposed.trim().indexOf(' ') != -1 && extras.indexOf(proposed.trim() + " ") == -1) {
lastone=sentences.length;
extras+=extradelim + proposed.trim() + " ";
extradelim=",";
cs_setCookie(extras);
sentences.push(proposed.trim() + " ");
}
} else if (thisone == "Genitive") {
proposed=prompt("Please enter your own " + thisone + " sentence that you could model on the default answer below. Please notice you need to encase <b>noun</b> or <b>pronoun</b> of interest with <b></b> and <i>verb</i> of interest with <i></i>.", "<b>Her</b> sincerity regarding the card <i>touched</i> us.</i>.");
if (proposed == null) proposed="";
if (proposed.trim().indexOf(' ') != -1 && extras.indexOf(proposed.trim() + " ") == -1) {
lastone=sentences.length;
extras+=extradelim + proposed.trim() + " ";
extradelim=",";
cs_setCookie(extras);
sentences.push(proposed.trim() + " ");
}
}
}

function createhints() {
var ch="<br><br><a style='text-decoration:none;background-color:white;border:2px solid orange;padding:3 3 3 3;' href='#' onclick=\"add('Nominative');\" title='Add your own Nominative'>Nominative</a>: <a target=_blank title='Nominative link, thanks' href='http://www.dailywritingtips.com/what-is-dative-case/'>A noun or pronoun is in the Nominative Case when it is the subject of a sentence, or when it completes a being verb.</a> To find subject ... who or what " + thisverb + "?<br><br>";
ch+="<a style='text-decoration:none;background-color:white;border:2px solid orange;padding:3 3 3 3;' href='#' onclick=\"add('Accusative');\" title='Add your own Accusative'>Accusative</a>: <a target=_blank title='Accusative link, thanks' href='http://www.grammar-monster.com/glossary/accusative_case.htm'>The accusative case's main function is to show the direct object of a verb.</a> To find direct object ... " + thisverb + " what (or whom)?<br><br>";
ch+="<a style='text-decoration:none;background-color:white;border:2px solid orange;padding:3 3 3 3;' href='#' onclick=\"add('Genitive');\" title='Add your own Genitive'>Genitive</a>: <a target=_blank title='Genitive link, thanks' href='http://www.dailywritingtips.com/what-is-dative-case/'>A noun or pronoun is in the Genitive Case when it shows possession.</a><br><br>";
ch+="<a style='text-decoration:none;background-color:white;border:2px solid orange;padding:3 3 3 3;' href='#' onclick=\"add('Dative');\" title='Add your own Dative'>Dative</a>: <a target=_blank title='Dative link, thanks' href='http://www.dailywritingtips.com/what-is-dative-case/'>A noun or pronoun is in the Dative Case when it is used as an indirect object.</a> If a sentence contains two objects, it will have a direct object and an indirect object. To find the direct object ... " + thisverb + " what (or whom)? To find the indirect object ... " + thisverb + " to whom/to what/for whom/for what/on what?<br><br><br>";
document.getElementById('hints').innerHTML=ch;
}

function chooseone() {
var isen;
if (lastone >= 0) {
isen=lastone;
lastone=-1;
} else {
isen=Math.floor(Math.random() * sentences.length);
}
thissentence=sentences[isen];
thisverb=(' ' + thissentence).replace('</i>','<i>').split('<i>')[1];
thiswordtoaskabout=(' ' + thissentence).replace('</b>','<b>').split('<b>')[1];
var was=document.getElementById('thissentence').innerHTML;
var wases=(' ' + was).split('<select');
if (wases.length > 1) {
document.getElementById('thissentence').innerHTML=thissentence + '    <select' + wases[1];
document.getElementById('hints').innerHTML="<br><br><a href='#' title='Questions to ask?' onclick='createhints();'>Reveal some hints or add your own sentence?</a>";
}
}

function checkanswer(tv) {
var prevs=score, cans='';
goes++;
if ((thissentence + '*').indexOf(' *') != -1) { // Dative
cans='Dative';
} else if ((thissentence + '*').indexOf(' *') != -1) { // Accusative
cans='Accusative';
} else if ((thissentence + '*').indexOf(' *') != -1) { // Genitive
cans='Genitive';
} else if ((thissentence + '*').indexOf(' *') != -1) { // Nominative
cans='Nominative';
}
if (tv.toLowerCase() == cans.toLowerCase()) score++;
document.getElementById('score').innerHTML='Score: ' + score + '/' + goes;
if (prevs == score) {
alert('Sorry case for ' + thiswordtoaskabout + ' is not ' + tv + ', but rather, ' + cans + '.');
}
document.getElementById('hints').innerHTML='';
chooseone();
}

function shareviaemail() {
var prefix=document.getElementById('aemail').href.split('body=');
document.getElementById('aemail').href=prefix[0] + 'body=' + encodeURIComponent(document.URL.split('#')[0].split('?')[0] + '?casesentences=' + encodeURIComponent(extras));
document.getElementById('aemail').click();
}

</script>
</head>
<body onload='cs_cookieVal(true); chooseone();' style='background-color:#f7e7e7;'>
<h1>What English Case is That? <a id='eemail' onclick='shareviaemail();' title='Share via Email a link to this game called What Case is That?'>📧</a></h1>
<h2>Nominative, Accusative, Genitive, Dative</h2>
<h3>RJM Programming - February, 2017</h3>
<h4 id='score'>Score: 0/0</h4>

<div id='thissentence'><select id='choice' onchange='checkanswer(this.value);' style='background-color:pink;'><option value=''>Please choose appropriate case of bold word(s) in sentence with itallic verb at left</option><option value='Nominative'>Nominative</option><option value='Genitive'>Genitive</option><option value='Accusative'>Accusative</option><option value='Dative'>Dative</option></select></div>
<br><br>
<div id='hints' style='background-color:yellow;'></div>
<a target='_top' style='display:none;' href='mailto:fillin@email.to?subject=What%20Case%20is%20that%20English%20Noun%20or%20Pronoun&body=' id='aemail'>Share via Email</a>

</body>
</html>