// JavaScript Document
  var myWidth,myHeight,scrOfY,scrOfX;
function getScrollXY() {

  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}


function pageSize() {

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
   return [ myWidth, myHeight ];
  
 
}

function showbox(id) { 
 
getScrollXY();
pageSize();
var newdiv = document.createElement('div');
   newdiv.setAttribute('id', id);
       newdiv.style.position = "absolute";
	   newdiv.style.width = "380px";
 //  newdiv.style.opacity = ".9";
   // newdiv.style.filter = "alpha(opacity=90)";
      // newdiv.style.height = "246px";
	newdiv.style.left= ((myWidth/2)-190)+'px';

newdiv.style.top= ((myHeight/2)-123)+'px';

         newdiv.innerHTML="<div id='popuptop'></div><div id='popupmid'><div id='lable'>Loading...</div></div><div id='popupbot'></div>";
  // newdiv.style.backgroundImage = "url(images/popup.png)";
   newdiv.style.padding="10px";
   
	    newdiv.style.zIndex =3;
   
  
   
   document.body.appendChild(newdiv);

   var newdiv2 = document.createElement('div');
   newdiv2.setAttribute('id', 'popupoverlay');
       newdiv2.style.position = "absolute";
	
	 newdiv2.style.width = myWidth+'px';
	 newdiv2.style.height = myHeight+'px';
	//if (scrOfX!='0'){newdiv2.style.width = scrOfX+'px';}else{newdiv2.style.width = myWidth+'px';}
 // if (scrOfY!='0'){newdiv2.style.height = scrOfY+'px';}else{newdiv2.style.height = myHeight+'px';}
  
	newdiv2.style.left= "0px";
  newdiv2.style.backgroundImage = "url(images/overlay.png)";
newdiv2.style.top="0px";
	    newdiv2.style.zIndex =2;
		//newdiv2.onclick = function () {hidebox(id); return false;}
document.body.appendChild(newdiv2);


   
}

function hidebox(){
document.body.removeChild(document.getElementById('popup')) ; document.body.removeChild(document.getElementById('popupoverlay')) ; 
	
	}
function profileselect(pid){

selectprofile('functions/selectprofile.php?pid='+pid)
	
	}
	
	
	function profiledelete(pid){

delprofile('functions/delprofile.php?pid='+pid)
	
	}

function refreshhidebox(){
	 hidebox();
	 window.document.location="profile.php";
	
	}

	
	
function loadbox(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processloadbox;
		req.open("GET",url, true);
		req.send("");
	}


function processloadbox() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		
	
	
			document.getElementById('popupmid').innerHTML=req.responseText;
			
          
        } else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
function startUpload(){
      document.getElementById('uploadprocess').style.display = 'inline';
      document.getElementById('uploadform').style.display = 'none';
      return true;
}

function stopUpload(success){
      var result = '';
      if (success == 1){
         result = '<span class="msg">The file was uploaded successfully!<\/span><br/><br/>';
      }
      else if (success == 2){   result = "<span class='emsg'>The Image must be in Jpeg<\/span><br/><br/><div style='float:right;margin-right:5px;height:20px'><input type='button' name='closepopup' id='closepopup' value='Close' class='inputsubmit' onclick='hidebox()'/></div><div style='float:right;margin-right:5px;height:20px'><input type='button' name='tryagain' id='tryagain' value='Try Another Image' class='inputsubmit' onclick='newimage();'/></div>"; } else {
         result = "<span class='emsg'>There was an error during file upload!<\/span><br/><br/><div style='float:right;margin-right:5px;height:20px'><input type='button' name='closepopup' id='closepopup' value='Close' class='inputsubmit' onclick='hidebox()'/></div><div style='float:right;margin-right:5px;height:20px'><input type='button' name='tryagain' id='tryagain' value='Try Again' class='inputsubmit' onclick='newimage();'/></div>";
      }
      document.getElementById('uploadprocess').style.display = 'none';
      document.getElementById('uploadform').innerHTML = result ;
      document.getElementById('uploadform').style.display= 'inline';      
      return true;   
}

