
var xmlHttp;
var vcount=1;
var gemail;
var Wstr;
var Wstr2;
var mStatus;
var toID;
var msID;
var openAlbum;
var openImage;
var tempid;

function communityChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("communityHere").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function num_abbrev_str(num) {
if (typeof num == 'number') {
num = num.toString()
}
var len = num.length, last_char = num.charAt(len - 1), abbrev
if (len == 2 && num.charAt(0) == '1') {
abbrev = 'th'
} else {
if (last_char == '1') {
abbrev = 'st'
} else if (last_char == '2') {
abbrev = 'nd'
} else if (last_char == '3') {
abbrev = 'rd'
} else {
abbrev = 'th'
}
}
return num + abbrev
}

// Register Functions ---------------------------------------------------------------------------------------------------

function cRegister(){

var result = "&nbsp;Required&nbsp;";
document.getElementById('a11').innerHTML = "";
document.getElementById('a22').innerHTML = "";
document.getElementById('a3').innerHTML = "";
document.getElementById('a4').innerHTML = "";
document.getElementById('a5').innerHTML = "";
document.getElementById('a6').innerHTML = "";
document.getElementById('a7').innerHTML = "";
document.getElementById('a8').innerHTML = "";
document.getElementById('a9').innerHTML = "";
document.getElementById('a10').innerHTML = "";


if(document.register.fname.value==""){
document.getElementById('a11').innerHTML = result;
return;
}
if(document.register.sname.value==""){
document.getElementById('a22').innerHTML = result;
return;
}
if(document.register.emailaddress1.value==""){
document.getElementById('a3').innerHTML = result;
return;
}
if(document.register.emailaddress2.value==""){
document.getElementById('a4').innerHTML = result;
return;
}
if(document.register.password1.value==""){
document.getElementById('a5').innerHTML = result;
return;
}
if(document.register.password2.value==""){
document.getElementById('a6').innerHTML = result;
return;
}
if(document.register.securityQuestion.value=="none"){
document.getElementById('a7').innerHTML = result;
return;
}
if(document.register.securityAnswer.value==""){
document.getElementById('a8').innerHTML = result;
return;
}
if(document.register.screenName.value==""){
document.getElementById('a9').innerHTML = result;
return;
}
if(document.register.dYear.value=="1900"){
document.getElementById('a10').innerHTML = result;
return;
}
if(document.register.emailaddress1.value!=document.register.emailaddress2.value){
document.getElementById('a4').innerHTML = "&nbsp;Email Address does not match&nbsp;";
return;
}
if(document.register.password1.value!=document.register.password2.value){
document.getElementById('a6').innerHTML = "&nbsp;Password does not match&nbsp;";
return;
}

var pcount = document.register.password2.value;
if(pcount.length <8 || pcount.length > 12){
document.getElementById('a5').innerHTML = "&nbsp;Password must be between 8 and 12 characters&nbsp;";
return;
}

for(var j=0; j<pcount.length; j++)
{
var alphaa = pcount.charAt(j);
var hh = alphaa.charCodeAt(0);
if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
{
}
else{
document.getElementById('a5').innerHTML = "&nbsp;Password may only contain letters and numbers&nbsp;";
return;
}
}

if(pcount.match(/[\d\.]+/g)){
//nothing
}else{
document.getElementById('a5').innerHTML = "&nbsp;Password must contain a number&nbsp;";
return;
}

checkUserName(document.register.emailaddress1.value);
}


function cRegisterReset(){
document.register.reset();
document.getElementById('a11').innerHTML = "";
document.getElementById('a22').innerHTML = "";
document.getElementById('a3').innerHTML = "";
document.getElementById('a4').innerHTML = "";
document.getElementById('a5').innerHTML = "";
document.getElementById('a6').innerHTML = "";
document.getElementById('a7').innerHTML = "";
document.getElementById('a8').innerHTML = "";
document.getElementById('a9').innerHTML = "";
document.getElementById('a10').innerHTML = "";
}


function checkUserName(obj){
var thisLot = "emailaddress=" + encodeURIComponent(obj);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/checkEmailAddress.asp";
xmlHttp.onreadystatechange = checkNames;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function checkScreenName(obj){
var thisLot = "screenname=" + encodeURIComponent(obj);
var url="/community/resource/working/checkScreenName.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = checkNames2;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

}

function checkNames() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
          if(xmlHttp.responseText=="OK"){
//sendRegister();
checkScreenName(document.register.screenName.value);
		  }
		 else {
document.getElementById('a3').innerHTML = "&nbsp;Already in use by another member&nbsp;";
return;
 }
         } else {
            //alert('There was a problem with the request.');
         }
      }   
   } 


function checkNames2() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
          if(xmlHttp.responseText=="OK"){
sendRegister();
		  }
		 else {
document.getElementById('a9').innerHTML = "&nbsp;Already in use by another member&nbsp;";
return;
 }
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
function sendRegister(){
var thisLot;
thisLot =  "fname=" + encodeURIComponent(document.register.fname.value);
thisLot = thisLot + "&sname=" + encodeURIComponent(document.register.sname.value);
thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.register.emailaddress2.value);
thisLot = thisLot + "&password=" + encodeURIComponent(document.register.password2.value);
thisLot = thisLot + "&securityQuestion=" + encodeURIComponent(document.register.securityQuestion.value);
thisLot = thisLot + "&securityAnswer=" + encodeURIComponent(document.register.securityAnswer.value);
thisLot = thisLot + "&screenName=" + encodeURIComponent(document.register.screenName.value);

if(document.register.dYear.value=="1901"){
document.getElementById('a10').innerHTML = "&nbsp;Required&nbsp;";
return;
}

var dob = document.register.dDay.value + "/" + document.register.dMonth.value + "/" + document.register.dYear.value;
thisLot = thisLot + "&dob=" + encodeURIComponent(dob);

