function sendFriend() {
  document.getElementById('friendFormdata').innerHTML = '';
  document.getElementById('friend').className='fshow';
  if (document.getElementById('jstest2')) document.getElementById('jstest2').className='jshide';
  if (document.getElementById('jstest3')) document.getElementById('jstest3').className='jshide';
    xmlHttp99=ajax2Object();
    ajax2Check(xmlHttp99); 
    var url='src/friendForm.php?'+Math.random();
    xmlHttp99.onreadystatechange = function() { loadFriendPage(); }
    xmlHttp99.open("GET",url,true);
    xmlHttp99.send(null);  
  //document.location.hash = 'top';
  scroll(0,0);
}
function closeFriend() {
  document.getElementById('friend').className='friend';
  if (document.getElementById('jstest2')) document.getElementById('jstest2').className='jsshow';
  if (document.getElementById('jstest3')) document.getElementById('jstest3').className='jsshow';
}

function ajax2Object() {
  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;
}

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


function friendLink(itemid) {
  var frome = document.forms['friendlink'].frome.value;
  var toe = document.forms['friendlink'].toe.value;
  var subj = document.forms['friendlink'].subj.value;
  var msg = document.forms['friendlink'].msg.value;
  
  if (frome == "") alert("You must enter your email")
  else if (toe == "") alert("You must enter your friend's email")
  else if (subj == "") alert("You must enter a subject")
  else if (msg == "") alert("You must enter a message")
  else {
    xmlHttp99=ajax2Object();
    ajax2Check(xmlHttp99); 
    var url='src/friendSend.php?ajax=true&action=send&frome='+frome+'&toe='+toe+'&subj='+subj+'&msg='+encodeURI(msg)+'&'+Math.random();
    xmlHttp99.onreadystatechange = function() { loadFriendPage(); }
    xmlHttp99.open("GET",url,true);
    xmlHttp99.send(null);
  } 
}
function loadFriendPage() { 
  if (xmlHttp99.responseText != "") document.getElementById('friendFormdata').innerHTML =xmlHttp99.responseText;
}