function newimage(){
	loadbox('functions/imageupload.php');
	}
	
	function showsect(sectname){
		document.getElementById('profilesection').style.display='none';
		document.getElementById('feedsection').style.display='none';
		
		
		document.getElementById('profilebtn').style.backgroundImage='url(images/greenbg.gif)';
		document.getElementById('feedbtn').style.backgroundImage='url(images/greenbg.gif)';
		
		
		document.getElementById(sectname+'btn').style.backgroundImage='url(images/menu.gif)';
		document.getElementById(sectname+'section').style.display='inline';
		
		}
function selectprofile(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processselectprofile;
		req.open("GET",url, true);
		req.send("");
	}
function processselectprofile() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		hidebox();
	window.document.location='profile.php';
	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	
	
	function delprofile(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processdelprofile;
		req.open("GET",url, true);
		req.send("");
	}
function processdelprofile() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		loadbox('functions/profilealbum.php');
	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	function editprofile(){
		document.getElementById('profilesection').innerHTML="<div  class='subsectionsinfo'  ><div id='lable'>Loading...</div></div>";
		editprofileinfo('functions/editprofile.php');
		
		}
		
		
			function canceleditprofile(){
		document.getElementById('profilesection').innerHTML="<div  class='subsectionsinfo'  ><div id='lable'>Loading...</div></div>";
		viewprofileinfo('functions/viewprofile.php');
		
		}
		
		
		function saveeditprofile(){
		
		
		var sex,bdaym,bdayy,bdayd,company,address,city,zip,phone,email,website;
		sex=document.getElementById('sex').value;
			bdaym=document.getElementById('birthday_month').value;
			bdayd=document.getElementById('birthday_day').value;
			bdayy=document.getElementById('birthday_year').value;
			company=document.getElementById('company').value;
			address=document.getElementById('address').value;
			city=document.getElementById('city').value;
			zip=document.getElementById('zip').value;
			phone=document.getElementById('phone').value;
			email=document.getElementById('email').value;
			website=document.getElementById('website').value;
		
		
		saveprofileinfo('functions/saveprofile.php?sex='+sex+'&bdaym='+bdaym+'&bdayy='+bdayy+'&bdayd='+bdayd+'&company='+company+'&address='+address+'&city='+city+'&zip='+zip+'&phone='+phone+'&email='+email+'&website='+website);
		
		}
	
	
	
		function editprofileinfo(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processeditprofile;
		req.open("GET",url, true);
		req.send("");
	}
function processeditprofile() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			document.getElementById('profilesection').innerHTML=req.responseText;
			
			document.getElementById('sex').value=document.getElementById('sexcheck').value;
			document.getElementById('birthday_month').value=document.getElementById('monthcheck').value;
			document.getElementById('birthday_day').value=document.getElementById('daycheck').value;
			document.getElementById('birthday_year').value=document.getElementById('yearcheck').value;
			
			var options = {
		script:"functions/city_suggest.php?json=false&limit=6&",
		varname:"input",
		json:false,
		shownoresults:false,
		maxresults:6,
		callback: function (obj) { document.getElementById('testid').value = obj.id; }
	};
	var as_json = new bsn.AutoSuggest('testinput', options);
	
	
	var options_xml = {
		script: function (input) { return "functions/city_suggest.php?input="+input+"&testid="+document.getElementById('testid').value; },
		varname:"input"
	};
	var as_xml = new bsn.AutoSuggest('city', options_xml);
	
	

	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	
	function viewprofileinfo(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processviewprofile;
		req.open("GET",url, true);
		req.send("");
	}
function processviewprofile() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			document.getElementById('profilesection').innerHTML=req.responseText;

	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	
	
	function saveprofileinfo(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processaveprofile;
		req.open("GET",url, true);
		req.send("");
	}
function processaveprofile() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
		//	document.getElementById('profilesection').innerHTML=req.responseText;
		viewprofileinfo('functions/viewprofile.php');

	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	
	function sz(t) {
a = t.value.split('\n');

if (t.value=='Share Some News'){t.rows = 2;}
b=1;
for (x=0;x < a.length; x++) {
 if (a[x].length >= t.cols) b+= Math.floor(a[x].length/t.cols);
 }
b+= a.length;
if (b < 12){
if (b > t.rows) t.rows = b;}
}

