/* START - AJAX COMMON FUNCTIONS */
function update(result, ui_id){

	var div = $(ui_id);
	if (result.status==Http.Status.OK){

		div.innerHTML = result.responseText;

	}else{
		
		div.innerHTML = "";
	}	
}// end update()

var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;

		input = Base64._utf8_encode(input);

		while (i < input.length) {

			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;

			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}

			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);

		}

		return output;
	},

	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;

		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while (i < input.length) {

			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;

			output = output + String.fromCharCode(chr1);

			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}

		}

		output = Base64._utf8_decode(output);

		return output;

	},

	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}

function setthumbup(rr,val) //Replaces the star image when selected.
{
	var x = rr;
	for(var y=1;y<=val;y++)
	{
		document['image'+x+''+y].src="ex.graphics/thumbsup_smaller_dar.jpg";
	}
}
function resetthumbup(rr,val) //Replaces the star image when unselected.
{
	var x =rr;
	for(var y=1;y<=val;y++)
	{
		document['image'+x+''+y].src="ex.graphics/thumbsup_smaller_lig.jpg";
	}
}

function setthumbdown(rr,val) //Replaces the star image when selected.
{
	var x = rr;
	for(var y=1;y<=val;y++)
	{
		document['image'+x+''+y].src="ex.graphics/thumbsdwn_smaller_dar_red.jpg";
	}
}
function resetthumbdown(rr,val) //Replaces the star image when unselected.
{
	var x =rr;
	for(var y=1;y<=val;y++)
	{
		document['image'+x+''+y].src="ex.graphics/thumbsdwn_smaller_lig.jpg";
	}
}

 
function handleEnter(e) {
		
		var charCode;
		var value=Base64.encode(document.getElementById('searchbox').value);
		
		if(e && e.which){
			charCode = e.which;
		}else if(window.event){
			e = window.event;
			charCode = e.keyCode;
		}
		if(charCode == 13) {
		  window.location="searchuser.php?k="+value;
		  }
	}