var url="/community/resource/working/registerUser.asp";
//document.location.href=url+"?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = communityChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


// Login Functions ---------------------------------------------------------------------------------------------------

function cLogin(){

var result = "&nbsp;Required&nbsp;";
document.getElementById('a1').innerHTML = "";
document.getElementById('a2').innerHTML = "";

if(document.login.emailaddress1.value==""){
document.getElementById('a1').innerHTML = result;
return;
}
if(document.login.password1.value==""){
document.getElementById('a2').innerHTML = result;
return;
}

sendLogin();
}

function cLoginReset(){
document.login.reset();
document.getElementById('a1').innerHTML = "";
document.getElementById('a2').innerHTML = "";
}

function sendLogin(){
var thisLot;
thisLot = "emailaddress=" + encodeURIComponent(document.login.emailaddress1.value);
thisLot = thisLot + "&ipassword=" + encodeURIComponent(document.login.password1.value);

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/community/resource/working/checkLogin.asp";
xmlHttp.onreadystatechange = checkLogin;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function checkLogin() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
          if(xmlHttp.responseText=="1"){
document.location.href="/profile-home.asp";
		  }
		            if(xmlHttp.responseText=="2"){
document.getElementById('a1').innerHTML = "&nbsp;!&nbsp;Username not recognised&nbsp;";
return;
		  }
		  		            if(xmlHttp.responseText=="4"){
openAlert('ACCESS DENIED','Your membership to Interact has been suspended. Please contact members@I=interactgroup.co.uk if you think you have been treated unfairly or believe the suspension to be an error.');
return;
		  }
		  		  		            if(xmlHttp.responseText=="5"){
openAlert('Activation Required','Your membership to Interact has not been activated. On joining, we sent you an email containing a link you must click to activate your account. Once activated, you will be able to log-in normally.');
return;
		  }          
		  if(xmlHttp.responseText=="3"){
document.getElementById('a2').innerHTML = "&nbsp;<a href=/forgotten-password.asp class=topLink>Forgotten your password?</a>";
		  }
         } else {
            //
         }
      }   
   } 
   
function p1(){
document.getElementById('dPass').innerHTML = "When you registered, I asked you a <b>security question</b><br><br><input type=button name=Button value=Next onClick=p2();>";

 }
 