function attachlink(element){
	
	document.getElementById('attachelement').style.display='inline';
	document.getElementById('sharelinks').style.display='none';
		document.getElementById('sharenews').disabled=1;
		document.getElementById('sharenews').style.backgroundColor='#666';
			document.getElementById('sharenews').style.cursor='default';
			if (element=='link'){document.getElementById('attachelement').innerHTML='<div id="addelement"><span id="attach">Add Link</span><img src="images/icons/url.gif" width="20" height="20" border="0" /><div id="closeattach"><a href="javascript:closeattach()"><img src="images/icons/close.gif"  border="0"/></a></div><div id="addurl"><input  type="text" class="addurltext" id="urllink" value="http://" maxlength="255"  onfocus="if (this.value == \'http://\') { this.value = \'\' };" onblur="if (this.value == \'\') { this.value = \'http://\'; };" /><input type="button" id="addurlbutton" value="Add" class="inputsubmit" onclick="addurl(document.getElementById(\'urllink\').value)"  style="margin-top:4px;"/></div></div></div>'}
	
	}
	
	function closeattach(){
		document.getElementById('sharelinks').style.display='inline';
		document.getElementById('attachelement').innerHTML='';
		document.getElementById('attachelement').style.display='none';
			document.getElementById('sharenews').disabled=0;
		document.getElementById('sharenews').style.backgroundColor='#4fca2d';
		document.getElementById('attachcheck').value=0;
		}
		
function addurl(id){
	if (document.getElementById('news').value=='Share Some News'){document.getElementById('news').value='';}
	document.getElementById('attachelement').innerHTML='<div id="addelement"><span id="attach">Add Link</span><img src="images/icons/url.gif" width="20" height="20" border="0" /><div id="closeattach"><a href="javascript:closeattach()"><img src="images/icons/close.gif"  border="0"/></a></div><div id="addurl"><div style="text-align:center;padding-top:4px"    ><img src="../images/loaderbar.gif" /></div></div></div></div>';
	geturlinfo('functions/geturl.php?url='+id);
	
	}
	
	
	function geturlinfo(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processurlinfo;
		req.open("GET",url, true);
		req.send("");
	}
function processurlinfo() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
			document.getElementById('addurl').innerHTML=req.responseText;
		document.getElementById('sharenews').disabled=0;
		document.getElementById('attachcheck').value=1;
		document.getElementById('sharenews').style.backgroundColor='#4fca2d';

	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	
function sharenews(){
	var newspost,urlinfo,urlthumb;
	newspost=escape(document.getElementById('news').value);
	if (document.getElementById('attachcheck').value==1){
		urlinfo=escape(document.getElementById('urldesc').innerHTML);
		urlthumb=document.getElementById('urlthumbimage').value;
		addnews('functions/addnews.php?news='+newspost+'&urlinfo='+urlinfo+'&urlthumb='+urlthumb); 
		}else{
		
	addnews('functions/addnews.php?news='+newspost); 	}}
		
		
	function addnews(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processaddnews;
		req.open("GET",url, true);
		req.send("");
	}
function processaddnews() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
	
	document.getElementById('sharelinks').style.display='inline';
		document.getElementById('attachelement').innerHTML='';
		document.getElementById('attachelement').style.display='none';
			document.getElementById('sharenews').disabled=0;
		document.getElementById('sharenews').style.backgroundColor='#4fca2d';
		document.getElementById('attachcheck').value=0;
		document.getElementById('news').value='Share Some News';
		
			document.getElementById('feedinfo').innerHTML=req.responseText;
	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	function delpost(pid){
	delnews('functions/delnews.php?pid='+pid); 	
		}
	
	
		
		
	
	function delnews(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processdelnews;
		req.open("GET",url, true);
		req.send("");
	}
