﻿xmlhttp=false;
var flag1 = 0
try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
		logMyErrors(100,e)
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
		logMyErrors(200,e)
	}
}

function retrieveXML() {
	if (typeof clicky!='undefined') {
		clicky.log('retrieveflipcard.asp','ajaxflashcard');
	}
	hidealloptions();
	hideflashcardset();
	hideajaxdiv();
	showtempajax();
	test = 1;
   	try {
	    if (document.layers) {
			ajaxDiv = document.layers["ajaxflipcard"];
		} else if (document.getElementById) {
			ajaxDiv = document.getElementById("ajaxflipcard");
		} else if (document.all) {
			ajaxDiv = document.all("ajaxflipcard");
		}
	    
		temp6 = document.getElementById("main_content");
		tempheight = temp6.offsetHeight;
		
		ajaxTempDiv = document.getElementById("ajaxTemp");
	} catch (e) {
   		logMyErrors(1,e)
   	}
   		str1 = "?";
		build_btn('hiddenRowIdCurrent', 'hiddenRowId');
		
		try {
	    	var_btnfromhistory = document.getElementById("btnfromhistory");
	    	if (var_btnfromhistory.value == 'yes') {
		        str1 = str1 + "&gotoprevious=" + document.getElementById("hiddenRowIdCurrent").value;
				var_btnfromhistory.value = '';
		    }
	    } catch(e) {
	    	logMyErrors(18,e)
	    }
		build_btn('hiddenGameSet', 'gameset');
		build_btn('hiddenCategory', 'groupcategory');
		build_btn('hiddenType', 'grouptype');
		build_btn('boxRequestExample', 'RE');
		build_btn('hiddenTblSource', 'wordsource');
		build_btn('hiddenListSource', 'listid');
		build_chk('chkbxExamples', 'chkbxExamples');
		build_chk('chkbxPictures', 'chkbxPictures');
	    build_chk('chbxSort', 'chbxSort');
	    build_chk('showans', 'showans');
		build_chk('chkbxShowHint', 'chkbxShowHint');
	    build_btn('btnSave', 'btnSave');	
	    build_chk('2chkLevel1', 'chklevel1');
		build_chk('2chkLevel2', 'chklevel2');
		build_chk('2chkLevel3', 'chklevel3');
		build_chk('2chkLevel4', 'chklevel4');
		build_chk('2chkLevel5', 'chklevel5');
	    build_chk('chkbxStars', 'chkbxStars');
	    build_chk('chkbxEngSound', 'chkbxEngSound');
		build_chk('chkbxPortSound', 'chkbxPortSound');
	    build_btn('btnHideList', 'hidelist');
	    build_btn('hiddenfontsize', 'hidfont');
	    try {
	    	var_ClearList  = document.getElementById("btnClearList");
		    if (var_ClearList.value == 'yes') {
		        str1 = str1 + "&clearlist=yes";
		        var_ClearList.value = '';
		    }
	    } catch(e) {
	    	logMyErrors(21,e)
	    }
	    try {
	    	if (test == 1) {
	    	    var_directinput = document.getElementById("hiddenDirectInput");
	    	    if (var_directinput.value)
	    	    {
		        str1 = str1 + "&rowid=" + var_directinput.value;
		        var_directinput.value = "";
		        } else {
    		      	var_hiddenrowEnglish = document.getElementById("hiddenDirectInputWord");
    		        if (var_hiddenrowEnglish.value)
    		        {
    		        	str1 = str1 + "&englishin=" + var_hiddenrowEnglish.value;
    		        	//reset value so it doesn't continue to be reused on next card
    		        	var_hiddenrowEnglish.value = "";
    		        }
    		  	}
		    }
	    } catch(e) {
	    	logMyErrors(22,e)
	    }
		build_btn('txtUserID', 'userID');
	    build_btn('txtUserName', 'UserName');
	    build_btn('txtCurrentLang', 'fromlanguage');
	    build_btn('txtShowLargeSet', 'showall');
		if (x > 0)
		{
			str1 = str1 + "&islooping=y";
		}
	    test = test + 1;
	    
    if (xmlhttp) {
	    try {
		    url = "retrieveflipcard.asp" + str1;
		     xmlhttp.open("GET", url);
		     xmlhttp.onreadystatechange=function() {
		      if (xmlhttp.readyState==4) {
		       if (xmlhttp.responseText == "error") { 
					
		            alert("No words could be retrieved based on your options settings.\r\nAll of your options have been reset.\r\nClick OPTIONS to adjust your options")
		            window.location = "flashcard.asp?err=reset";
		            //xmlhttp.responseText = "";
		            
		       } else if (xmlhttp.responseText == "inputword") {
		       		alert("This word does not exist in the dictionary database.  Please try again.")
		            window.location = "flashcard.asp?err=reset";
		       } else {
			       //showtbloptions();
				   //showtbldetails();
			       ajaxDiv.innerHTML = unescape(xmlhttp.responseText);
			       if (document.layers) {
						cardinfo1 = document.layers["divCardInfo"];
					} else if (document.getElementById) {
						cardinfo1 = document.getElementById("divCardInfo");
					} else if (document.all) {
						cardinfo1 = document.all("divCardInfo");
					}
	                if (document.layers) {
						cardinfo2 = document.layers["divCardInfo2"];
					} else if (document.getElementById) {
						cardinfo2 = document.getElementById("divCardInfo2");
					} else if (document.all) {
						cardinfo2 = document.all("divCardInfo2");
					}
					//cardsetinfo = document.getElementById("divsetinfo");
					//cardinfooutput = document.getElementById("divCardInfoOutput");
					//cardinfooutput.innerHTML = cardsetinfo.innerHTML;
					//cardsetinfo.innerHTML = "";
	                //cardinfo2.innerHTML = cardinfo1.innerHTML;
	                //cardinfo1.innerHTML = "";
	                cardinfo1.style.height = "0px";
					hidetempajax();
					showajaxdiv();
					//scroll(0,0);
			 	}
		      } 
		     }
		     xmlhttp.send(null);
	    } catch(e) {
	    	try {
			    url = "flashcard4.asp" + str1;
			    varform = document.getElementById("flashcardform");
			    varform.action = url;
			    varform.submit();
			    
		    } catch(e) {
		    	logMyErrors(24,e)
		    	ajaxTempDiv.innerHTML = "<font size=3><strong> There was an error loading the functions of the page.<BR>" +
				"The flashcard page does not seem to work properly for your browser.  <BR><BR>" +
				"Please contact the website about this problem.  Sorry for the inconvenience.";
		    }
	    }
		
	} else {
		try {
		    url = "flashcard4.asp" + str1;
		    varform = document.getElementById("flashcardform");
		    varform.action = url;
		    varform.submit();
	    } catch(e) {
	    	logMyErrors(24,e)
	    	ajaxTempDiv.innerHTML = "<font size=3><strong> There was an error loading the functions of the page.<BR>" +
			"The flashcard page does not seem to work properly for your browser.  <BR><BR>" +
			"Please contact the website about this problem.  Sorry for the inconvenience.";
	    }
	}
}

