var xmlHttp

function sendMail(str)
{ 
document.getElementById('txtHint2').className='ajax_load_process1';
document.getElementById('btnSubmit').className='ajax_load_button';

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 


var url="inc_contact_cgi.php";


var selType = document.getElementById('selType').value;
var txtSubject = document.getElementById('txtSubject').value;
var txtName = document.getElementById('txtName').value;
var txtMail = document.getElementById('txtMail').value;
var txtComment = document.getElementById('txtComment').value;
var selPrio = document.getElementById('selPrio').value;

if ( (document.form1.txtMail.value.indexOf('@') == -1) || (document.form1.txtMail.value.indexOf('.') == -1) ) {
//alert("Enter a valid email address. eg : admin@mylearningfriend.com");
var txtMail = "error";
}

url=url+"?selType="+selType;
url=url+"&txtSubject="+txtSubject+"&txtName="+txtName+"&txtMail="+txtMail+"&txtComment="+txtComment+"&selPrio="+selPrio; 

//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
document.getElementById('txtHint2').className='';
document.getElementById('btnSubmit').className='';
}
}


//send comment resources
function sendComment(str)
{ 

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 


var url="inc_resources_comments.php";


var selType = document.getElementById('selType').value;
var txtSubject = document.getElementById('txtSubject').value;
var txtName = document.getElementById('txtName').value;
var txtMail = document.getElementById('txtMail').value;
var txtComment = document.getElementById('txtComment').value;
var selPrio = document.getElementById('selPrio').value;

if ( (document.form1.txtMail.value.indexOf('@') == -1) || (document.form1.txtMail.value.indexOf('.') == -1) ) {
//alert("Enter a valid email address. eg : admin@mylearningfriend.com");
var txtMail = "error";
}

url=url+"?selType="+selType;
url=url+"&txtSubject="+txtSubject+"&txtName="+txtName+"&txtMail="+txtMail+"&txtComment="+txtComment+"&selPrio="+selPrio; 

//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged2() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("showComment").innerHTML=xmlHttp.responseText;
}
}


//send password recovery
function lostPassword(str)
{ 
document.getElementById('txtHintRecover').className='ajax_load_process1';
document.getElementById('txtHintRecover').value = '';

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="login_recover_password.php";


var mail_lost = document.getElementById('mail_lost').value;

if ( (document.frmLost.mail_lost.value.indexOf('@') == -1) || (document.frmLost.mail_lost.value.indexOf('.') == -1) ) {
var txtMail = "error";
}

url=url+"?mail_lost="+mail_lost;
url=url+"&txtMail="+txtMail; 

xmlHttp.onreadystatechange=stateLost;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateLost() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHintRecover").innerHTML=xmlHttp.responseText;
document.getElementById('txtHintRecover').className='ajax_load_process1Done';
}
}



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}