function processdelnews() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
		
			document.getElementById('feedinfo').innerHTML=req.responseText;
	} else {
            alert('There was a problem with the request.');
        }
    }
}
	}
	
	function showcomment(upid){

		document.getElementById('comment'+upid).style.display='inline';
	
		}
		
		function addcomment(upid){
			var comment;
		//document.getElementById('addcommentbutton'+upid).style.display='none'; 
			comment=escape(document.getElementById('addcommenttext'+upid).value);
				addnewcomment('functions/addcomment.php?comment='+comment+'&upid='+upid,upid);
			}
			
			
			
			function addnewcomment(url,upid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
	document.getElementById('addcommenttext'+upid).value='write a comment';
			document.getElementById('commentlist'+upid+'').innerHTML=req.responseText;
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}

	}
	
	
	
	function delcomment(uprid,upid){
	  
	delcomments('functions/delcomment.php?uprid='+uprid+'&upid='+upid,upid); 	
		}
		
	
	function delcomments(url,upid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
			document.getElementById('commentlist'+upid+'').innerHTML=req.responseText;
			
			
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}

	}
	
	function followme(fuid){
		document.getElementById('followme').innerHTML="<div id='loading'><img src='images/loading.gif'></div>";
		follow('functions/followme.php?fuid='+fuid,fuid); 	
		
		}
	
		
	
	function follow(url,fuid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
			document.getElementById('followme').innerHTML="<a href='javascript:unfollow(\".$fuid.\")'><img src='images/icons/unfollow.jpg'  alt='unfollow' border='0'/></a>";
			
			
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}

	}
	
	
	
	function unfollowme(fuid){
		document.getElementById('followme').innerHTML="<div id='loading'><img src='images/loading.gif'></div>";
		unfollow('functions/unfollowme.php?fuid='+fuid,fuid); 	
		
		}
	
		
	
	function unfollow(url,fuid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
			
			document.getElementById('followme').innerHTML="<a href='javascript:followme(\".$fuid.\")'><img src='images/icons/follow.jpg'  alt='follow me' border='0'/></a>";
			
			
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}
	


	}
	
function showallfollowing(){
	showbox('popup');
	loadbox('functions/following.php');
	}
	
function showallfollowers(){
	showbox('popup');
	loadbox('functions/followers.php');
	}
	
	
	function followmelist(fuid){
		document.getElementById('followall'+fuid).innerHTML="<div id='loading'><img src='images/loading.gif'></div>";
		followall('functions/followme.php?fuid='+fuid,fuid); 	
		
		}
	
		
	
	function followall(url,fuid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		
			document.getElementById('followall'+fuid).innerHTML="<a href='javascript:unfollowmelist("+fuid+")'><img src='images/icons/unfollow.jpg'  alt='unfollow' border='0'/></a>";
			
			
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}

	}
	
	
	
	function unfollowmelist(fuid){
		document.getElementById('followall'+fuid).innerHTML="<div id='loading'><img src='images/loading.gif'></div>";
		unfollowall('functions/unfollowme.php?fuid='+fuid,fuid); 	
		
		}
	
		
	
	function unfollowall(url,fuid) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		
			
			document.getElementById('followall'+fuid).innerHTML="<a href='javascript:followmelist("+fuid+")'><img src='images/icons/follow.jpg'  alt='follow me' border='0'/></a>";
			
			
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}
	


	}
	
	
	function showolder(pgnum){
		document.getElementById('showolderposts').innerHTML="<div style='text-align:center;float:left;width:100%'><img src='images/loaderbar.gif' /></div>";
		showolderposts('functions/oldernewsposts.php?pgid='+pgnum,pgnum); 	
		
		}
	
	
	function showolderposts(url,pgnum) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
	
		req.onreadystatechange = function () {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
		var cpage;
		cpage=pgnum-1;
	
			if (cpage>1){
			document.getElementById('olderposts'+cpage).innerHTML=req.responseText;
		
			}else{
				document.getElementById('olderposts').innerHTML=req.responseText;
				
				}
			
	} else {
            alert('There was a problem with the request.');
        }
    }
};
	
		req.open("GET",url, true);
		req.send("");
	}
	


	}
	