function build_btn(name1, val1) {
	try {
		var var_btn =  document.getElementById(name1);
		if (var_btn.value) {
			if (str1.indexOf("=") > -1) {
				str1=str1+"&"+val1+"="+var_btn.value;
			} else {
				str1=str1+val1+"="+var_btn.value;
			}
		}
		
	} catch(e) {
		logMyErrors(name1,e)
	}
}
function build_chk(name1, val1) {
	try {
		var var_chk = document.getElementById(name1);
		if (var_chk.checked) {
			if (str1.indexOf("=") > -1) {
				str1=str1+"&"+val1+"="+var_chk.checked;
			} else {
				str1=str1+val1+"="+var_chk.checked;
			}
		}
		
	} catch(e) {
		logMyErrors(name1,e)
	}
}
function logMyErrors(varnum, e) {
	//alert(varnum + ". Error message: " + e);
}
function gotoEdit(rID) {
	stopCount();
    varSRC = "addword.asp?rowid=" + rID;
    document.getElementById("flipcardform").action = varSRC;
    document.getElementById("flipcardform").method = "post";
    document.getElementById("flipcardform").submit();
}
function setclearlist() {
    var_ClearList  = document.getElementById("btnClearList");
    var_ClearList.value = "yes"
}
function sethidelist(varIn) {
    var_HideList  = document.getElementById("btnHideList");
    var_HideList.value = varIn
}
function showtempajax() {
	if (document.layers) {
		ajaxTempDiv = document.layers["ajaxTemp"];
	} else if (document.getElementById) {
		ajaxTempDiv = document.getElementById("ajaxTemp");
	} else if (document.all) {
		ajaxTempDiv = document.all("ajaxTemp");
	}
	if (ajaxTempDiv) {
		ajaxTempDiv.style.visibility = "visible";
		ajaxTempDiv.style.diplay = "block";
		ajaxTempDiv.style.position = "relative";
		ajaxTempDiv.style.left = "120px";
		ajaxTempDiv.style.top = "0px";
	}
}

