

function mailIt(form) {
  var data = document.testForm
  var userInfo = "" 
 var mytext = "Tamil Language In Context at UPENN - Answers from Students\n\n" 
 if(data.recipient.value == ""){ 
  alert("You must enter your teacher's email address!"); 
   return false;
 }
 else{ 
 userInfo += "To: " + data.recipient.value + "\n" 
 }
 if (data.emailad.value == ""){ 
alert("You need to enter your email address also!"); 
return false;
}
 else{
userInfo += "From: " + data.emailad.value + "\n" 
}
userInfo += "Subject: " + "Tamil Student answer: Unit 2 - Diagnostic Test A" + "\n\n" 
userInfo += "Student: " + data.student.value + "\n" 
userInfo += "Page Title:  " + document.title + "\n\n" 
mytext += "Match words and phrases:\n\n"

Item = data.pbox1.selectedIndex;

mytext += "Little/Some = "  + data.pbox1.options[Item].text + "\n\n" 
Item = data.pbox2.selectedIndex;
mytext += "This much = "  + data.pbox2.options[Item].text + "\n\n" 
Item = data.pbox3.selectedIndex;
mytext += "Feast = "  + data.pbox3.options[Item].text + "\n\n" 
Item = data.pbox4.selectedIndex;
mytext += "Food = "  + data.pbox4.options[Item].text + "\n\n" 
Item = data.pbox5.selectedIndex;
mytext += "Visit us for a dinner = "  + data.pbox5.options[Item].text + "\n\n" 
Item = data.pbox6.selectedIndex;
mytext += "Don't be shy = "  + data.pbox6.options[Item].text + "\n\n" 
Item = data.pbox7.selectedIndex;
mytext += "Here you go  = "  + data.pbox7.options[Item].text + "\n\n" 
Item = data.pbox8.selectedIndex;
mytext += "Enough = "  + data.pbox8.options[Item].text + "\n\n" 
Item = data.pbox9.selectedIndex;
mytext += "Long time no see = "  + data.pbox9.options[Item].text + "\n\n" 
Item = data.pbox10.selectedIndex;
mytext += " Let us eat = "  + data.pbox10.options[Item].text + "\n\n" 

mytext += "2. Translate what you hear from the following videos.\n\n"

if (data.box2.value != ""){
mytext += "2) Come! How are you?  I am good! Don't sit here. sit here."  +  "\n\n" + data.box2.value + "\n\n" 
}
if (data.box3.value != ""){
mytext += "3) This should be excellent for you. I am old, it won't be good for me....."  +  "\n\n" + data.box3.value + "\n\n" 
}

mytext += "3. Complete and translate the following sentences.\n\n"

if(data.cbox1.value != ""){
mytext += "1. = "  + data.cbox1.value + "\n\n" 
}
if(data.cbox2.value != ""){
mytext += "2. = "  + data.cbox2.value + "\n\n" 
}
if(data.cbox3.value != ""){
mytext += "3. = "  + data.cbox3.value + "\n\n" 
}
if(data.cbox4.value != ""){
mytext += "4.  = "  + data.cbox4.value + "\n\n" 
}
if(data.cbox5.value != ""){
mytext += "5.  = "  + data.cbox5.value + "\n\n" 
}

mytext += "4. Translate.\n\n"

if(data.cbox6.value != ""){
mytext += "6. = "  + data.cbox6.value + "\n\n" 
}
if(data.cbox7.value != ""){
mytext += "7.  = "  + data.cbox7.value + "\n\n" 
}
if(data.cbox8.value != ""){
mytext += "8. = "  + data.cbox8.value + "\n\n" 
}
if(data.cbox9.value != ""){
mytext += "9.  = "  + data.cbox9.value + "\n\n" 
}
if(data.cbox10.value != ""){
mytext += "10.  = "  + data.cbox10.value + "\n\n" 
}

form.mailBody.value = "(bs)" + userInfo + mytext + "(es)"
 
form.action = "http://ccat.sas.upenn.edu/cgi-bin/tamil/sendtlinc" 
return true
}
function rightString(InString, num)  {
OutString = InString.substring
(InString.length-num,InString.length);
return (OutString);
}
function set(text){
var ret = rightString(text, 3)
if (ret == "gif" || ret == "jpg" ){
text = "<img src='" + text + "'>" 
win = window.open("", "newwin", "height=250,width=400")
win.document.write (text)
win.document.close();
}
else if (ret == "mov"){
location = text
}
else if (ret == "htm"){
location = text
}
else if (ret == "tml"){
location = text
}
else if (ret == "ram"){
location = text
}
else if (ret == ".ra"){
location = text
}
else if (ret == ".au"){
location = text
}
else{
win = window.open("", "newwin", "height=250,width=400")
win.document.write ("<font color=red size=+4>" + text)
win.document.close();
win.creator = self
}
}