function p2(){
var thisLot;
thisLot = "emailaddress=" + encodeURIComponent(window.gemail);

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/community/resource/working/fp1.asp";
xmlHttp.onreadystatechange = fp1;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
 
 function fp1() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
          if(xmlHttp.responseText=="1"){
document.location.href="/log-in.asp"
		  }
		  else{
document.getElementById('dPass').innerHTML = xmlHttp.responseText;
		  }
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   function p3(){
var thisLot;
thisLot = "securityanswer=" + encodeURIComponent(document.passwordForm.securityanswer.value);

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  
var url="/community/resource/working/fp2.asp";
xmlHttp.onreadystatechange = fp2;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

 function fp2() {
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {       
document.getElementById('dPass').innerHTML = xmlHttp.responseText;
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   // Profile Functions -------------------------------------------------------------------------------------
   
   function showProfile(){
var thisLot="1";

var url="/community/resource/working/profile.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function showBranches(){
var thisLot="1";

var url="/community/resource/furniture/branchesDisplay2.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function showPhotos(){
var thisLot="1";
var url="/photos/resource/furniture/image-home.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
   
   function popContact(){
openAlert('Can we contact you?','From time to time, we may wish to contact you with offers from third party companies - although, we will never pass your contact information to them directly.<br><br>If you do not wish to be contacted,please change the status of this drop down selection.');
}

function popPrivacy(){
openAlert('Profile Privacy','If you select ON, only accepted friends will be able to view your friends and full profile detail');
}

function updateProfile(){
var result = "&nbsp;Please confirm your password&nbsp;";
document.getElementById('a1').innerHTML = "";

if(document.pForm.emailaddress1.value==""){
alert("You cannot have a blank EMAIL ADDRESS")
return;
}

if(document.pForm.securityanswer.value==""){
alert("You cannot have a blank SECURITY ANSWER")
return;
}

if(document.pForm.password2.value==""){
document.getElementById('a1').innerHTML = result;
return;
}

if(document.pForm.password1.value!=document.pForm.password2.value){
alert("Password does not match");
return;
}

var pcount = document.pForm.password2.value;
if(pcount.length <8 || pcount.length > 12){
alert("Password must be between 8 and 12 characters");
return;
}

for(var j=0; j<pcount.length; j++)
{
var alphaa = pcount.charAt(j);
var hh = alphaa.charCodeAt(0);
if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
{
}
else{
alert("Password may only contain letters and numbers");
return;
}
}

if(pcount.match(/[\d\.]+/g)){
//nothing
}else{
alert("Password must contain a number");
return;
}
thisLot ="id=" + encodeURIComponent(document.pForm.id.value);
thisLot = thisLot + "&emailaddress=" + encodeURIComponent(document.pForm.emailaddress1.value);
thisLot = thisLot + "&ipassword=" + encodeURIComponent(document.pForm.password2.value);
thisLot = thisLot + "&securityquestion=" + encodeURIComponent(document.pForm.securityquestion.value);
thisLot = thisLot + "&securityanswer=" + encodeURIComponent(document.pForm.securityanswer.value);
thisLot = thisLot + "&cancontact=" + encodeURIComponent(document.pForm.cancontact.value);
thisLot = thisLot + "&privacy=" + encodeURIComponent(document.pForm.privacy.value);

var url="/community/resource/working/updateProfile.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = profileUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function profileUpdate() {
document.getElementById('updateHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		 //alert("done");
document.getElementById('updateHere').innerHTML = "";
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
  
 
function updateProfileData(){
thisLot ="acode=" + encodeURIComponent(document.pForm2.acode.value);
thisLot = thisLot + "&q1=" + encodeURIComponent(document.pForm2.q1.value);
thisLot = thisLot + "&q2=" + encodeURIComponent(document.pForm2.q2.value);
thisLot = thisLot + "&q3=" + encodeURIComponent(document.pForm2.q3.value);
thisLot = thisLot + "&q6=" + encodeURIComponent(document.pForm2.q6.value);
thisLot = thisLot + "&q7=" + encodeURIComponent(document.pForm2.q7.value);
thisLot = thisLot + "&q8=" + encodeURIComponent(document.pForm2.q8.value);
thisLot = thisLot + "&q9=" + encodeURIComponent(document.pForm2.q9.value);
thisLot = thisLot + "&q10=" + encodeURIComponent(document.pForm2.q10.value);
thisLot = thisLot + "&q11=" + encodeURIComponent(document.pForm2.q11.value);
thisLot = thisLot + "&q12=" + encodeURIComponent(document.pForm2.q12.value);
thisLot = thisLot + "&q13=" + encodeURIComponent(document.pForm2.q13.value);
thisLot = thisLot + "&q14=" + encodeURIComponent(document.pForm2.q14.value);
thisLot = thisLot + "&q15=" + encodeURIComponent(document.pForm2.q15.value);
thisLot = thisLot + "&q16=" + encodeURIComponent(document.pForm2.q16.value);
thisLot = thisLot + "&q17=" + encodeURIComponent(document.pForm2.q17.value);
thisLot = thisLot + "&q18=" + encodeURIComponent(document.pForm2.q18.value);
thisLot = thisLot + "&q19=" + encodeURIComponent(document.pForm2.q19.value);
thisLot = thisLot + "&q20=" + encodeURIComponent(document.pForm2.q20.value);

var url="/community/resource/working/updateProfileData.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = profileUpdateData;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function profileUpdateData() {
document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		 //alert("done");
document.getElementById('updateDataHere').innerHTML = "";
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   // Search ------------------------------------------------------------------------------------
   
function pSearch(){

thisLot ="pText=" + encodeURIComponent(document.pSearch.pText.value);


var url="/community/resource/working/pSearch.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pSearchUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function pSearchUpdate() {
document.getElementById('profileChangeHere').innerHTML = "<center><p><p><p><img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		 if(xmlHttp.responseText=="none"){
		 }
		 else {
document.getElementById('profileChangeHere').innerHTML = xmlHttp.responseText;
document.pSearch.pText.value="Find friends...";
document.pSearch.pText.blur();
}
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   // Misc Functions
   
   function searchClick(){
   document.pSearch.pText.value="";
   }
   
    function searchClickReset(){
   //document.pSearch.pText.value="Find friends...";
   }
   
      function searchClickGroup(){
   document.gSearch.gText.value="";
   }
   
    function searchClickResetGroup(){
   //document.gSearch.gText.value="Find groups...";
   }
   
   // Friends -----------------------------------------------------------------
   
   function fAdd(obj){
thisLot ="fAdd=" + encodeURIComponent(obj);


var url="/community/resource/working/fAdd.asp";
//document.location.href=url +"?" + thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = fAddUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function fAddUpdate() {
//document.getElementById('profileChangeHere').innerHTML = "<center><br><br><br><img src=/community/resource/graphics/sgLoader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		 if (xmlHttp.responseText=="1"){ 
		 openAlert('Add Connection','A connection request has been sent.<br><br>Your connection will need to accept your request before you see them within your connection list');
		 }
		 else{
		 openAlert('Add Connection','You already have a connection with this member');
		 }
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
function openAlert(str,str2){
Wstr = str;
Wstr2 = str2;

document.getElementById('divThis').style.display='';
document.getElementById('apDiv1').style.display='';
document.body.scroll="no";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/alertPop.asp";
url=url+"?aHead="+Wstr + "&aText="+Wstr2 +"&$=" +new Date().getTime();
xmlHttp.onreadystatechange=displayAlert;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function pFriend(){

var thisLot="1"

var url="/community/resource/working/friendRequest.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;

xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function pFriendUpdate() {
document.getElementById('profileChangeHere').innerHTML = "<p><p><p><center><p><p><p><img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		document.getElementById('profileChangeHere').innerHTML = xmlHttp.responseText;
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
function fAccept(){
 if (confirm('Are you sure you want to ACCEPT this selection(s)?')) {
	for (i=0; i<document.formAccept.elements.length; i++) { 
		el = document.formAccept.elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
			if (el.checked) {
			var id = el.name.replace(/checkbox/, "");
			fAcceptMe(id);
}
		} 
	}
setTimeout("document.location.href='/profile-home.asp'",500);
	}
}

function fAcceptMe(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/friendAccept.asp";
url=url+"?id="+id;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function fDecline(){
 if (confirm('Are you sure you want to DECLINE this selection(s)?')) {
	for (i=0; i<document.formAccept.elements.length; i++) { 
		el = document.formAccept.elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
			if (el.checked) {
			var id = el.name.replace(/checkbox/, "");
			fDeclineMe(id);
}
		} 
	}
setTimeout("document.location.href='/profile-home.asp'",500);
	}
}

function fDeclineMe(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/friendDecline.asp";
url=url+"?id="+id;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showFriends(){
var thisLot="1"

var url="/community/resource/working/friendShow.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot)

}


function removeFriend(obj){
if (confirm('Are you sure you want to REMOVE this friend?')) {
fDeclineMe(obj);
setTimeout("showFriends()",500);
}
}
   

// Alert function ----------------------------------------------------------------------
function displayAlert(){ 
document.getElementById("newsHere").innerHTML="<br/><br/><br/><br/><center><img src=/forum/resource/graphics/loader.gif></center>";
if (xmlHttp.readyState==4)
{ 
document.getElementById("newsHere").innerHTML=xmlHttp.responseText;
//resetAll();
}
else {
document.getElementById("newsHere").innerHTML="<br/><br/><br/><br/><center><img src=/community/resource/graphics/sgLoader.gif></center>";
}
}

function closeAlert(){
document.getElementById('divThis').style.display='none';
document.getElementById('apDiv1').style.display='none';
document.body.scroll="yes";
}


// Mail Functions -------------------------------------------------------------------------

function showMail(){
var thisLot="1"

var url="/community/resource/working/mailShow.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
 //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function showMailSent(){
var thisLot="1"

var url="/community/resource/working/mailShowSent.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function mailNew(obj){

var thisLot="n=1"
if(obj){
thisLot=thisLot  + "&toID=" + obj;
}

var url="/community/resource/working/mailNew.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function getFriends(){
if(window.event.keyCode ==""){
//GF2();
} else {
var fText = encodeURIComponent(document.formMail.fName.value);
var cText = document.formMail.fName.value;
cText=cText.length;
gText(fText,cText);
}
}


function gText(obj,objCount){
var thisLot="tText=" +encodeURIComponent(obj);
thisLot=thisLot+"&tCount=" + encodeURIComponent(objCount);

var url="/community/resource/working/getFriends.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = gFupdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
function gFupdate()
{

var TL=findPosX(document.getElementById('fName'));
var TT=findPosY(document.getElementById('fName'));

//alert(TT);

if (xmlHttp.readyState==4)
{ 
if(xmlHttp.responseText==""){
var x = document.formMail.fName;
document.getElementById('fName').style.top=TT+50;
document.getElementById('fName').style.left=TL-150;
document.getElementById('fHere').style.display="none";
}
else{
document.getElementById('fHere').style.display="";
document.getElementById('fHere').innerHTML=xmlHttp.responseText;
}
//resetAll();
}
else {
//document.getElementById("fHere").innerHTML="<br/><br/><br/><br/><center><img src=/community/resource/graphics/sgLoader.gif></center>";
}
}

function getFocus(obj,obj2){
x=obj;
y=obj2;
document.getElementById(x).value=y;
document.getElementById('fHere').style.display="none";
}

function loseFocus(obj,obj2){
x=obj;
y=obj2;
document.getElementById(x).value=y;
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
  
function setFORIGINAL(obj,obj2,obj3){
document.getElementById('fName').value=obj + " " + obj2;
document.formMail.fNameAcode.value=obj3;
document.getElementById('fHere').style.display="none";
}

function resetFname(){
//document.getElementById('fNameAcode').value="";
//document.getElementById('fHere').style.display="none";
}

function GF2(){
var x = document.getElementById('hF').value;
var y = document.getElementById('hS').value;
var z = document.getElementById('hA').value;
var k= document.getElementById('hC').value;
var l = document.getElementById('hT').value;
setF(x,y,z,k,l);
}

function sendMail(){
	if(document.formMail.sendMult){
		if(document.formMail.sendMult.value=="pick"){
			sendMailPick();
			return;
		}
				if(document.formMail.sendMult.value=="memb"){
					alert(document.formMail.sendMult.value);
					sendMailMemb();
					return;
		}
				if(document.formMail.sendMult.value=="chai"){
					sendMailChai();
					return;
		}
				if(document.formMail.sendMult.value=="bran"){
					alert(document.formMail.sendMult.value);
					sendMailBran();
					return;
		}
				if(document.formMail.sendMult.value=="prof"){
					sendMailProf();
					return;
		}
	}
	else
	{
var thisLot;
thisLot =  "fAcode=" + encodeURIComponent(document.formMail.fNameAcode.value);
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
thisLot = thisLot + "&msID=" + encodeURIComponent(document.formMail.msID.value);
var url="/community/resource/working/mailSend.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
	}
}

function sendMailProfile(){
var thisLot;
thisLot =  "fAcode=" + encodeURIComponent(document.formMail.fNameAcode.value);
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/mailSend2.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail2;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function pFriendUpdateMail() {
document.getElementById('profileChangeHere').innerHTML = "<center><p><p><p><img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		showMail();
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   function pFriendUpdateMail2() {
document.getElementById('newsHere2').innerHTML = "<center><p><p><p><img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		closeAlert2();
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
function showMessage(obj,obj2){
thisLot = "messageid=" + encodeURIComponent(obj);
mStatus="show"
if(obj2){
thisLot = thisLot + "&rid=" + encodeURIComponent(obj2);
mStatus=""
}


var url="/community/resource/working/mailDisplay.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }

xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function replyMail(){
var thisLot;
if(mStatus=="show"){
openAlert('Messages','You are not able to reply to this message');
}
else{
if(mStatus="reply"){
thisLot="toID="+encodeURIComponent(document.formMail.toID.value);
thisLot=thisLot+"&msID="+encodeURIComponent(document.formMail.msID.value);
}
else
{
thisLot="nothing"
}

var url="/community/resource/working/mailNew.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
}

function mailDelete(){

var dStop=1;
	for (i=0; i<document.formMail.elements.length; i++) { 

		el = document.formMail.elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
			if (el.checked) {
			dStop=0;
}
		} 
		}
if(dStop==1){
openAlert('Delete Messages','Please tick the box(s) of the message you wish to delete in either the inbox or sent messages folder');
return;
}
else{
mailDelete2();
}
}


function mailDelete2(){
 if (confirm('Are you sure you want to DELETE the selection(s) ticked?\n\nThis action cannot be undone!')) {
	for (i=0; i<document.formMail.elements.length; i++) { 
		el = document.formMail.elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
			if (el.checked) {
			var id = el.name.replace(/checkbox/, "");
			deleteme(id);
}
		} 
	}
	showMail();
	}
}

function deleteme(id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/mailDelete.asp";
url=url+"?id="+id;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function forwardMail(){
if(document.formMail.msID.value!=""){
var thisLot="msID="+encodeURIComponent(document.formMail.msID.value);
var url="/community/resource/working/mailforward.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

}else{
openAlert('Forward Message','You are not able to forward this message');
}
}

//--------- EVENTS FUNCTIONS ----------------------------------------------------------


function getYearAll()
{ 
var obj=document.formmail.selectYear.value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/eventShowAll.asp";
url=url+"?mon=13&year=" + obj;
xmlHttp.onreadystatechange=pFriendUpdate;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}



function showEvent(obj,obj2){
var thisMonth = obj;
if(thisMonth=="" || thisMonth=="undefined"){
thisMonth="";
}
thisLot="mon=" + thisMonth;

if(obj2==1){
thisLot="mon=" + thisMonth + "&sType=1&search=" + encodeURIComponent(document.selecttype.sEtype.value);
}
if(obj2==2){
thisLot="mon=" + thisMonth + "&sType=2&search=" + encodeURIComponent(document.selecttype.sCounty.value);
}

var url;

if(obj==13){
	url="/community/resource/working/eventShowAll.asp";
	//document.location.href=url;
}
else{
	url="/community/resource/working/eventShow.asp";
}

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function newEvent(){
if (getCookie('interact')) {

var thisLot="n=1"

var url="/community/resource/working/eventNew.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
} else {
openAlert('New Events','To post new events , you must be a registered member of this forum. If you are not a registered user, please do so using [ Register ] from the menu at the top of this page.<br><br>If you are already registered and have activated your account, please log-in using [ log-in ] from the menu at the top of this page.<br><br>If you are both a registered user with an activated account and are logged in, please enable your computer to accept cookies. Each time you log-in, we place a cookie on your computer that expires within 24 hours or if you log-out');
}
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return true;
    }
  }
return false;
}


function addEvent(){


var thisLot;
thisLot = "eType=" + encodeURIComponent(document.formMail.eType.value);
thisLot = thisLot + "&dateFrom=" + encodeURIComponent(document.formMail.dateFrom.value);
thisLot = thisLot + "&startTimeHour=" + encodeURIComponent(document.formMail.sthour.value);
thisLot = thisLot + "&startTimeMin=" + encodeURIComponent(document.formMail.stmin.value);
thisLot = thisLot + "&startTimeZone=" + encodeURIComponent(document.formMail.stzone.value);
thisLot = thisLot + "&dateTo=" + encodeURIComponent(document.formMail.dateTo.value);
thisLot = thisLot + "&endTimeHour=" + encodeURIComponent(document.formMail.fthour.value);
thisLot = thisLot + "&endTimeMin=" + encodeURIComponent(document.formMail.ftmin.value);
thisLot = thisLot + "&endTimeZone=" + encodeURIComponent(document.formMail.ftzone.value);
thisLot = thisLot + "&eTitle=" + encodeURIComponent(document.formMail.eTitle.value);
thisLot = thisLot + "&eDescription=" + encodeURIComponent(document.formMail.eDescription.value);
thisLot = thisLot + "&eVenue=" + encodeURIComponent(document.formMail.eVenue.value);
thisLot = thisLot + "&eTown=" + encodeURIComponent(document.formMail.eTown.value);
thisLot = thisLot + "&eCounty=" + encodeURIComponent(document.formMail.eCounty.value);
thisLot = thisLot + "&eLink=" + encodeURIComponent(document.formMail.eLink.value);

var url="/community/resource/working/eventAdd.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

}

function editEventDo(){
var thisLot;
thisLot = "eType=" + encodeURIComponent(document.formMail.eType.value);
thisLot = thisLot + "&id=" + encodeURIComponent(document.formMail.id.value);
thisLot = thisLot + "&dateFrom=" + encodeURIComponent(document.formMail.dateFrom.value);
thisLot = thisLot + "&startTimeHour=" + encodeURIComponent(document.formMail.sthour.value);
thisLot = thisLot + "&startTimeMin=" + encodeURIComponent(document.formMail.stmin.value);
thisLot = thisLot + "&startTimeZone=" + encodeURIComponent(document.formMail.stzone.value);
thisLot = thisLot + "&dateTo=" + encodeURIComponent(document.formMail.dateTo.value);
thisLot = thisLot + "&endTimeHour=" + encodeURIComponent(document.formMail.fthour.value);
thisLot = thisLot + "&endTimeMin=" + encodeURIComponent(document.formMail.ftmin.value);
thisLot = thisLot + "&endTimeZone=" + encodeURIComponent(document.formMail.ftzone.value);
thisLot = thisLot + "&eTitle=" + encodeURIComponent(document.formMail.eTitle.value);
thisLot = thisLot + "&eDescription=" + encodeURIComponent(document.formMail.eDescription.value);
thisLot = thisLot + "&eVenue=" + encodeURIComponent(document.formMail.eVenue.value);
thisLot = thisLot + "&eTown=" + encodeURIComponent(document.formMail.eTown.value);
thisLot = thisLot + "&eCounty=" + encodeURIComponent(document.formMail.eCounty.value);
thisLot = thisLot + "&eLink=" + encodeURIComponent(document.formMail.eLink.value);

var url="/community/resource/working/eventEditDo.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = editEventChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);

}

function updateDate(){
document.formMail.dateTo.value=document.formMail.dateFrom.value;

var sel1 =document.formMail.sthour.selectedIndex;
var sel2 = document.formMail.stmin.selectedIndex;
var sel3 = document.formMail.stzone.selectedIndex;

if(sel1==11){
sel1=parseFloat(sel1-10)
if(sel3==00){
sel3=01;
}else
{
sel3=00;
}
} else if (sel1==10){
sel1=parseFloat(sel1-10)
if(sel3==00){
sel3=01;
}else
{
sel3=00;
}
} else {
sel1=parseFloat(sel1+2)
}

document.formMail.fthour.value=document.formMail.sthour.options[sel1].value;
document.formMail.ftmin.value=document.formMail.stmin.options[sel2].value;
document.formMail.ftzone.value=document.formMail.stzone.options[sel3].value;
}

function deleteEventChanged() { 
//document.getElementById('updateForum').innerHTML = "&nbsp;<p>&nbsp;<p>&nbsp;<p><center><img src='/forum/resource/graphics/loader.gif'><p>&nbsp;<p>&nbsp;<p></center>"
if (xmlHttp.readyState==4)
{ 
if (xmlHttp.status == 200) {
var thisText=xmlHttp.responseText;
if(thisText=="thisisafailure"){
openAlert('Permission Required','You are not the original owner of this event and so may not perform any deletion');
return;
}else{
showEvent();
}
         } else {
            //alert('There was a problem with the request.');
         }
		 }
}

function editEventChanged() { 
//document.getElementById('updateForum').innerHTML = "&nbsp;<p>&nbsp;<p>&nbsp;<p><center><img src='/forum/resource/graphics/loader.gif'><p>&nbsp;<p>&nbsp;<p></center>"
if (xmlHttp.readyState==4)
{ 
if (xmlHttp.status == 200) {
var thisText=xmlHttp.responseText;
showEvent();
         } else {
            //alert('There was a problem with the request.');
         }
		 }
}

function deleteEvent(obj){
if (confirm('Are you sure you want to REMOVE this event?\n\nThis action cannot be undone!')) {
deleteEventDo(obj);
}
//nothing
}

function deleteEventDo(obj){
var url="/community/resource/working/eventDelete.asp";
var thisLot="id=" + obj;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = deleteEventChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function editEvent(obj){

var thisLot="id=" + obj;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="/community/resource/working/eventEdit.asp";
//document.location.href=url+"?"+thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function openEvent(obj){

document.getElementById('divThis2').style.display='';
document.getElementById('apDiv12').style.display='';
document.body.scroll="no";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="/community/resource/working/eventOpen.asp";
url=url+"?id="+obj + "&$=" +new Date().getTime();
xmlHttp.onreadystatechange=displayAlert2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function addToOutlook(obj){
alert("If asked if you want to 'Save' or 'Open', please click [ Open ]\n\nThis event will automatically add to your electronic calendar");
document.location.href="/sgics/" + obj + ".ics";
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function tRegister(){
var thisLot;
thisLot =  "ad1=" + encodeURIComponent(document.register.ad1.value);
thisLot = thisLot + "&ad2=" + encodeURIComponent(document.register.ad2.value);
thisLot = thisLot + "&ad3=" + encodeURIComponent(document.register.ad3.value);
thisLot = thisLot + "&ad4=" + encodeURIComponent(document.register.ad4.value);
thisLot = thisLot + "&town=" + encodeURIComponent(document.register.town.value);
thisLot = thisLot + "&county=" + encodeURIComponent(document.register.county.value);
thisLot = thisLot + "&postcode=" + encodeURIComponent(document.register.postcode.value);
thisLot = thisLot + "&country=" + encodeURIComponent(document.register.country.value);
thisLot = thisLot + "&telephone=" + encodeURIComponent(document.register.telephone.value);
thisLot = thisLot + "&tname=" + encodeURIComponent(document.register.tname.value);
thisLot = thisLot + "&email=" + encodeURIComponent(document.register.email.value);

var instruments="";
for (i=0; i<document.register.elements.length; i++) { 
el = document.register.elements[i];
if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
if (el.checked) {
instruments=instruments+ el.value;
}
}
}
thisLot = thisLot + "&instruments=" + encodeURIComponent(instruments);

var grades="";
for (i=0; i<document.register.elements.length; i++) { 
el = document.register.elements[i];
if (el.type=="checkbox" && el.name.indexOf("checkbox1")!=-1){
if (el.checked) {
grades=grades+ el.value;
}
}
}
thisLot = thisLot + "&grades=" + encodeURIComponent(grades);

thisLot = thisLot + "&qualifications=" + encodeURIComponent(document.register.qualifications.value);
thisLot = thisLot + "&notes=" + encodeURIComponent(document.register.notes.value);
thisLot = thisLot + "&crb=" + encodeURIComponent(document.register.crb.value);
thisLot = thisLot + "&peripatetic=" + encodeURIComponent(document.register.peri.value);

for (var i=0; i < document.register.peri.length; i++)
{
if (document.register.peri[i].checked)
{
thisLot = thisLot + "&peripatetic=" + encodeURIComponent(document.register.peri[i].value);
}
}

for (var i=0; i < document.register.crb.length; i++)
{
if (document.register.crb[i].checked)
{
thisLot = thisLot + "&crb=" + encodeURIComponent(document.register.crb[i].value);
}
}

//alert(thisLot);

var url="/community/resource/working/teacherAdd.asp";
//document.location.href=url+"?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = communityChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function iAgree(){
var thisLot="1";

var url="/community/resource/furniture/teacherSearch.asp";
//document.location.href=url+"?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = communityChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function tFind(){

var thisLot =  "sIns=" + encodeURIComponent(document.tSearch.sIns.value);
thisLot = thisLot + "&sGra=" +  encodeURIComponent(document.tSearch.sGra.value);
thisLot = thisLot + "&sCou=" +  encodeURIComponent(document.tSearch.sCou.value);
thisLot = thisLot + "&sCun=" +  encodeURIComponent(document.tSearch.sCun.value);
thisLot = thisLot + "&sNam=" +  encodeURIComponent(document.tSearch.sNam.value);

var url="/community/resource/working/teacherResults.asp";
//document.location.href=url+"?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = communityChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function UpdateMood(obj){
var myForm = 'NewComment'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="mood=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMood.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function moodChanged() {
//document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		document.location.href="/profile-home.asp"
//document.getElementById('updateDataHere').innerHTML = "";
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   function likeThis(obj){
var myForm = 'aCommentID'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="commentID=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLike.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function commentOn(obj,obj2){
	   tempid=obj2;
var myId = 'aCommentID'+obj;
myId = document.getElementById(myId).value;
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="commentID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodComment.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function likeThisPost(obj,obj2){
tempid=obj2;
var thisLot ="commentID=" + encodeURIComponent(obj);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLikePost.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOther;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function commentOnPost(obj,obj2){
	   tempid=obj2;
var myId = "post"+obj;

myId = document.getElementById(myId).value;
//alert(myId);
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="commentID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodCommentPost.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOther;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function likeThisOther(obj,obj2){
	   tempid=obj2;
var myForm = 'aCommentID'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="commentID=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLike.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOther;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function commentOnOther(obj,obj2){
	   tempid=obj2;
var myId = 'aCommentID'+obj;
myId = document.getElementById(myId).value;
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="commentID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodComment.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOther;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


   function albumGet(obj){

var thisLot ="albumID=" + encodeURIComponent(obj);

//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/albumGet.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function imageGet(obj,obj2){
	
openAlbum=obj;
openImage=obj2;

var thisLot ="imageID=" + encodeURIComponent(obj2);
thisLot=thisLot+"&albumID=" + encodeURIComponent(obj); 

//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/imageGet.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function ilikeThis(obj){
var myForm = 'iCommentID'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="imageID=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLikeImage.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = imageMoodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function icommentOn(obj){
var myId = 'iCommentID'+obj;
myId = document.getElementById(myId).value;
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="imageID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodCommentImage.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = imageMoodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
   
   function imageMoodChanged() {
//document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		//document.location.href="/profile-home.asp"
//document.getElementById('updateDataHere').innerHTML = "";
 imageGet(openAlbum,openImage);
         } else {
            //alert("There was a problem with the request");
         }
      }   
   }
   
      function imageMoodChangedGroup() {
//document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		//document.location.href="/profile-home.asp"
//document.getElementById('updateDataHere').innerHTML = "";
 imageGetGroup(openAlbum,openImage);
         } else {
            //alert("There was a problem with the request");
         }
      }   
   }
   
      function moodChangedOther() {
//document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		//document.location.href="/profile-home.asp"
//document.getElementById('updateDataHere').innerHTML = "";
 viewProfile(tempid);
         } else {
            //alert("There was a problem with the request");
         }
      }   
   }
   
   function viewProfile(obj){
	  // alert(obj);
	 var thisLot ="id=" + obj;
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/view-profile.asp"
  //var url="/community/resource/working/getProfile.asp"
 document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
   
function newPost(obj){
tempid=obj;
myComment = document.getElementById('postMessage').value;

if(myComment=="Write something here!"){
	return;
}

var thisLot ="acode=" + encodeURIComponent(obj);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updatePost.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOther;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function losetext(){
document.getElementById("linesHere").innerHTML="<textarea id=postMessage name=postMessage cols=60 rows=3></textarea>"
}


function resetlosetext(){
document.getElementById("linesHere").innerHTML="<textarea id=postMessage cols=60 rows=1 onfocus=losetext();>Write something here!</textarea>"
}

// GROUP FUNCTIONS ----------------------------------------------------------------------------------------------------------------------------------

   function newGroup(){
var thisLot="1";

var url="/community/resource/working/newGroup.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function newGroupDo(obj2){
	    tempid=obj2;
var thisLot="groupName=" + encodeURIComponent(document.formGroup.gName.value);
thisLot=thisLot + "&groupDesc=" + encodeURIComponent(document.formGroup.gDesc.value);

var url="/community/resource/working/newGroupDo.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  //document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChanged;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function viewGroup(obj){
	 var thisLot ="id=" + encodeURIComponent(obj);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/getGroup.asp"
 //document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function newPostGroup(obj){
tempid=obj;
myComment = document.getElementById('postMessage').value;

if(myComment=="Write something here!"){
	return;
}

var thisLot ="acode=" + encodeURIComponent(obj);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updatePostGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function likeThisPostGroup(obj,obj2){
tempid=obj2;
var thisLot ="commentID=" + encodeURIComponent(obj);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLikePostGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function commentOnPostGroup(obj,obj2){
	   tempid=obj2;
var myId = "post"+obj;

myId = document.getElementById(myId).value;
//alert(myId);
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="commentID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodCommentPostGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function likeThisOtherGroup(obj,obj2){
	   tempid=obj2;
var myForm = 'aCommentID'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="commentID=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLikeGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function commentOnOtherGroup(obj,obj2){
	   tempid=obj2;
var myId = 'aCommentID'+obj;
myId = document.getElementById(myId).value;
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="commentID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodCommentGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

      function moodChangedOtherGroup() {
//document.getElementById('updateDataHere').innerHTML = "<img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
		//document.location.href="/profile-home.asp"
//document.getElementById('updateDataHere').innerHTML = "";
 viewGroup(tempid);
         } else {
            //alert("There was a problem with the request");
         }
      }   
   }
   
      function albumGetGroup(obj){

var thisLot ="albumID=" + encodeURIComponent(obj);

//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/albumGetGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}


function imageGetGroup(obj,obj2){
	
openAlbum=obj;
openImage=obj2;

var thisLot ="imageID=" + encodeURIComponent(obj2);
thisLot=thisLot+"&albumID=" + encodeURIComponent(obj); 

//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/imageGetGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

   function ilikeThisGroup(obj){
var myForm = 'iCommentID'+obj;
myForm = document.getElementById(myForm).value;
var thisLot ="imageID=" + encodeURIComponent(myForm);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodLikeImageGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = imageMoodChangedGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function icommentOnGroup(obj){
var myId = 'iCommentID'+obj;
myId = document.getElementById(myId).value;
var myComment = 'comment'+obj;
myComment = document.getElementById(myComment).value;


var thisLot ="imageID=" + encodeURIComponent(myId);
thisLot = thisLot + "&myComment=" + encodeURIComponent(myComment);
//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/updateMoodCommentImageGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = imageMoodChangedGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function groupFanDo(obj){
var thisLot ="id=1"
tempid=obj;

//alert(thisLot);
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
  var url="/community/resource/working/joinGroup.asp"
 // document.location.href=url + "?" + thisLot;
xmlHttp.onreadystatechange = moodChangedOtherGroup;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
} 

function searchGroup(){

var thisLot ="gText=" + encodeURIComponent(document.gSearch.gText.value);


var url="/community/resource/working/gSearch.asp";
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pSearchUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function showOnline(){
	var thisLot="1";
	url = "/community/resource/working/showOnline.asp"
	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function showSearch(){
	var thisLot="1";
	url = "/community/resource/working/bSearch.asp"
	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function doDataSearch(obj1,obj2,obj3,obj4,obj5){
	
	var keyword;
	var member;
	var memberType;
	var branch;
	var companyType;
	
/*
if(obj1!=""){
		keyword=encodeURIComponent(obj1)}
		else{
			keyword=encodeURIComponent(document.formDataSearch.keyword.value);
		}
			if(obj2!=""){
		member=encodeURIComponent(obj2)}
		else{
			member=encodeURIComponent(document.formDataSearch.member.value);
		}
			if(obj3!=""){
		memberType=encodeURIComponent(obj3)}
		else{
			memberType=encodeURIComponent(document.formDataSearch.memberType.value);
		}
			if(obj4!=""){
		branch=encodeURIComponent(obj4)}
		else{
			branch=encodeURIComponent(document.formDataSearch.branch.value);
		}
			if(obj5!=""){
		companyType=encodeURIComponent(obj5)}
		else{
			companyType=encodeURIComponent(document.formDataSearch.companyType.value);
		}
	*/	
	
		
		
	var thisLot="keyword=" + encodeURIComponent(document.formDataSearch.keyword.value);
	thisLot=thisLot+"&member=" + encodeURIComponent(document.formDataSearch.member.value);
	thisLot=thisLot+"&memberType=" + encodeURIComponent(document.formDataSearch.memberType.value);
	thisLot=thisLot+"&branch=" + encodeURIComponent(document.formDataSearch.branch.value);
	thisLot=thisLot+"&companyType=" + encodeURIComponent(document.formDataSearch.companyType.value);
	
	//alert(thisLot);

url = "/community/resource/working/bSearchDo.asp";
	//document.location.href=url+"?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdate;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function getOptions(){
	var thisLot="sendto=" + encodeURIComponent(document.formMail.sendOptions.value);
	url = "/community/resource/working/getSendTo.asp"
	
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = updateOption;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function updateOption() {
document.getElementById('optionHere').innerHTML = "<center><p><p><p><img src=/forum/resource/graphics/loader.gif>";
if (xmlHttp.readyState == 4) {
         if (xmlHttp.status == 200) {
document.getElementById('optionHere').innerHTML = xmlHttp.responseText;
         } else {
            //alert("There was a problem with the request");
         }
      }   
   } 
   
   
function setF(obj,obj2,obj3,obj4,obj5){
	var thislot="";
	var wowall = document.getElementById('fmail').innerHTML;
	thislot="<input type=checkbox name=checkbox" + obj3 + " id=checkbox" + obj3 + " checked /> <strong>" + obj + " " + obj2 + "</strong>, " + obj5 + ", " + obj4 + "<br>";
	document.getElementById('fmail').innerHTML=wowall+thislot;
}

function sendMailPick(){
 if (confirm('Are you sure you want to send mail to the tciked selection(s)?')) {
	document.getElementById('fdisplay').innerHTML = "<center><img src=/forum/resource/graphics/loader.gif></center>"; 
	for (i=0; i<document.formMail.elements.length; i++) { 
		el = document.formMail.elements[i];
		if (el.type=="checkbox" && el.name.indexOf("checkbox")!=-1){
			if (el.checked) {
			var id = el.name.replace(/checkbox/, "");
			sendMailPickNow(id);
}
		} 
	}
setTimeout("pFriendUpdateMail()",5000);
	}

}


function sendMailPickNow(obj){
		var thisLot;
thisLot="sendto=" + obj
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/sendMailPick.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function sendMailMemb(){
	var thisLot;
thisLot="sendto="
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/sendMailMemb.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function sendMailChai(){
	var thisLot;
thisLot="sendto="
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/sendMailChai.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function sendMailBran(){
var thisLot;		
thisLot="sendto=" + encodeURIComponent(document.formMail.branch.value);
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/sendMailBran.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);	
}

function sendMailProf(){
	var thisLot;
thisLot="sendto=" + encodeURIComponent(document.formMail.companyType.value);
thisLot = thisLot + "&mSubject=" + encodeURIComponent(document.formMail.mSubject.value);
thisLot = thisLot + "&mMessage=" + encodeURIComponent(document.formMail.mMessage.value);
var url="/community/resource/working/sendMailProf.asp";
//document.location.href=url + "?"+thisLot;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
  alert ("Your browser does not support AJAX!");
  return;
  }
xmlHttp.onreadystatechange = pFriendUpdateMail;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", thisLot.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(thisLot);
}