function showajaxdiv() {
	if (document.layers) {
		ajaxDiv = document.layers["ajaxflipcard"];
	} else if (document.getElementById) {
		ajaxDiv = document.getElementById("ajaxflipcard");
	} else if (document.all) {
		ajaxDiv = document.all("ajaxflipcard");
	}
	ajaxDiv.style.visibility = "visible";
	ajaxDiv.style.diplay = "block";
	ajaxDiv.style.position = "relative";
	ajaxDiv.style.left = "5px";
	ajaxDiv.style.top = "0px";
	ajaxDiv.style.height = "500px";
}
function hidetempajax() {
		if (document.layers) {
			ajaxTempDiv = document.layers["ajaxTemp"];
		} else if (document.getElementById) {
			ajaxTempDiv = document.getElementById("ajaxTemp");
		} else if (document.all) {
			ajaxTempDiv = document.all("ajaxTemp");
		}
	ajaxTempDiv.style.visibility = "hidden";
   ajaxTempDiv.style.diplay = "none";
   ajaxTempDiv.style.position = "absolute";
   ajaxTempDiv.style.left = "-5000px";
   ajaxTempDiv.style.top = "0px";
}
function hideajaxdiv() {
	if (document.layers) {
		ajaxDiv = document.layers["ajaxflipcard"];
	} else if (document.getElementById) {
		ajaxDiv = document.getElementById("ajaxflipcard");
	} else if (document.all) {
		ajaxDiv = document.all("ajaxflipcard");
	}
	if (ajaxDiv) {
		ajaxDiv.style.visibility = "hidden";
		ajaxDiv.style.diplay = "none";
		ajaxDiv.style.position = "absolute";
		ajaxDiv.style.left = "-5000px";
		ajaxDiv.style.top = "0px";
		//ajaxDiv.style.height = "0px";
	}
}
function hidetbloptions() {
	tblopt = document.getElementById("tbl_options");
	tblopt.style.visibility = "hidden";
	tblopt.style.diplay = "none";
	tblopt.style.position = "absolute";
	tblopt.style.left = "-5000px";
	tblopt.style.top = "0px";
//	tblopt2 = document.getElementById("tdsidepanel");
//	tblopt2.style.width = "0px";
}
function showtbloptions() {
	tblopt = document.getElementById("tbl_options");
	tblopt.style.visibility = "visible";
	tblopt.style.diplay = "block";
	tblopt.style.position = "relative";
	tblopt.style.left = "0px";
	tblopt.style.top = "0px";
}
function hidetbldetails() {
	tblopt = document.getElementById("tbl_details");
	tblopt.style.visibility = "hidden";
	tblopt.style.diplay = "none";
	tblopt.style.position = "absolute";
	tblopt.style.left = "-5000px";
	tblopt.style.top = "0px";
}
function showtbldetails() {
	tblopt2 = document.getElementById("tbl_details");
	tblopt2.style.visibility = "visible";
	tblopt2.style.diplay = "block";
	tblopt2.style.position = "relative";
	tblopt2.style.left = "0px";
	tblopt2.style.top = "0px";
}

function resetCategory() {
	document.getElementById("wordcategory1").options[0].selected=true;
	setdivval('hiddenCategory','');
}

function resetType() {
	document.getElementById("wordtype1").options[0].selected=true;
	setdivval('hiddenType','');
}

function resetTable() {
    setSource(document.getElementById("dictionary"));
}


