var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) {
xmlhttp=false
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
try {
xmlhttp = new XMLHttpRequest ();
}
catch (e) {
xmlhttp = false}
}
function myXMLHttpRequest ()
{
var xmlhttplocal;
try {
xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
catch (e) {
try {
xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
catch (E) {
xmlhttplocal = false;
}
}
if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
try {
var xmlhttplocal = new XMLHttpRequest ();
}
catch (e) {
var xmlhttplocal = false;
}
}
return (xmlhttplocal);
}
var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;
function menealo (user, id, htmlid, md5, value)
{
if (xmlhttp) {
// Sameer: Subdomain (www) is required to avoid "Permission denied to call method XMLHttpRequest.open" error
url = "/quiz-school/menealo.php";
//url = "http://www.proprofs.com/quiz-school/menealo.php";
var content = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
anonymous_vote = false;
mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
if (mnmxmlhttp) {
mnmxmlhttp[htmlid].open ("POST", url, true);
mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
'application/x-www-form-urlencoded');
mnmxmlhttp[htmlid].send (content);
errormatch = new RegExp ("^ERROR:");
target1 = document.getElementById ('mnms-' + htmlid);
mnmPrevColor[htmlid] = target1.style.backgroundColor;
//target1.style.background = '#9B2A29';
//target1.style.backgroundColor = '#FF9D9F';
mnmxmlhttp[htmlid].onreadystatechange = function () {
if (mnmxmlhttp[htmlid].readyState == 4) {
mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
if (mnmString[htmlid].match (errormatch)) {
mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
// myclearTimeout(row);
// resetrowfull(row);
changemnmvalues (htmlid, true);
} else {
changemnmvalues (htmlid, false);
}
}
}
}
}
}
function cvote (user, id, htmlid, md5, value)
{
if (xmlhttp) {
// Sameer: Subdomain (www) is required to avoid "Permission denied to call method XMLHttpRequest.open" error
url = "/quiz-school/cvote.php";
//url = "http://www.proprofs.com/quiz-school/cvote.php";
content = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
anonymous_vote = false;
mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
if (mnmxmlhttp) {
mnmxmlhttp[htmlid].open ("POST", url, true);
mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
'application/x-www-form-urlencoded');
mnmxmlhttp[htmlid].send (content);
errormatch = new RegExp ("^ERROR:");
target1 = document.getElementById ('cvote-' + htmlid);
mnmPrevColor[htmlid] = target1.style.backgroundColor;
//target1.style.background = '#9B2A29';
target1.style.backgroundColor = '#FFFFFF';
mnmxmlhttp[htmlid].onreadystatechange = function () {
if (mnmxmlhttp[htmlid].readyState == 4) {
mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
if (mnmString[htmlid].match (errormatch)) {
mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
// myclearTimeout(row);
// resetrowfull(row);
changecvotevalues (htmlid, true);
} else {
target1 = document.getElementById ('ratebuttons-' + id);
target1.style.display = "none";
target2 = document.getElementById ('ratetext-' + id);
target2.innerHTML = "Thank you for rating this comment.";
changecvotevalues (htmlid, false);
}
}
}
}
}
}
function changemnmvalues (id, error)
{
split = new RegExp ("~--~");
b = mnmString[id].split (split);
//alert(id);
target1 = document.getElementById ('mnms-' + id);
target2 = document.getElementById ('mnmlink-' + id);
if (error) {
target2.innerHTML = "Rated ";
return false;
}
if (b.length <= 3) {
target1.innerHTML = b[0];
target1.style.backgroundColor = mnmPrevColor[id];
target2.innerHTML = "Thank you for your rate! ";
}
return false;
}
function changecvotevalues (id, error)
{
split = new RegExp ("~--~");
b = mnmString[id].split (split);
//alert(id);
target1 = document.getElementById ('cvote-' + id);
//target2 = document.getElementById ('mnmlink-' + id);
if (error) {
// target2.innerHTML = "vote cast";
return false;
}
if (b.length <= 3) {
target1.innerHTML = b[0];
target1.style.backgroundColor = mnmPrevColor[id];
// target2.innerHTML = "vote cast";
}
return false;
}
function enablebutton (button, button2, target)
{
var string = target.value;
button2.disabled = false;
if (string.length > 0) {
button.disabled = false;
} else {
button.disabled = true;
}
}
function checkfield (type, form, field)
{
// Sameer: Subdomain (www) is required to avoid "Permission denied to call method XMLHttpRequest.open" error
url = '/quiz-school/checkfield.php?type='+type+'&name=' + field.value;
//url = 'http://www.proprofs.com/quiz-school/checkfield.php?type='+type+'&name=' + field.value;
checkitxmlhttp = new myXMLHttpRequest ();
checkitxmlhttp.open ("GET", url, true);
checkitxmlhttp.onreadystatechange = function () {
if (checkitxmlhttp.readyState == 4) {
responsestring = checkitxmlhttp.responseText;
if ( responsestring.search('OK') == -1 ) {
document.getElementById (type+'checkitvalue').innerHTML = '"' + field.value + '" : ' + responsestring + '';
} else {
document.getElementById (type+'checkitvalue').innerHTML = '"' + field.value + '" : ' + responsestring + '';
}
}
}
// xmlhttp.setRequestHeader('Accept','message/x-formresult');
checkitxmlhttp.send (null);
return false;
}
//SKGS: 11/10/2007
//function checkUserInputs(), for validation passwords field in registration form
function checkUserInputs(userName, uMsg, emailAdd, eMsg, passA, passB, pMsg2, terms, tMsg)
{
if ( userName == "" )
{
document.getElementById (uMsg).innerHTML = 'please choose your username';
}
if ( emailAdd == "" )
{
document.getElementById (eMsg).innerHTML = 'email should not be left blank';
}
if ( passA.length < 5 )
{
document.getElementById (pMsg2).innerHTML = 'your password must be at least 5 characters long';
return false;
}
else if ( passA != passB )
{
document.getElementById (pMsg2).innerHTML = 'passwords do not match';
return false;
}
else
{
document.getElementById (pMsg2).innerHTML = 'password: OK';
}
if (terms == false)
{
document.getElementById (tMsg).innerHTML = 'please agree to our terms and conditions to register';
return false;
}
return true;
}
function report_problem(frm, user, id, md5 /*id, code*/) {
if (frm.ratings.value == 0)
return;
if (! confirm("do you wish to report the problem?") ) {
frm.ratings.selectedIndex=0;
return false;
}
content = "id=" + id + "&user=" + user + "&md5=" + md5 + '&value=' +frm.ratings.value;
url="http://www.proprofs.com/quiz-school/problem.php?" + content;
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
frm.ratings.disabled=true;
alert(xmlhttp.responseText);
}
}
xmlhttp.send(null);
return false;
}
function emailto (original_id, htmlid, instpath, address_count)
{
email_message = document.getElementById('email_message' + htmlid).value;
//proprofscc : Code added for plaxo module
email_address = document.getElementById('recipient_list').value;
//proprofscc: 29/10/2007: email from field added in recommend form
email_from_name = document.getElementById('email_from_name').value;
//proprofscc : 04/10/07: Commented, for plaxo module embedding
/* email_address = document.getElementById('email_address_1_' + htmlid).value;
if (address_count > 1){
for ($i = 2; $i <= address_count; $i++) {
if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
}
}
}
*/
if (xmlhttp) {
// Sameer: Subdomain (www) is required to avoid "Permission denied to call method XMLHttpRequest.open" error
url = "http://www.proprofs.com/quiz-school/recommend.php";
//url = "http://www.proprofs.com/quiz-school/recommend.php";
content = "email_from_name=" + escape(email_from_name) + "&email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = '
Sending, please wait....';
mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
if (mnmxmlhttp) {
mnmxmlhttp[htmlid].open ("POST", url, true);
mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
'application/x-www-form-urlencoded');
mnmxmlhttp[htmlid].send (content);
errormatch = new RegExp ("^ERROR:");
target1 = document.getElementById ('emailto-' + htmlid);
mnmxmlhttp[htmlid].onreadystatechange = function () {
if (mnmxmlhttp[htmlid].readyState == 4) {
mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
if (mnmString[htmlid].match (errormatch)) {
mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = mnmString[htmlid];
} else {
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = mnmString[htmlid];
}
}
}
}
}
}
function show_recommend(htmlid, linkid, instpath)
{
var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;
if (xmlhttp) {
// Sameer: Subdomain (www) is required to avoid "Permission denied to call method XMLHttpRequest.open" error
url = "http://www.proprofs.com/quiz-school/recommend.php";
//url = "http://www.proprofs.com/quiz-school/recommend.php";
content = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = '
Loading, please wait....';
mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
if (mnmxmlhttp) {
mnmxmlhttp[htmlid].open ("POST", url, true);
mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
'application/x-www-form-urlencoded');
mnmxmlhttp[htmlid].send (content);
errormatch = new RegExp ("^ERROR:");
target1 = document.getElementById ('emailto-' + htmlid);
mnmxmlhttp[htmlid].onreadystatechange = function () {
if (mnmxmlhttp[htmlid].readyState == 4) {
mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
if (mnmString[htmlid].match (errormatch)) {
mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = mnmString[htmlid];
} else {
target2 = document.getElementById ('emailto-' + htmlid);
target2.innerHTML = mnmString[htmlid];
}
}
}
}
}
}