function AddFriend(cache_method,ui_id,id){
	
	var uid=Base64.encode(id);
	var msg=Base64.encode(document.getElementById('message').value);
	
	Http.get({
			
			url: "ajaxresponse/friendrequest.php?uid="+uid+"&msg="+msg,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
}


function composemessage(cache_method,ui_id,id){
	var uid=Base64.encode(id);
	var msgsub=Base64.encode(document.getElementById('subject').value);
	var message=Base64.encode(document.getElementById('msg').value);
	
	
	if(msgsub==''){
		alert('Subject cannot be Empty');
		document.getElementById('subject').focus();
		return false;
	}
	if(message==''){
		alert('Message body cannot be Empty');
		document.getElementById('msg').focus();
		return false;
	}
	
document.getElementById(ui_id).innerHTML = '<div><img src="ex.graphics/loading2.gif" align="center" /></div>';
	
	Http.get({
			
			url: "ajaxresponse/sendmessage.php?uid="+uid+"&msgsub="+msgsub+"&message="+message,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
}


function divstatus(divid){
  
	if(document.getElementById(divid).style.display=='block'){
		 document.getElementById(divid).style.display='none';
	 }
	else{
	  document.getElementById(divid).style.display='block';
	}
 }
 
 function divfocus(divid){
	 document.getElementById(divid).focus();
	 document.getElementById(divid).select();
 }
function changestatus(cache_method,ui_id,id){
	
	 var profstatus=Base64.encode(document.getElementById('status').value);

		 document.getElementById('status').disable=true;
		 document.getElementById('sbtstatus').disable=true;
		 
		 Http.get({
			
			url: "ajaxresponse/profilestatus.php?val="+profstatus+"&id="+Base64.encode(id),
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
		 
    document.getElementById('statuschange').style.display='none';
}

// Show basic information of user //
function basicprofile(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	
	Http.get({
		url: "ajaxresponse/basicprofile.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function personalprofile(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/personalprofile.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function contactprofile(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/contactprofile.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function musicprofile(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/musicprofile.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function faprofile(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/faprofile.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function changepass(cache_method,ui_id){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/changepass.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}//end basic

function showbasic(cache_method,ui_id,uid){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	
	Http.get({
		url: "ajaxresponse/showbasic.php?uid="+uid+" ",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}

function artistType(){ 
	
	 if(document.getElementById('a_type').value=='Band'){
      document.getElementById('band_memberlist').style.display='block';}
	 else
	  document.getElementById('band_memberlist').style.display='none';
}	

function sendwall(cache_method,ui_id,fromid,toid){
	
	   
		var msg=document.getElementById('walls').value;
		if(msg==""){
			
			alert('Please enter wall');
			document.getElementById('walls').focus();
			return false;
		}else{
	
		Http.get({
			
			url: "ajaxresponse/wall.php?tid="+Base64.encode(toid)+"&fid="+Base64.encode(fromid)+"&message="+Base64.encode(msg),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
		
		document.getElementById('walls').value="";
		}
}

function addphotocomment(cache_method,ui_id,fromid,toid,albumid,picid){ 

	var com = document.getElementById('comment').value;
	chars = ' ';

	var test = (ltrim(rtrim(com, chars), chars));
	
	if(test == '' || test == 'Write a Comment...' ){
		alert('Please enter comment');
		document.getElementById('comment').focus();
		return false;
	}else{

	Http.get({
		url: "ajaxresponse/addphotocomment.php?fid="+Base64.encode(fromid)+"&tid="+Base64.encode(toid)+"&usercom="+Base64.encode(com)+"&pid="+Base64.encode(picid)+"&lbm="+Base64.encode(albumid),
		callback: update,
		cache: cache_method
	}, [ui_id]);
	
	document.getElementById('comment').value="";
	}
	
}


function deletephotocomment(cache_method,ui_id,id,albumid,picid){
		
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletephotocomment.php?del="+Base64.encode(id)+"&pid="+Base64.encode(picid)+"&lbm="+Base64.encode(albumid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}


function sendbackwall(cache_method,ui_id,fromid,toid,divid){
	
	   
		var msg=document.getElementById(divid).value;
		if(msg==""){
			
			alert('Please enter wall');
			document.getElementById(divid).focus();
			return false;
		}else{
	
		Http.get({
			
			url: "ajaxresponse/wall.php?reply='yes'&tid="+Base64.encode(toid)+"&fid="+Base64.encode(fromid)+"&message="+Base64.encode(msg),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
		
		
			document.getElementById(ui_id).style.display='none';
	}
	
}
function deltewall(cache_method,ui_id,id){
		
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletewall.php?id="+Base64.encode(id),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}


function delteallwall(cache_method,ui_id,id){
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletewall.php?id="+Base64.encode(id)+"&del='all'",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}
function delteallcomments(cache_method,ui_id,id){
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletewall.php?id="+Base64.encode(id)+"&delcom='all'",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function deletefriend(cache_method,ui_id,id,name){
	  if(confirm('Are you sure you want to remove '+name+' as a F.A.P? This cannot be undone. '+name+' will not be notified.')){
		Http.get({
			
			url: "ajaxresponse/deletefriend.php?id="+Base64.encode(id),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}


function composemail(cache_method,ui_id){ 
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "ajaxresponse/composemail.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}// end composemail


function createphotoalbum(cache_method,ui_id){  
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	
	Http.get({
		url: "ajaxresponse/createphotoalbum.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
}// end createphotoalbum

function uploadphotos(cache_method,ui_id){  
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	
	Http.get({
		url: "ajaxresponse/uploadphoto.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
}// end uploadphoto


function inbox(cache_method,ui_id){
	
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	Http.get({
		url: "inbox.php",
		callback: update,
		cache: cache_method	
	}, [ui_id]);
	
}// end composemail


function deleteinboxmsg(cache_method,ui_id,id){
	
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletemsg.php?id="+Base64.encode(id),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function deletealbum(cache_method,ui_id,id){ 
	  if(confirm('Are you sure you want to delete. This will delete all the photos in this album.')){
		Http.get({
			
			url: "ajaxresponse/deletealbum.php?id="+Base64.encode(id),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function deleteall(cache_method,ui_id,id,myform){
	
	conf = confirm("Are You Sure You want to Delete?");
	
	if(conf){
		document.getElementById("close").click();
		return true;
	}else{
		return false;
	}
	
	
	var tmp='';
	var aa = document.getElementById(myform);
	
	for (var i =0; i < aa.elements.length; i++) 
	{
		if(aa.elements[i].checked == true)
		{
			if (tmp == '' )
			{
				tmp= aa.elements[i].value;
			}
			else
			{
				tmp=tmp + ',' + aa.elements[i].value;
			}	
		}
	}
				
	  if(confirm('Are you sure you want to delete')){
		
		Http.get({
			
			url: "ajaxresponse/deleteall.php?id="+Base64.encode(id)+"&del='all'",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}


function deleteinboxrep(cache_method,ui_id,id){ 

	  if(confirm('Are you sure you want to delete')){
		Http.get({
		url: "ajaxresponse/deleteinboxrep.php?id="+Base64.encode(id)+"&del='all'",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function deleterep(cache_method,ui_id,id){ 

	  if(confirm('Are you sure you want to delete')){
		Http.get({
		url: "ajaxresponse/deleterep.php?id="+Base64.encode(id)+"&del='all'",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function usrpage(cache_method,ui_id,val,tpg){
	document.getElementById(ui_id).innerHTML = '<div style="text-align:center; height:200px; margin-top:150px;"><img src="ex.graphics/loading2.gif" align="center" /></div>';
	 Http.get({
			
			url: "ajaxresponse/userpagenation.php?type="+Base64.encode(val)+"&pageNum="+Base64.encode(tpg),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	
	}

///////////////////// START: Music Functions ////////////////////
function deletemusicalbum(cache_method,ui_id,albumid){
	
	if(confirm("Are you sure you want to delete. This will delete all the musics in this album.")){
	 Http.get({
			
			url: "ajaxresponse/deletemusicalbums.php?id="+Base64.encode(albumid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	}
}
	
function deletealbumsong(cache_method,ui_id,albumid,songid){
	
	if(confirm("Are you sure you want to delete.")){
	 Http.get({
			
			url: "ajaxresponse/deletealbumsong.php?aid="+Base64.encode(albumid)+"&sid="+Base64.encode(songid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	}
}
///////////////////// END: Music Functions ////////////////////

var heightlimit = 0;
function openit(cache_method,ui_id){
	heightlimit++;
	
	if(heightlimit !=5000){
		heightlimit = 0;
		 Http.get({
			url: "ajaxresponse/home_toppanel.php",
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
		 
		t = setTimeout("openit(Http.Cache.GetNoCache,'newuser')",10000);
		return false;
		
	}else if(heightlimit == 1){
		
		 Http.get({
			url: "ajaxresponse/home_toppanel.php",
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
	}
	t = setTimeout("openit(Http.Cache.GetNoCache,'newuser')",10000);
	return false;
}

var htlimit = 0;
function openalbum(cache_method,ui_id,usid){
	if(htlimit !=5000){
		htlimit = 0;
		 Http.get({
				 
			url: "ajaxresponse/featurealbum.php?uid1="+usid,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
		 
		t = setTimeout("openalbum(Http.Cache.GetNoCache,'randomalbum',"+usid+")",10000);
		return false;
		
	}else if(htlimit == 1){
		 Http.get({
				 
			url: "ajaxresponse/featurealbum.php?uid1="+usid,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
	}
	t = setTimeout("openalbum(Http.Cache.GetNoCache,'randomalbum',"+usid+")",10000);
	return false;
	
}



function next(id){
	if(id < 4) {
		var divid = 'addalbum_'+id;
		document.getElementById(divid).style.display = 'block';
		document.getElementById('count').value=id;
	}
}


function remove(id){
	var divid = 'addalbum_'+id;
	document.getElementById(divid).style.display = 'none'; 
	document.getElementById('count').value=id-1;
}

function addmusichit(testing){
	var test = testing;
	musichit(Http.Cache.GetNoCache,'response_musichit',test);
}

///////////////////////////////////   Faisal Functions //////////////////////////////////////////////////////

function thumbrating(cache_method,ui_id,op,rates,uid){
	
	 if(rates!=""){

		 Http.get({
			
			url: "ajaxresponse/thumbrating.php?val="+Base64.encode(rates)+"&action="+op+"&uid="+uid,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
	 	}
    }
	
function musicrating(cache_method,ui_id,op,musicid,act){
	if(act==null) act=0; 
	 Http.get({
			
			url: "ajaxresponse/musicthumbrating.php?sid="+Base64.encode(musicid)+"&action="+Base64.encode(op)+"&act="+act,
			callback: registerupdate,
			cache: cache_method
			
			}, [ui_id]);
}
	
function vote(testing){
	var test = testing;
	musicrating(Http.Cache.GetNoCache,'message_area','add',test,1);
}

function votedn(testing){
var test= testing;
musicrating(Http.Cache.GetNoCache,'message_area','sub',test,1);
}

function profileview(cache_method,ui_id,rates,uid){ 
	
		 Http.get({ 
				  
			url: "ajaxresponse/profileview.php?val="+Base64.encode(rates)+"&uid="+uid,
			callback: registerupdate,
			cache: cache_method
			},[ui_id]);
    }

//////////////////////////////////////////////////////////////////////////////////////////////////////////

function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName]){
		return;
	}
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes){
		return;
	}
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes){
		objCheckBoxes.checked = CheckValue;
	}else{
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
	}
}

function invertAll(id){ 
   var f = document.getElementById(id);
   var inputs = f.getElementsByTagName("input");
   for(var t = 0;t < inputs.length;t++){
     if(inputs[t].type == "checkbox")
       inputs[t].checked = !inputs[t].checked;
   }
 }

function delMulticontacts(myform)
	{
		
		var tmp='';
		var aa= document.getElementById(myform);
		alert(aa.elements.length);
		for (var i =0; i < aa.elements.length; i++) 
		{
			if(aa.elements[i].checked == true)
			{
				if (tmp == '' )
				{
					tmp= aa.elements[i].value;
				}
				else
				{
					tmp=tmp + ',' + aa.elements[i].value;
				}	
			}
		}
					
}

function deleteevents(cache_method,ui_id,id){
	  if(confirm('Are you sure you want to delete')){
		Http.get({
			
			url: "ajaxresponse/deletevent.php?id="+Base64.encode(id),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
	  }
}

function addplaylist(cache_method,ui_id,musicid,op){
	if(op==null) op=0;
	Http.get({
			
			url: "ajaxresponse/addtoplaylist.php?mid="+Base64.encode(musicid)+"&act="+op,
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}

function addtomyplaylist(testing){
	var test = testing;
	addplaylist(Http.Cache.GetNoCache,'message_area',test,1);
}

function addbillboard(cache_method,ui_id,musicid){
	Http.get({
			
			url: "ajaxresponse/addtobillboard.php?mid="+Base64.encode(musicid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}

function musichit(cache_method,ui_id,musicid){
	Http.get({
			
			url: "ajaxresponse/musichit_response.php?mid="+musicid,
			callback: update,
			cache: cache_method
	}, [ui_id]);
}

function gotoalbum(uid,aid){
	window.location.href="viewphoto.php?lbm="+Base64.encode(aid)+"&uid="+Base64.encode(uid)+"";
}

function show(cache_method,ui_id){
	
	var status=document.getElementById('response_log').style.display;
	if(status=='block'){
		 //document.getElementById('response_log').style.display='none';
		 var showstatus=0;
	 }
	else{
	//  document.getElementById('response_log').style.display='block';
	  var showstatus=1;
		}
	
	Http.get({
			
			url: "ajaxresponse/showlog.php?showstatus="+showstatus,
			callback: updatedivstatus,
			cache: cache_method
			
			}, [ui_id]); 
	
	
	// call function divstatus
	
	
}


function updatedivstatus(result, ui_id){ 
	var div = $(ui_id);
	//alert(div);
	
	if (result.status==Http.Status.OK){
		
				div.innerHTML = result.responseText;
				divstatus('response_log');
			
			}else{
			
			div.innerHTML = "";
	        }
}// end contactupdate()

function gotoindex(){
	self.parent.location='mylogin.php';
}

function appendTxt(txt){
		
		old_txt = document.getElementById('user_post').value;
		append_txt = txt+' '+old_txt;
		document.getElementById('user_post').value = append_txt;
		document.getElementById('user_post').focus();
		
	
	}//end appendTxt
	
function handleEnter(e) {
		
		var charCode;
		var value=Base64.encode(document.getElementById('search_post').value);
		
		if(e && e.which){
			charCode = e.which;
		}else if(window.event){
			e = window.event;
			charCode = e.keyCode;
		}
		if(charCode == 13) {
		  window.location="searchuser.php?s_post="+value;
		  }
	}

function addfavorite(cache_method,ui_id,postid){

	Http.get({
			
			
			url: "ajaxresponse/addfavorite.php?pid="+Base64.encode(postid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}

function removefavorite(cache_method,ui_id,postid){

	Http.get({
			
			
			url: "ajaxresponse/removefavorite.php?pid="+Base64.encode(postid),
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}


function addvotes(cache_method,ui_id,postid,op){
	
	Http.get({
			
			
			url: "ajaxresponse/addvotes.php?pid="+Base64.encode(postid)+"&action="+op+"",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}

function capvotes(cache_method,ui_id,capid,op){

	Http.get({
			
			url: "ajaxresponse/capvote.php?cid="+Base64.encode(capid)+"&action="+op+"",
			callback: update,
			cache: cache_method
			
			}, [ui_id]);
}