function gotoNextCard() {
 	retrieveXML();
 	getIEFix();
}
function setCategory(cname) {
	var success = 0;
	resetType();
   	varWordCategory = document.getElementById("wordcategory1");
   	
	for (var i=0; i < varWordCategory.length; i++)
   	{
      		
   		if (varWordCategory.options[i].text == cname)
      	{
			varWordCategory.selectedIndex = i;
			//set the gameset name
			setGameSetName(varWordCategory.options[i].text);
			setdivval('hiddenCategory',varWordCategory.options[i].value);
      		success = 1;
      	}
   	}
   	if (success == 1) {
		retrieveXML();
   	} else {
		alert("Sorry, this category has not be populated for the language you are practicing");
	}
}
function setWordType(cname) {
	var success = 0;
	resetCategory();
   	varWordType = document.getElementById('wordtype1');  	
	for (var i=0; i < varWordType.length; i++)
   	{
   		if (varWordType.options[i].text == cname)
      	{
      		varWordType.selectedIndex = i;
			setGameSetName(varWordType.options[i].text);
			setdivval('hiddenType',varWordType.options[i].value);
      		success = 1;
      	}
   	}
   	if (success == 1) {
		retrieveXML();
   	} else {
		alert("Sorry, this word type has not be populated for the language you are practicing");
	}
}
function turnoffboxes() {
	stopCount();
 	document.getElementById("chkbxExamples").checked = false;
    document.getElementById("chkbxPictures").checked = false;
    document.getElementById("showans").checked = false;
    document.getElementById("chkbxEngSound").checked = false;
    document.getElementById("chbxSort").checked = false;
    document.getElementById("chkbxPortSound").checked = false;
    document.getElementById("chkbxStars").checked = false;
    document.getElementById("boxRequestExample").value = "";
    setSource(document.getElementById("dictionary"));
	hideStars2();
}
function hidealloptions() {
		hideFilter();
		hidequicklinks();
		hideLists2();
		hideListsAll();
		hideCategory();
		hideStars2();
}
function setDeluxe() {
	turnoffboxes();
 	document.getElementById("chkbxExamples").checked = true;
    document.getElementById("chkbxPictures").checked = true;
    document.getElementById("showans").checked = false;
    document.getElementById("chkbxEngSound").checked = true;
    document.getElementById("chbxSort").checked = false;
    document.getElementById("chkbxPortSound").checked = false;
    resetCategory();
    resetType();
	gotoNextCard();
}
function setsound() {
	document.getElementById('chkbxPortSound').checked=!(document.getElementById('chkbxPortSound').checked);
	retrieveXML();
}
function setExample() {
	turnoffboxes();
	example1 = document.getElementById("boxRequestExample");
	example1.value = "1";
	gotoNextCard();	
}
function setSource(ObjIn) {
	xHid = document.getElementById("hiddenTblSource");
	xHid.value = ObjIn;
}
function resetStars() {
	try {
	document.getElementById("2chkLevel1").checked = false;
    document.getElementById("2chkLevel2").checked = false;
    document.getElementById("2chkLevel3").checked = false;
	document.getElementById("2chkLevel4").checked = false;
	} catch(e) { logMyErrors(24,e) }
}
function showStars2() {
	StarRating4 = document.getElementById("divStarRating2");
	if (StarRating4.style.visibility == "hidden") {
		StarRating4.style.visibility = "visible";
		StarRating4.style.display = "block";
	} else {
		hideStars2();
	}
}
function hideStars2() {
	StarRating = document.getElementById("divStarRating2");
	StarRating.style.visibility = "hidden";
	StarRating.style.display = "none";
}
function showQuickLinks() {
	quicklinks = document.getElementById("divQuickLinks");
	if (quicklinks.style.visibility == "hidden") {
		quicklinks.style.visibility = "visible";
		quicklinks.style.display = "block";
	} else {
		hidequicklinks();
	}
}
function hidequicklinks() {
/*	quicklinks = document.getElementById("divQuickLinks");
	quicklinks.style.visibility = "hidden";
	quicklinks.style.display = "none";	
	*/
}
function showflashcardset() {
stopCount();
	flashcardset = document.getElementById("divflashcardset");
	if (flashcardset.style.visibility == "hidden") {
		flashcardset.style.visibility = "visible";
		flashcardset.style.display = "inline";
		
		hideajaxdiv();
		//alert("test");
		hidetempajax();
		//hidetbloptions();
		//hidetbldetails();
	} else {
		flashcardset.style.visibility = "hidden";
		flashcardset.style.display = "none";
		retrieveXML();
	}
}
function hideflashcardset() {
	flashcardset = document.getElementById("divflashcardset");
	if (flashcardset) {
		flashcardset.style.visibility = "hidden";
		flashcardset.style.display = "none";
	}
}
function showLists2() {
stopCount();
	StarRating = document.getElementById("divWordLists2");
	if (StarRating) {
		if (StarRating.style.visibility == "hidden") {
			StarRating.style.visibility = "visible";
			StarRating.style.display = "block";
		} else {
			hideLists2();
		}
	}
	
}
function showListsAll() {
stopCount();
	listview = document.getElementById("divWordListsAll");
	if (listview.style.visibility == "hidden") {
		listview.style.visibility = "visible";
		listview.style.display = "block";
	} else {
		hideListsAll();
	}	
}
function hideLists() {
	StarRating = document.getElementById("divWordLists");
	StarRating.style.visibility = "hidden";
	StarRating.style.display = "none";
}
function hideLists2() {
/*	StarRating = document.getElementById("divWordLists2");
	StarRating.style.visibility = "hidden";
	StarRating.style.display = "none";
	*/
}
function hideListsAll() {
stopCount();
	listview = document.getElementById("divWordListsAll");
	listview.style.visibility = "hidden";
	listview.style.display = "none";
}
function resetLists2() {
	document.getElementById('hiddenListSource').value='';
	var radioObj = document.getElementById('chkSavedList0');
	if (radioObj) 
	{
		var radioLength = radioObj.length;
		for(var i = 0; i < radioLength; i++) {
			radioObj[i].checked = false;
			
		}
	}
	document.getElementById("hiddenTblSource").value = "dictionary";
}
function hideCategory() {
	stopCount();
	divShowCategory2 = document.getElementById("divShowCategory");
	divShowCategory2.style.visibility = "hidden";
	divShowCategory2.style.display = "none";
}
function showCategory() {
	divShowCategory2 = document.getElementById("divShowCategory");
	if (divShowCategory2.style.visibility == "hidden") {
		divShowCategory2.style.visibility = "visible";
		divShowCategory2.style.display = "block";
		
	} else {
		hideCategory();
	}
}
function showFilter() {
stopCount();
	divFilter24 = document.getElementById("divFilter");
	if (divFilter24.style.visibility == "hidden") {
		divFilter24.style.visibility = "visible";
		divFilter24.style.display = "block";
	} else {
		hideFilter();
	}
}
function hideFilter() {
	divFilter24 = document.getElementById("divFilter");
	divFilter24.style.visibility = "hidden";
	divFilter24.style.display = "none";
}
function resetALL() {
	stopCount();
    resetStars();    
    resetType();
    resetCategory()
    resetTable();
    document.getElementById("boxRequestExample").value = "";
    setSource(document.getElementById("dictionary"));
}
function setFontSizeFlashCard(varSize) {
	var varQ = document.getElementById('spanQuestion');
	var varA = document.getElementById('spanAnswer');
	var varS = varQ.style.fontSize;
	var varS = parseInt(varS.replace('px',''));
	if ((varSize == 'increase')&&(varS <= 90)) {
		varS = varS + 10;
	} else if ((varS > 10) && (varSize =='decrease')) {
		varS = varS - 10;
	}
	document.getElementById("hiddenfontsize").value = varS;
	varQ.style.fontSize= varS + 'px';
	varA.style.fontSize= varS + 'px';
}
function setGameSetName(inname) {
	document.getElementById('hiddenGameSet').value = inname;
	setclearlist();
}
function ShowDiv(DivName)
{
	try {
		document.getElementById(DivName).style.display="";
		document.getElementById(DivName).style.visibility="visible";
	} catch(e) {
		logMyErrors(DivName,e)
	}
}
function HideDiv(DivName)
{
	try {
		document.getElementById(DivName).style.display="none";
		document.getElementById(DivName).style.visibility="hidden";
	} catch(e) {
		logMyErrors(DivName,e)
	}
}
function setPrevious() 
{
	document.getElementById("btnfromhistory").value="yes";
	stopCount();
}
function showexample(Div1,Div2) 
{
    divImage = document.getElementById(Div1);
    divText = document.getElementById(Div2);
    divText.style.visibility = "visible";
    divText.style.display = "inline";
    divImage.style.display = "none";

}
function showsavedlists()
{
	test = 1;
	var var_hiddenrowIdoutput=0;
   	try {
	    tempDiv = document.getElementById("divsavelist");
		

   	} catch (e) {
   		logMyErrors(1,e)
   	}
	try {
		    var_hiddenrowId = document.getElementById("hiddenRowIdCurrent");
			
		    if (var_hiddenrowId)
		    {
		        var_hiddenrowIdoutput = var_hiddenrowId.value
		    }
		    str1 = "?RID=" + var_hiddenrowIdoutput;
		} catch(e) {
			logMyErrors(2,e)
	    }
	   if (xmlhttp) {
	    try {
		    url = "showlists.asp" + str1;
		     xmlhttp.open("GET", url);
		     xmlhttp.onreadystatechange=function() {
		      if (xmlhttp.readyState==4) {
		       if (xmlhttp.responseText == "error") { 					
		            alert("there was a problem loading the saved word lists to this page. " +
		"please go to the word list menu to save the word directly");		             
		       } else {
			       tempDiv.innerHTML = unescape("Click a list below to automatically save the current word to it<BR>" + xmlhttp.responseText + "<BR>");			       
			 	}
		      } 
		     }
		     xmlhttp.send(null);
	    } catch(e) {
	    	 alert("there was a problem loading the saved word lists to this page. " +
		"please go to the word list menu to save the word directly");
	    }		
	} else {
		 alert("there was a problem loading the saved word lists to this page. " +
		"please go to the word list menu to save the word directly");
	}
}
var c=2
var t
var x=0
function timedCount()
{
x=1;
if ((c%2) == 1) {
	document.getElementById('showans').checked = false;
	retrieveXML();
	t=setTimeout("timedCount()",3000)
} else {
	toggleDivIndex();
	t=setTimeout("timedCount()",6500)
}

c=c+1
}

