

function mailIt(form) {
  var data = document.testForm
  var userInfo = "" 
var toemail = ""
var fromemail = ""
var nam = ""

 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" 
 toemail = data.recipient.value;
 }
 if (data.emailad.value == ""){ 
alert("You need to enter your email address also!"); 
return false;
}
 else{
userInfo += "From: " + data.emailad.value + "\n" 
fromemail = data.emailad.value;

}
userInfo += "Subject: " + "Tamil Student answer: Unit 1 - Diagnostic Test" + "\n\n" 
userInfo += "Student: " + data.student.value + "\n" 
nam = data.student.value;

userInfo += "Page Title:  " + document.title + "\n\n" 
Item = data.pbox1.selectedIndex;
mytext += "1. Select the correct word, phrase or sentence:\n\n"

mytext += "Greetings = "  + data.pbox1.options[Item].text + "\n\n" 
Item = data.pbox2.selectedIndex;
mytext += "Its me = "  + data.pbox2.options[Item].text + "\n\n" 
Item = data.pbox3.selectedIndex;
mytext += "Very glad = "  + data.pbox3.options[Item].text + "\n\n" 
Item = data.pbox4.selectedIndex;
mytext += "Is that right? = "  + data.pbox4.options[Item].text + "\n\n" 
Item = data.pbox5.selectedIndex;
mytext += "Who is he? = "  + data.pbox5.options[Item].text + "\n\n" 
Item = data.pbox6.selectedIndex;
mytext += "He is my friend. = "  + data.pbox6.options[Item].text + "\n\n" 
Item = data.pbox7.selectedIndex;
mytext += "I am a Tamil teacher.  = "  + data.pbox7.options[Item].text + "\n\n" 
Item = data.pbox8.selectedIndex;
mytext += "Welcome = "  + data.pbox8.options[Item].text + "\n\n" 
Item = data.pbox9.selectedIndex;
mytext += "Who is at the door? = "  + data.pbox9.options[Item].text + "\n\n" 
Item = data.pbox10.selectedIndex;
mytext += "What is your hometown? = "  + data.pbox10.options[Item].text + "\n\n" 

mytext += "2. Translate and answer the questions you hear from the following videos.\n\n"

if (data.box2.value != ""){
mytext += "2) What is your native place?"  +  "\n\n" + data.box2.value + "\n\n" 
}
if (data.box3.value != ""){
mytext += "3) Is your house not a big house?."  +  "\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. Answer the following questions in English.\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 = userInfo + mytext
 
form.action = "mail.asp?bodytxt=" + userInfo + mytext + "&toemail=" + toemail + "&fromemail=" + fromemail + "&name=" + nam;
 
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
}
}