function stopCount()
{
clearTimeout(t)
x = 0;
}
function setPageHeight() {
}
function getIEFix() {
    objects = document.getElementsByTagName("object");
    for (var i = 0; i < objects.length; i++)
    {
        objects[i].outerHTML = objects[i].outerHTML;
    }
}
function saverating(rowID, varVal, tagname, tagnameoff1, tagnameoff2) 
{
	str1 = "?rowid=" + rowID + "&rating=" + varVal ;
	varValString = "";
	if (varVal == 1) varValString = "easy";
	if (varVal == 2) varValString = "medium";
	if (varVal == 3) varValString = "hard";

	url = "addrating.asp" + str1;
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange=function() {
	   if (xmlhttp.readyState==4) {
	        if (xmlhttp.responseText.length > 0) {
	            //alert("test" + xmlhttp.responseText);
	            alert("there was a problem saving your ratings.  Please notify the webmaster if this continues.");
	        } else {
	        	varTemp = document.getElementById('divMessage').innerHTML
	            document.getElementById('divMessage').innerHTML = varTemp + "<strong>You have rated this word with a difficulty level of: " + varValString + "</strong><BR>";

	        }
	   }
	}
	var_showans = document.getElementById(tagname);
	var_showans.style.border = "1px solid red"
	var_showans = document.getElementById(tagnameoff1);
	var_showans.style.border = ""
	var_showans = document.getElementById(tagnameoff2);
	var_showans.style.border = ""
	xmlhttp.send(null);
}
function toggleDivIndex(divName) {
    answerDiv = document.getElementById("answer");
    exampleimgdiv = document.getElementById("img2");
    showDiv = document.getElementById("divshow");
    if (answerDiv.style.visibility == "hidden") {
        answerDiv.style.visibility = "visible";
        answerDiv.style.display = "inline";
        exampleimgdiv.style.visibility = "hidden";
        exampleimgdiv.style.display = "none";
        
        showDiv.style.visibility = "hidden";
        showDiv.style.display = "none";
        
        //document.getElementById('button2').value='Hide Answer';
    }
    else {
        answerDiv.style.visibility = "hidden";
        exampleimgdiv.style.visibility = "visible";
        //document.getElementById('button2').value='View Answer';
    }
}
function savewordquality(rowID, varVal, tagname) {
	var str1 = "?rowid=" + rowID + "&rating=" + varVal ;
	url = "addquality.asp" + str1;
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange=function() {
	   if (xmlhttp.readyState==4) {
	        if (xmlhttp.responseText.length > 0) {
	            // alert("test" + xmlhttp.responseText);
	            alert("there was a problem saving your ratings.  Please notify the webmaster if this continues.");
	        } else {
	        	// alert("test" + xmlhttp.responseText);
	        	varTemp = document.getElementById('divMessage').innerHTML
	            document.getElementById('divMessage').innerHTML = varTemp + "<strong>You have rated this words usefulness as: <font size=+1>" + varVal + "</font></strong> out of 5<BR>";

	        }
	   }
	}
	var_showans = document.getElementById(tagname);
	var_showans.style.height = varVal * 10 + "px";
	var_showans.style.top = 50 - (varVal * 10) + "px";
	var_showans.style.visibility = "visible";
	xmlhttp.send(null);
}
function listspresets() {
resetType();resetCategory();resetStars();setSource('saved');document.getElementById('boxRequestExample').value = '';
}
function setdivval(divname, divval) {
	var tempdiv = document.getElementById(divname);
	if (tempdiv) {
	tempdiv.value = divval;
	}
}
function saverelevance(rowID, varVal) {
	if (xmlhttp) {
		str1 = "?rowid=" + rowID + "&status=" + varVal ;

		url = "addrelevance.asp" + str1;
		xmlhttp.open("GET", url);
		xmlhttp.onreadystatechange=function() {
		   if (xmlhttp.readyState==4) {
		        if (xmlhttp.responseText.length > 0) {
		            //alert("test" + xmlhttp.responseText);
		            alert("there was a problem setting the words relevance rating.  Please notify the webmaster if this continues.");
		        } else {
		        	
		        	if (varVal == 'good') {
						if (document.getElementById("imgThumbU")) {
							document.getElementById("imgThumbU").src="pageimages/thumb_upon.gif";
						}
		        		document.getElementById("imgThumbD").src="pageimages/thumb_down.gif";
		        	} else if (varVal == 'bad') {
		        		if (document.getElementById("imgThumbU")) {
			        		document.getElementById("imgThumbU").src="pageimages/thumb_up.gif";
						}
		        		document.getElementById("imgThumbD").src="pageimages/thumb_downon.gif";
		        	}
		        	
		        	varTemp = document.getElementById('divMessage').innerHTML
		            document.getElementById('divMessage').innerHTML = varTemp + "<strong>The current word has been marked as: <font size=+1>" + varVal + "</font></strong>. <br>We appreciate user input like this. Please do it often.<BR>";
		        }
		   }
		}  
		xmlhttp.send(null);
	}
}
function saveWord(rowID, varVal, varList_ID, divcomment, divimage) {
	try {
		if (xmlhttp) {
			str1 = "?rowid=" + rowID + "&status=" + varVal + "&listid=" + varList_ID;
			url = "addSaved.asp" + str1;
			//alert ("url: " + url);
			xmlhttp.open("GET", url);
			xmlhttp.onreadystatechange=function() {
			   if (xmlhttp.readyState==4) {
			        if (xmlhttp.responseText.length > 0) {
			            alert("error: " + xmlhttp.responseText+"  there was a problem saving this word.  Please notify the webmaster if this problem continues to happen.");
			        } else {
			        	if (varVal == "add") {
				        	varTemp = document.getElementById(divcomment).innerHTML
				            document.getElementById(divcomment).innerHTML = varTemp + "<strong>This Word has been added to the selected list.<BR></strong>";
				            document.getElementById(divimage).src="pageimages/lock_add.gif";
			        	} else if (varVal == "copy") {
			        		varTemp = document.getElementById(divcomment).innerHTML
				            document.getElementById(divcomment).innerHTML = varTemp + "<strong>This list has been copied to your own list set.<BR></strong>";
				            document.getElementById(divimage).src="pageimages/lock_add.gif";
			        	} else {
			        		varTemp = document.getElementById(divcomment).innerHTML
				            document.getElementById(divcomment).innerHTML = varTemp + "<strong>This Word has been deleted from your General Personal Word List.<BR></strong>";
				            document.getElementById(divimage).src="pageimages/tick_red.gif";
			        	}
			        }
			   }
			}  
			xmlhttp.send(null);
		}
	} catch(e) {
		logMyErrors(24,e)
	}
}	
