/* fbox configs - start */
function fbox_conf(){};
fbox_conf.prototype = {	
	fbox_progress_src : 'images/indicator.gif',
	fbox_nbsp_count: 4, //IE5 ...
	fbox_close_txt : 'images/closelabel.gif',
	fbox_max_txt: 'Maximize',
	fbox_min_txt: 'Minimize',
	fbox_prev_txt: '',
	fbox_next_txt: ''		
}
/* fbox configs - ends */

/* Share this story*/
function deletethis(id){
var share1 = document.getElementById(id);
$(share1).slideDown("slow");
}
function closedeletethis(id){
var share1 = document.getElementById(id);
 $(share1).slideUp("fast");

}

function sharethis(id){
var share1 = document.getElementById(id);
$(share1).slideDown("slow");
}


function closesharethis(id){
var share1 = document.getElementById(id);
 $(share1).slideUp("fast");
}

function shared(ids){
var share2 = document.getElementById(ids);
$(share2).slideDown("slow");
}

/* Shared With Group*/
function sharedgroupthis(id){
var comm1 = document.getElementById(id);
$(comm1).animate({  height: 'show', opacity: 'show'}, 'slow' );
$(comm1).slideDown("slow");
}

function closesharedgroupthis(id){
var comm1 = document.getElementById(id);
// $(comm1).animate({ height: 'hide', opacity: 'hide' }, 'fast');
 $(comm1).slideUp("fast");
}
/* Shared With Event*/
function sharedeventthis(id){
var comm1 = document.getElementById(id);
$(comm1).animate({  height: 'show', opacity: 'show'}, 'slow' );
$(comm1).slideDown("slow");
}

function closesharedeventthis(id){
var comm1 = document.getElementById(id);
// $(comm1).animate({ height: 'hide', opacity: 'hide' }, 'fast');
 $(comm1).slideUp("fast");
}


/* Comment this story*/
function commentthis(id){
var comm1 = document.getElementById(id);
$(comm1).animate({  height: 'show', opacity: 'show'}, 'slow' );
$(comm1).slideDown("slow");
}
function closecommentthis(id){
var comm1 = document.getElementById(id);
// $(comm1).animate({ height: 'hide', opacity: 'hide' }, 'fast');
 $(comm1).slideUp("fast");
}

/* tag this story*/
function tagthis(id){
var tag1 = document.getElementById(id);
$(tag1).animate({height: 'show', opacity: 'show'}, 'slow' );
}
function closetagthis(id){
var tag1 = document.getElementById(id);
 $(tag1).animate({ height: 'hide', opacity: 'hide' }, 'fast');
}

/* bookmark this site  */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/* ----------------------------------------------------Event------------------------------------------------- */
function eventInvitaionOtherthis(id)
   { 
	var event1 = document.getElementById(id);
	//$(event1).animate({  height: 'show', opacity: 'show'}, 'slow' );
	$(event1).slideDown("slow");
	}
function closeEventInvitaionOtherthis(id)
   {
	var event1 = document.getElementById(id);
	 $(event1).slideUp("fast");
	}


function eventInvitaionRegthis(id)
  {
	var eventreg = document.getElementById(id);
	//$(eventreg).animate({  height: 'show', opacity: 'show'}, 'slow' );
	$(eventreg).slideDown("slow");
  }

function closeEventInvitaionRegthis(id)
	{
 var eventreg = document.getElementById(id);
 $(eventreg).slideUp("fast");
	}

function eventInvitaionFriendthis(id)
	{
	var eventfrid = document.getElementById(id);
	//$(eventfrid).animate({  height: 'show', opacity: 'show'}, 'slow' );
	$(eventfrid).slideDown("slow");
	}

function closeEventInvitaionFriendthis(id)
	{
	var eventfrid = document.getElementById(id);
	 $(eventfrid).slideUp("fast");
	}

function addtomeEventthis(id)
	{
	var addtome = document.getElementById(id);
	$(addtome).slideDown("slow");
	}

function closeEventAddtomethis(id)
	{
	var addtome = document.getElementById(id);
	$(addtome).slideUp("fast");
	}

function eventCancelthis(id)
   {
	var eventcancel = document.getElementById(id);
	$(eventcancel).slideDown("slow");
  }
function closeEventCancelthis(id)
	{
	var eventcancel = document.getElementById(id);
	$(eventcancel).slideUp("fast");
	}
////////////////////////////////// Story comment Start //////////////////////////////////////////////////////////////
function ajaxCommentFunction(id){ 
var commentt="comment"+id;
var storyId="storyId"+id;
var sid="cc_"+id;
var storyId = document.getElementById(storyId).value;
var comment = document.getElementById(commentt).value;
var share1 = document.getElementById("comment_"+id); 
	$.get("includes/ajaxFunctions.php","storyId=" + storyId + "&comment=" + comment,function(data){
    $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' ); 
	data = data.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
	if(data=='Comment Posted Successfully')
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
		$('<div class="comment"><div><div><div><div><div><strong>'+comment+'</strong></div></div></div></div></div><span class="author">Commented By <strong>You</strong></span>').insertAfter('div#comments_container h3');
	}
	else
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
	}
	});
}
//////////////////////////////////Story comment End//////////////////////////////////////////////////////////////



////////////////////////////////// Story Shared With Group //////////////////////////////////////////////////////////
function ajaxStoryGroupFunction(id){ 

var commentt="grouplist_"+id;
var storyId="storyId"+id;
var sid="cc_"+id;
var storyId = document.getElementById(storyId).value;
var comment = document.getElementById(commentt).value;
var share1 = document.getElementById("sharedgroup_"+id); 
	$.get("includes/ajaxFunctions.php","storyId=" + storyId + "&groupList=" + comment,function(data){
    $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' ); 
	data = data.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
if(data=='Comment Posted Successfully')
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
		$('<div class="comment"><div><div><div><div><div><strong>'+comment+'</strong></div></div></div></div></div><span class="author">Commented By <strong>You</strong></span>').insertAfter('div#comments_container h3');
	}
	else
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
	}
	});
}


///////////////////////////////////Story Shared With Event/////////////////////////////////////////

function ajaxStoryeventFunction(id){ 
var eventlistt="eventlist_"+id;
var storyId="storyId"+id;
var sid="cc_"+id;
var storyId = document.getElementById(storyId).value;
var eventlist = document.getElementById(eventlistt).value;
var share1 = document.getElementById("sharedevent_"+id); 
	$.get("includes/ajaxFunctions.php","storyId=" + storyId + "&eventList=" + eventlist,function(data){
    $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' ); 
	data = data.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
	if(data=='Comment Posted Successfully')
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
		$('<div class="comment"><div><div><div><div><div><strong>'+comment+'</strong></div></div></div></div></div><span class="author">Commented By <strong>You</strong></span>').insertAfter('div#comments_container h3');
	}
	else
	{
		$(share1).animate({  height: 'hide'}, 'fast');
		$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
		$('#'+sid).fadeOut(4500).html(data);
	}
	});
}

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





//////////////////////////////////Story comment End//////////////////////////////////////////////////////////////
















//////////////////////////////////Story Share//////////////////////////////////////////////////////////////

function ajaxStoryShareFunction(id){
	
		var comment="comment"+id;
		var storyId="storyId"+id;
		var storyTitle="storyTitle"+id;
		//var friendName="friendName"+id;
		var friendEmail="friendEmail"+id;
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
////////////////////////////////// Share story : start///////////////////////////////
	ajaxRequest.onreadystatechange = function(){ 	

		if(ajaxRequest.readyState == 4){ 
		var sid="cc_"+id;
			var ajaxDisplay = document.getElementById(sid);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
				
			var share1 = document.getElementById("share_"+id);
			
			if(ajaxRequest.responseText=='You have not entered friend\'s name.' || ajaxRequest.responseText=='You have not entered friend\'s email.' || ajaxRequest.responseText=='Your email is invalid.')
			{
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			else
			{
		
			$(share1).animate({ height: 'hide'}, 'fast');
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			
		}
	}

	var storyId = document.getElementById(storyId).value;
	var storyTitle = document.getElementById(storyTitle).value;
	//var friendName = document.getElementById(friendName).value;
	var friendEmail = document.getElementById(friendEmail).value;
	 //var queryString = "?action=share&storyId=" + storyId + "&storyTitle=" + storyTitle + "&friendName=" + friendName + "&friendEmail=" + friendEmail;
	var queryString = "?action=share&storyId=" + storyId + "&storyTitle=" + storyTitle + "&friendEmail=" + friendEmail;
	
	ajaxRequest.open("GET", "includes/ajaxFunctionsDefault.php" + queryString, true);
	ajaxRequest.send(null); 
}
/////////////////////////////////// Share story : end ////////////////////////////////

/////////////////////////////////////////// Story Subscribe /////////////////////////////////////////////////////////////////////////


function ajaxStorySubscribeFunction(id,ownerId){

	var sid="cc_"+id;
	$.get("includes/ajaxFunctions.php","action=subscribe&storyId=" + id + "&ownerId=" + ownerId,function(data){
    $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
	$('#'+sid).fadeOut(4500).html(data);
	});

}

/////////////////////////////////////////////////// Story Tag ///////////////////////////////////////////

function ajaxTagFunction(id,ownerId){
	
			var tag="tag"+id;
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){ 	

		if(ajaxRequest.readyState == 4){ 
		var sid="cc_"+id;
			var ajaxDisplay = document.getElementById(sid);
			var tag1 = document.getElementById("tag_"+id);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			$(tag1).animate({ height: 'hide'}, 'fast');

		}
	}
	
	var tag = document.getElementById(tag).value;
	var queryString = "?action=tagStory&storyId=" + id + "&ownerId=" + ownerId + "&tag=" + tag;
	ajaxRequest.open("GET", "includes/ajaxFunctions.php" + queryString, true);
	ajaxRequest.send(null); 
}

 /* add story validation*/
function validateAddStory()
{

var title=document.getElementById("title").value;
var fullText=document.getElementById("fullText").value;
var storyImage=document.getElementById("storyImage").value;
var access=document.getElementById("access").value;

if(title=='')
{
alert("Please enter title.");
document.addStory.title.focus() ;
return false;
}


if(access=='SELECT')
{
alert("Please select access right.");
document.addStory.access.focus() ;
return false;
}

return true;
}
/* End add story validation*/

//Changes stories with the dropdown

function changeStoryWithCity(city){
var xCity=city;
	var iCity=xCity.split(",");
 $.get("avail.php", "action=story_city&city="+city, function(data){
 $('#story_content').html(data); 
 $('#city_name').html('Showing Stories From&nbsp;'+iCity[0]);
 
 });
 }
 
 //removes subscribed author
 function removeAuthor(id){
 $.get("avail.php", "action=remAuth&id="+id, function(data){

 var postid=data.split(",");

 for(var i=0;i<postid.length;i++){
 
	$('#pop'+postid[i]).slideUp('slow');
 }
 }
 );
 
 }
 
 //Ajax Pagination for story browsing
 
function pageNext(eu,limit,li){
alert(eu+"eu "+limit+" start"+li);
$.get("avail.php","pageid="+li+"&eu="+eu+"&limit="+limit+"&action=ajaxPage",function(data){

$('#story_curl').hide(1000,function(){$('#story_holder').html(data)});

});

}

function expand_story(id){

	$.get("avail.php","action=full_story&id="+id,function(data){
	$('#full_story'+id).slideDown(1000).html(data);
	$('#qt'+id).html("<a href='javascript:void(0);' onclick=collapse_story("+id+"); >Collapse-</a>");
	
	});
}

function collapse_story(id){
	$.get("avail.php","action=collapse_story&id="+id,function(data){
	$('#full_story'+id).slideDown(1000).html(data);
	$('#qt'+id).html("<a href='javascript:void(0); '>Expand+</a>");
	
	});

}

//----------------text counter---------------------------------
function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        

	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}

	else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}

function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}

//--------------------------------------------------------------------------------------
//#######################################Invitation ################################################################//
function ajaxmessage()
{
			$('#message').animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#message').fadeOut(4500).html(data);
}
//#######################################################################################################################

function invitationForm()
{
var email_list=document.getElementById("email_list").value;
var personal=document.getElementById("personal").value;

if(email_list=='')
{
alert("You have not entered an email.");
document.invitefriends.email_list.focus();
return false;
}
}
//--------------------------------------------------Add friend -------------------------------------------------------
function addFriend(appl)
{
var div =document.getElementById(appl);
$('#'+appl).animate({ width: 'show'}, 'slow');
}
function addFriendClose(appl)
{
var div =document.getElementById(appl);
//div.style.display="none";
$('#'+appl).animate({ height: 'hide'}, 'fast');
}

///-----------------------------------------------------------------------------------------
function addFrndFrmSub2(id){
	
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){ 				

		if(ajaxRequest.readyState == 4){ 
				var show="show"+id;
				var added='added_'+id;
			var ajaxDisplay = document.getElementById(added);
			ajaxDisplay.innerHTML = ajaxRequest.responseText; //add_{FRIENDID}
			$('#add_'+id).animate({ height: 'hide'}, 'fast');
		}
	}
	
		var addFriendMsg="addFriendMsg"+id;
		var mid="mid"+id;
		var fid="fid"+id;
		var oid=id;
			var addFriendMsgv = document.getElementById(addFriendMsg).value;
			var midv = document.getElementById(mid).value;
			var fidv = document.getElementById(fid).value;
	var queryString = "?"+addFriendMsg+"="+addFriendMsgv+"&"+mid+"="+midv+"&"+fid+"="+fidv+"&oid="+id;
	ajaxRequest.open("GET", "includes/addFriendRequest.php" + queryString, true);
	ajaxRequest.send(null); 

}

//--------------------------------------------------------------------------------------------------------------------
// confirm and reject script
function confirmit(id) 
{
$.post('includes/addFriendRequest.php', {'fidc': id}, function(data) {
$('#show').html(data);
$('#tab'+id).animate({ height: 'hide'}, 'slow');
$('#show').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
	
}

function rejectit(id) 
{
	$.post('includes/addFriendRequest.php', {'fidr': id}, function(data) {
	$('#show').html(data);
$('#tab'+id).animate({ height: 'hide'}, 'slow');
$('#show').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
}
function confirmitEvent(id) 
{
var attendStatus="attendStatus"+id;
//var attendStatusValue = document.getElementById(attendStatus).value;
var attendStatusValue=$("input[@name="+attendStatus+"]:checked").val();//changes all to nothing
//alert(aaa);
$.post('includes/addEventRequest.php', {'evidc': id, 'attendStatus': attendStatusValue}, function(data) {
($('#show').html(data));
$('#tab'+id).animate({ height: 'hide'}, 'slow1');
$('#show').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;

}

function rejectitEvent(id) 
{
	alert(id);
	$.post('includes/addEventRequest.php', {'evidr': id}, function(data) {
	$('#show').html(data);
$('#tab'+id).animate({ height: 'hide'}, 'slow');
$('#show').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
}

//--------------------------------------------------------------------------------------------------------------------

/*-----------------Positive Vote------------------------*/
function positiveVote(sid,mid)
{
alert('hello how are u');	
$.post('includes/rankAction.php', {'storyid': sid,'myid': mid,'action': 'up' }, function(data) { 
$('#cc_'+sid).html(data);
$('#cc_'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' ); 
$('#cc_'+sid).fadeOut(4500).html(data);
});
	return false;
}

function negativeVote(sid,mid)
{
	alert('hello');
$.post('includes/rankAction.php', {'storyid': sid,'myid': mid,'action': 'down' }, function(data) { 
$('#cc_'+sid).html(data);
$('#cc_'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
$('#cc_'+sid).fadeOut(4500).html(data);
});
	return false;
}

function addPeople()
{
	
//document.getElementById('addPeople').style.display="block";
$('#addPeople').slideDown("slow");
document.getElementById('hideIt').style.display="none";
document.getElementById('openIt').style.display="block";
return false;
}

function closeme()
{
$('#addPeople').slideUp("slow");
document.getElementById('openIt').style.display="none";
document.getElementById('hideIt').style.display="block";
return false;
}


function ajaxStoryDeleteFunction(id)
{ 
$.get('includes/ajaxFunctions.php', {'action': 'delete_story','id': id}, function(data) { 
$('#story_'+id).slideUp('slow');
$('#delete_'+id).html(data);
});
}


function ajaxStoryDeleteGroupFunction(id)
{ 
$.get('includes/ajaxFunctions.php', {'action': 'delete_gstory','id': id}, function(data) { 
$('#story_'+id).slideUp('slow');
$('#delete_'+id).html(data);
});
}





function openDeactivateDiv()
{
$('#deactivate').animate({Display: 'block', opacity: 'show'}, 'slow' );
return false;
}

function closeDeactivateDiv()
{ 
$('#deactivate').fadeOut(450); 
return false;
}


/* sIFR - Settings  - Starts*/
		$(document).ready(function(){
			$.sifr({
				path: 'includes/resources/',
				save: true
			});
  			$('div.module h3').sifr({ font: 'AvantGardeMdBT', fontSize:'1.2em'});
			$('div.bbuzzers h4').sifr({ font: 'AvantGardeMdBT', fontSize:'1.2em', aoY:-3});
			$('h3.pagehead').sifr({ font: 'AvantGardeMdBT', fontSize:'1.1em'});
			});
		
/* sIFR - Settings  - Starts*/


function postwall(receiverID,senderID,senderImage) 
{ 
var scrap=document.getElementById('scrap').value;
if(document.getElementById('scrap').value=='')
{
	
}
else
{
$.post('includes/scrapBookAction.php', {'receiver': receiverID,'sender': senderID,'scrap': scrap,'senderImage': senderImage }, function(data) { 
$('#showscrapmsg').html('Scrap posted successfully.'); 
$('#showscrapmsg').animate({Display: 'block', opacity: 'show'}, 'slow' );
$('#showscrapmsg').fadeOut(4500).html('Scrap posted successfully.');
$('<div class="scraps"> <div> <img src="images/profile/'+senderImage+'"><p class="author"><strong>You</strong> ,  Just Now </p><p>'+data+'</p></div></div>').insertAfter('div#scraps');
document.getElementById('scrap').value="";

});
	return false;
}
}

function postwallevent(eventID,scrapposterID,scrapposterImage) 
{ 
var scrap=document.getElementById('scrap').value;
if(document.getElementById('scrap').value=='')
{
	
}
else
{
$.post('includes/scrapBookActionEvent.php', {'eventID': eventID,'scrapposterID': scrapposterID,'scrap': scrap,'scrapposterImage': scrapposterImage }, function(data) { 
$('#showscrapmsg').html('Scrap posted successfully.'); 
$('#showscrapmsg').animate({Display: 'block', opacity: 'show'}, 'slow' );
$('#showscrapmsg').fadeOut(4500).html('Scrap posted successfully.');
$('<div class="scraps"> <div> <img src="images/profile/'+scrapposterImage+'"><p class="author"><strong>You</strong> ,  Just Now </p><p>'+data+'</p></div></div>').insertAfter('div#scraps');
document.getElementById('scrap').value="";

});
	return false;
}
}

function replyPostwall(receiverID,senderID,scrapID) 
{ 
var scrap=document.getElementById('replyscrap_'+scrapID).value;
if(document.getElementById('replyscrap_'+scrapID).value=='')
{
	
}
else
{
$.post('includes/scrapBookAction.php', {'receiver': receiverID,'sender': senderID,'scrap': scrap }, function(data) { 
document.getElementById('replyscrap_'+scrapID).value="";
$('#replyScrapBox_'+scrapID).slideUp('slow');
$('#replyScrapMsg_'+scrapID).html('<Scrap posted successfully.'); 
$('#replyScrapMsg_'+scrapID).animate({Display: 'block', opacity: 'show'}, 'slow' );
$('#replyScrapMsg_'+scrapID).fadeOut(4500).html('<font color=red>Scrap posted successfully.</font>');

$('<div class="scraps"> <div> <img src="images/profile/man_small.gif"><p class="author"><strong>You</strong> ,  Just Now </p><p>'+data+'</p></div></div>').insertAfter('div#scraps');
 });
	return false;
}
}


function openReplyWindow(scrapID)
{
	$('#replyScrapBox_'+scrapID).animate({Display: 'block', opacity: 'show'}, 'slow' );
}

function closeReplyWindow(scrapID)
{
	$('#replyScrapBox_'+scrapID).slideUp('slow');
}



function deleteScrapConfirmation(scrapid)
{ 
var pheight = $('#scrap_'+scrapid).height();
var pwidth = $('#scrap_'+scrapid).width();
var twidth = $('#dodeletescrap_'+scrapid).width();
var ptop= parseInt(pheight/4);
var pleft= parseInt((pwidth-twidth)/2);
$('#dodeletescrap_'+scrapid).animate({opacity: 'show'});
$('#dodeletescrap_'+scrapid).css({top:ptop+"px"});
$('#dodeletescrap_'+scrapid).css({left:pleft+"px"});
$('#scrap_'+scrapid).animate({opacity: 0.2});	
}

function closeScrapDelDiv(scrapid)
{
$('#scrap_'+scrapid).animate({opacity:1}, 'slow' );
$('#dodeletescrap_'+scrapid).fadeOut(450); 
}

function deleteScrapConfirm(scrapid,senderid,receiverid)
{
$.post('includes/ajaxFunctions.php', {'action': 'delete_scrap','id': scrapid,'senderid': senderid,'id': scrapid,'receiverid': receiverid}, function(data) { 
$('#dodeletescrap_'+scrapid).html(data); 
$('#dodeletescrap_'+scrapid).animate({height:'hide'},'slow'); 
$('#scrap_'+scrapid).slideUp(950).animate({display:'none'},'slow'); 
});
}


function deleteScrapEventConfirm(scrapid,senderid)
{
$.post('includes/ajaxFunctions.php', {'action': 'delete_scrapEvent','id': scrapid,'senderid': senderid}, function(data) { 
$('#dodeletescrap_'+scrapid).html(data); 
$('#dodeletescrap_'+scrapid).animate({height:'hide'},'slow'); 
$('#scrap_'+scrapid).slideUp(950).animate({display:'none'},'slow'); 
});
}





function deleteCommentConfirmation(id)
{ 
$('#dodeleComment_'+id).animate({Display: 'block', opacity: 'show'}, 'slow' );
}

function closeCommentDelDiv(id)
{
$('#dodeleComment_'+id).fadeOut(450); 
}

function deleteCommentConfirm(id,whocomment,storyownerid)
{
$.post('includes/ajaxFunctions.php', {'action': 'delete_comment','id': id,'whocomment': whocomment,'storyownerid': storyownerid}, function(data) { 
$('#comment_'+id).fadeOut(1500);
$('#dodeleComment_'+id).html(data);
});
}


function deleteGroupCommentConfirm(id,whocomment)
{
	alert('hi hafeez');
$.post('includes/ajaxFunctions.php', {'action': 'delete_group_comment','id': id,'whocomment': whocomment}, function(data) { 
$('#comment_'+id).fadeOut(1500);
$('#dodeleComment_'+id).html(data);
});
}


function validUploadPhotos()
{ 
var title=document.getElementById("albumName").value;
	if(title=='')
	{
	alert("Please enter album Name.");
	document.validUploadPhotosForm.albumName.focus() ;
		return false;
	}
	return true;	
}

function delInboxMessage(id)
{ 
	$.post('includes/ajaxFunctions.php', {'action': 'delete_InboxMsg','id': id}, function(data) { 
	$('#msg_'+id).slideUp('slow');
	//$('#msg_'+id).html(data);
	});
	}
	function delSentMessage(id)
	{ 
	$.post('includes/ajaxFunctions.php', {'action': 'delete_SentMsg','id': id}, function(data) { 
	$('#msg_'+id).slideUp('slow');
	//$('#msg_'+id).html(data);
	});
}

function submitExternalLink()
{
	var extLink=document.getElementById("extLink").value;
	var extCategory=document.getElementById("extCategory").value;
	var extTitle=document.getElementById("extTitle").value;
	$.post('includes/ajaxFunctions.php', {'action': 'send_externalLink','extCategory': extCategory, 'extLink': extLink, 'extTitle': extTitle}, function(data) {
	$('#externalDiv').html(data);
	});
	var extLink=document.getElementById("extLink").value='';
	var extCategory=document.getElementById("extCategory").value='';
	var extTitle=document.getElementById("extTitle").value='';
}

function sendQuickMessage()
{
	var subject=document.getElementById("composeQuickTitle").value;
	var message=document.getElementById("composeQuickMsg").value;
	var receiver=document.getElementById("quickfid").value;
	$.post('includes/ajaxFunctions.php', {'action': 'send_sendQuickMessage', 'subject': subject, 'message': message, 'receiver': receiver}, function(data) {
	$('#mainquickmessagediv').slideUp('slow');
	$('#sendQuickMessageDiv').html(data);
	
	});

}

function deleteAlbum(albid)
{
	$.post('includes/ajaxFunctions.php', {'action': 'delete_deletePhotoAlbum', 'albid': albid}, function(data) {
	$('#album_'+albid).slideUp('slow');
	$('#albdel_'+albid).html(data);
	});
}	

function deleteImage(imgid)
{ 
	$.post('includes/ajaxFunctions.php', {'action': 'delete_deleteImage', 'imgid': imgid}, function(data) {
	$('#album_'+imgid).slideUp('slow');
	$('#albdel_'+imgid).html(data);
	});
}	

/* Registeration script - start */
function getXmlObj(){
	var xRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		xRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			xRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				xRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	return xRequest;
}
function init()
{
	var obj = new actb(document.getElementById("high_school"), high_schools);
	var obj2 = new actb(document.getElementById("college"), colleges);
	
	focusById("email");
}
function initCity()
{
	var obj = new actb(document.getElementById("cityName"), cityName);

	focusById("email");
}

function getElement(id)
{
	if(document.getElementById)
		return document.getElementById(id);
	else if(document.all)
		return document.all[id];
	else
		return null;
}
function focusById(id)
{
	getElement(id).focus();
}
<!------------------------------------------------------------------------------------------------------------>
function verifyEmail(emailad) 
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,3}$/;
	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1))
	{
		return false;
	}
}
function ltrim(str)
{
	while(""+str.charAt(0)==" ")
	{
		str=str.substring(1,str.length);
	}
	return str;
}
function reverse(str)
{
	var reversedstr = "";
	var strArray;
	strArray = str.split("");
	for(var i = str.length -1 ; i >= 0 ; i--)
	{
		reversedstr += strArray[i];
	}
	return reversedstr;
}
function trim(str)
{
	str = ltrim(str);
	str = reverse(str);
	str = ltrim(str);
	str = reverse(str);
	return str;
}

function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
	var numberfield = objName;
	if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
	{
		numberfield.select();
		numberfield.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{

var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";

for (i = 0;  i < checkStr.value.length;  i++)
{
ch = checkStr.value.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{	
alertsay = "Enter only Numeric values "
//alertsay = alertsay + checkOK + "\" in the \"" +  "\" field."
alert(alertsay);
return (false);
}

// set the minimum and maximum
var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
{
alertsay = "Enter a value greater than or "
alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
}



function validate()
{
    var f = document.registration;

if(trim(f.email.value) == "")
    {
		f.email.focus();
		alert("Enter valid email id.");
        return false;
    }
  if (verifyEmail(trim(f.email.value)) == false && trim(f.email.value)!="")
    {
        f.email.focus();
        alert("Your email is incorrect, check it.");
        return false;
    }

	    if((trim(f.pass.value) == "") || (f.pass.value.length < 6))
    {
		f.pass.focus();
		alert("Enter password(minimum six character).");
        return false;
    }

	    if(trim(f.pass_confirm.value) == "")
    {
		f.pass_confirm.focus();
		alert("Confirm password.");
        return false;
    }
	    if(trim(f.pass_confirm.value) != trim(f.pass.value))
    {
		f.pass_confirm.focus();
		alert("Passwords do not match.");
        return false;
    }

	    if(trim(f.first_name.value) == "")
    {
		f.first_name.focus();
		alert("Enter first name.");
        return false;
    }
    if(trim(f.last_name.value) == "")
    {
		f.last_name.focus();
		alert("Enter last name.");
        return false;
    }

    var errormsg="";
	myOption = -1;
for (i=document.registration.sex.length-1; i > -1; i--) {
if (document.registration.sex[i].checked) {
myOption = i; i = -1;
}
}

if (myOption == -1) {
alert("Please select your sex.");
return false;
}


    if(document.registration.birthday_month.value == "-1")
    {
		f.birthday_month.focus();
		alert("Select month.");
        return false;
    }
	
	    if(trim(f.birthday_day.value) == "-1")
    {
		f.birthday_day.focus();
		alert("Select day.");
        return false;
    }
	    if(trim(f.birthday_year.value) == "-1")
    {
		f.birthday_year.focus();
		alert("Select year.");
        return false;
    }

    if(trim(f.high_school.value) == "")
    {
		f.high_school.focus();
		alert("Enter high school.");
        return false;
    }

/*    if(trim(f.college.value) == "")
    {
		f.college.focus();
		alert("Enter college.");
        return false;
    }
*/
    if(trim(f.primary_status.value) == "SELECT")
    {
		f.primary_status.focus();
		alert(" Select primary status.");
        return false;
    }
    if(trim(f.city.value) == "SELECT")
    {
		f.city.focus();
		alert(" Select city.");
        return false;
    }
	

    if(trim(f.txtCaptcha.value) == "")
    {
		f.txtCaptcha.focus();
		alert("Please enter image text.");
        return false;
    }

if(!getElement('agree').checked) {
document.registration.agree.focus();

alert('You must read and agree to the terms of use to register.'); 
return false;
}

	return true;
}






/*** Face Book Resgistration ********/

function fbvalidate()
{
    var fb = document.FbRegistration;	
	
		if(trim(fb.email.value) == "")
    {
		fb.email.focus();
		alert(" Enter valid email id.");
        return false;
    }
  if (verifyEmail(trim(fb.email.value)) == false && trim(fb.email.value)!="")
    {
        fb.email.focus();
        alert(" Your email is incorrect, check it.");
        return false;
    }
	
	    var errormsg="";
	
    if(trim(fb.high_school.value) == "")
    {
		fb.high_school.focus();
		alert("Enter high school.");
        return false;
    }


    if(trim(fb.primary_status.value) == "SELECT")
    {
		fb.primary_status.focus();
		alert(" Select primary status.");
        return false;
    }
    if(trim(fb.city.value) == "SELECT")
    {
		fb.city.focus();
		alert(" Select city.");
        return false;
    }


if(!getElement('agree').checked) {
document.FbRegistration.agree.focus();

alert('You must read and agree to the terms of use to register.'); 
return false;
}

	return true;
}



/*** Realin's functions ********/
function getE(name)
{

	if (document.getElementById)
		var elem = document.getElementById(name);
	else if (document.all)
		var elem = document.all[name];
	else if (document.layers)
		var elem = document.layers[name];

		return elem;
}
/* function val_email(n){

var xEmail=getE(n.name).value;
var obj=getXmlObj();

	// Create a function that will receive data sent from the server
	obj.onreadystatechange = function(){
		if(obj.readyState == 4){
			document.myForm.time.value = xRequest.responseText;
		}
	}
	obj.open("GET", "avail.php", true);
	obj.send(null); 

} */

/* Registeration script - ends */


function replyMessageDivOperation()
{
	$('#inboxMsg').slideUp('slow');
	$('#replyMsg').animate({Display: 'block', opacity: 'show'}, 'slow' );
}

function sendReplyMessage()
{
	var replyTo=document.getElementById("replyTo").value;
	var replySubject=document.getElementById("replySubject").value;
	var replyMessage=document.getElementById("replyMessage").value;
	$.post('includes/ajaxFunctions.php', {'action': 'send_sendReplyMessage', 'replyTo': replyTo, 'replySubject': replySubject, 'replyMessage': replyMessage}, function(data) {
	$('#replyMsg').slideUp('slow');
	$('#replyResponse').html(data);
	});
}

function ajaxReportAbuseFunction(storyid)
{
//	$('#delete_'+storyid).animate({Display: 'block', opacity: 'show'}, 'slow' );
var pheight = $('#story_content div.story_post').height();
var pwidth = $('#story_content div.story_post').width();
var twidth = $('#delete_'+storyid).width();
var ptop= parseInt(pheight/3);
var pleft= parseInt((pwidth-twidth)/2);
$('#delete_'+storyid).css({top:ptop+"px"});
$('#delete_'+storyid).css({left:pleft+"px"});
$('#delete_'+storyid).animate({opacity: 'show'});
$('div.story_desc').animate({opacity: 0.2});

}

function storyReportFunction(storyid)
{
	$.post('includes/ajaxFunctions.php', {'action': 'report_story','storyid': storyid}, function(data) { 
	$('#delete_'+storyid).slideUp('slow');
	$('#cc_'+storyid).animate({Display: 'block', opacity: 'show'}, 'slow' ); 
	$('#cc_'+storyid).html(data);
	$('#cc_'+storyid).animate({Display: 'none', opacity: 'hide'}, 'slow' ); 
 	$('div.story_desc').animate({opacity: 0.9});
	});
}



function closeReportthis(sid){
//var share1 = document.getElementById('delete_'+id);
 $('#delete_'+sid).slideUp("fast");
 $('div.story_desc').animate({opacity: 0.9});

}


function FollowFunction(id)
{ 

var sid="cc_"+id;
var pid="bb_"+id;
var pheight = $('#'+sid).height();
var pwidth = $('#'+sid).width()+200;

var twidth = $('#'+sid).width();
var ptop= parseInt(pheight);
var pleft= parseInt((pwidth-twidth)/2);
$('#'+pid).animate({opacity: 'show'});
$('#'+pid).css({top:ptop+"px"});
$('#'+pid).css({left:pleft+"px"});
$('#'+sid).animate({opacity: 0.1});	
//document.getElementById("pid").innerHTML='fffffffffffffffffffffffffffff';
}
function deleteFollow(imgid)
{ 

	var pid="bb_"+imgid;
	var sid="cc_"+imgid;

	$('#'+pid).slideUp('slow');
    $('#'+sid).animate({opacity: 0.7});	
}



function quickLink(id)
{ 
var sid="cc_"+id;
var pid="bb_"+id;
var pheight = $('#'+sid).height();
var pwidth = $('#'+sid).width();

var twidth = $('#'+sid).width();
var ptop= parseInt(pheight);
var pleft= parseInt((pwidth-twidth)/2);
$('#'+pid).animate({opacity: 'show'});
$('#'+pid).css({top:ptop+"px"});
$('#'+pid).css({left:pleft+"px"});
$('#'+sid).animate({opacity: 0.1});	
}
function deleteLink(imgid)
{ 

	var pid="bb_"+imgid;
	var sid="cc_"+imgid;

	$('#'+pid).slideUp('slow');
    $('#'+sid).animate({opacity: 0.7});	
}



function stroy(id)
{ 
var nid="cc_"+id;
var mid="bbb_"+id;
var pheight = $('#'+nid).height();

var pwidth = $('#'+nid).width();

var twidth = $('#'+nid).width();
var ptop= parseInt(500);
var pleft= parseInt((pwidth-twidth)/2);

$('#'+mid).animate({opacity: 'show'});
$('#'+mid).css({top:ptop+"px"});
$('#'+mid).css({right:pleft+"px"});
$('#'+nid).animate({opacity: 0.1});	
}
function deleteStory(imgid)
{ 

	var mid="bbb_"+imgid;
	var nid="cc_"+imgid;

	$('#'+mid).slideUp('slow');
    $('#'+nid).animate({opacity: 0.7});	
}

function aa()
{
document.getElementById('aa').style.display="none";
document.getElementById('aaa').style.display="block";
}

function activethisStory(id)
{ 
var data2="dd_"+id;
var sid="cc_"+id;
$.get("includes/ajaxFunctions.php","action=active_story&storyId=" + id ,function(data){

 $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
	$('#'+sid).fadeOut(4500).html(data);
	$('#'+data2).animate({Display: 'none', opacity: 'show'}, 'slow' ); 
	});

}

function deactivethisStory(id)
{ 
	var sid="cc_"+id;
	var data2="dd_"+id;

$.get("includes/ajaxFunctions.php","action=deactive_story&storyId=" + id ,function(data){

	 $('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
	$('#'+sid).fadeOut(4500).html(data);
	$('#'+data2).animate({Display: 'none', opacity: 'show'}, 'slow' ); 
	//$('span#dd_'+id).animate({Display: 'none', opacity: 'show'}, 'slow' );
	});

}

function ajaxGroupJoinFunction(id)
{ 
$.get('includes/ajaxFunctions.php', {'action': 'group_join','id': id}, function(data) { 

$('#delete_'+id).html(data);
$('#delete_'+id).slideUp("slow");

});
}
/////////////////////////////////////EVENT INVITAION///////////////////////////////

function ajaxEventInvitaionFunction(id){
	
		var eventInvitationId="eventInvitationId"+id;
		var eventTitle="eventTitle"+id;
		var friendEmail="friendEmail"+id;
		var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
////////////////////////////////// Share story : start///////////////////////////////
	ajaxRequest.onreadystatechange = function(){ 	
		if(ajaxRequest.readyState == 4){ 
		var sid="mm_"+id;
			var ajaxDisplay = document.getElementById(sid);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			var event1 = document.getElementById("event_"+id);
		if(ajaxRequest.responseText=='You have not entered invitation\'s email.' || ajaxRequest.responseText=='You have not entered friend\'s email.' || ajaxRequest.responseText=='Your email is invalid.')
			{
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			
			}
			else
			{
            $(event1).animate({ height: 'hide'}, 'fast');
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
		}
	}
	
  var eventInvite = document.getElementById('eventInvitationId').value;
  var friendEmail = document.getElementById(friendEmail).value;
 // var registermemberid = document.getElementById('registermemberid').value;
  var queryString = "?action=event&eventInvitationId=" + eventInvite +"&friendEmail=" + friendEmail;
	ajaxRequest.open("GET", "includes/ajaxFunctions.php" + queryString, true);
	ajaxRequest.send(null); 
}
function ajaxEventInvitaionRegFunction(id){
		var eventInvitationId="eventInvitationId"+id;
		var eventTitle="eventTitle"+id;
		var friendEmail="friendEmail"+id;
	    var ajaxRequest;  // The variable that makes Ajax possible!
		try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
////////////////////////////////// Share story : start///////////////////////////////
	ajaxRequest.onreadystatechange = function(){ 	

		if(ajaxRequest.readyState == 4){ 
		var sid="mm_"+id;
			var ajaxDisplay = document.getElementById(sid);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			var eventreg = document.getElementById("event1_"+id);
			
	if(ajaxRequest.responseText=='You have not entered invitation\'s email.' || ajaxRequest.responseText=='You have not entered friend\'s email.' || ajaxRequest.responseText=='Your email is invalid.')
			{
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			else
			{
            $(eventreg).animate({ height: 'hide'}, 'fast');
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			
		}
	}
	
    var eventInvite = document.getElementById('eventInvitationRegId').value;
    var registermemberid = document.getElementById('registermemberid').value;
	var queryString = "?action=event1&eventInvitationId=" + eventInvite +"&registermemberid=" + registermemberid;
	ajaxRequest.open("GET", "includes/ajaxFunctions.php" + queryString, true);
	ajaxRequest.send(null); 
}


function ajaxEventAddtoMeFunction(id){
		var eventInvitationId="eventInvitationId"+id;
		var eventTitle="eventTitle"+id;
		var friendEmail="friendEmail"+id;
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
////////////////////////////////// Share story : start///////////////////////////////
	ajaxRequest.onreadystatechange = function(){ 	

		if(ajaxRequest.readyState == 4){ 
		var sid="add_"+id;
			var ajaxDisplay = document.getElementById(sid);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			var addtome = document.getElementById("add_"+id);
			
	if(ajaxRequest.responseText=='You have not entered friend\'s name.' || ajaxRequest.responseText=='You have not entered friend\'s email.' || ajaxRequest.responseText=='Your email is invalid.')
			{
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			else
			{
            $(addtome).animate({ height: 'hide'}, 'fast');
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			
		}
	}
	
   var eventInvite = document.getElementById('eventInvitationAddtomeId').value;
   var friendEmail = document.getElementById(friendEmail).value;
	var queryString = "?action=Addtome&eventInvitationId=" + eventInvite;
	ajaxRequest.open("GET", "includes/ajaxFunctions.php" + queryString, true);
	ajaxRequest.send(null); 
}

/*    */
function confirmMember(id)
{

$.post('includes/addMemberRequest.php', {'evidc': id}, function(data) {
($('#xyz').html(data));
$('#xyz'+id).animate({ height: 'hide'}, 'slow1');
$('#xyz').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
	
}


function rejectMember(id) 
{
$.post('includes/addMemberRequest.php', {'evidr': id}, function(data) {
($('#xyz').html(data));
$('#xyz'+id).animate({ height: 'hide'}, 'slow1');
$('#xyz').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
	
}


function ajaxEventCancelFunction(id) 
{
$.post('includes/cancelEvent.php', {'evidc': id}, function(data) {
($('#xyz').html(data));
$('#xyz'+id).animate({ height: 'hide'}, 'slow1');
$('#xyz').animate({Display: 'block', opacity: 'show'}, 'slow' );
//$('#show').fadeOut(4500).html(data);
});
	return false;
	
}

//////////////////////////////////invitation for friends/////////////////////////////////////////

function ajaxEventInvitaionFunctionForFriends(id){
		var eventInvitationId="eventInvitationId"+id;
		//alert(eventInvitationId);
		var eventTitle="eventTitle"+id;
		//var friendName="friendName"+id;
		var friendEmail="friendEmail"+id;
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{ 
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
////////////////////////////////// Share story : start///////////////////////////////
	ajaxRequest.onreadystatechange = function(){ 	

		if(ajaxRequest.readyState == 4){ 
		var sid="mm_"+id;
			var ajaxDisplay = document.getElementById(sid);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			var eventfrid = document.getElementById("event2_"+id);
			if(ajaxRequest.responseText=='You have not entered friend\'s name.' || ajaxRequest.responseText=='You have not entered invitation\'s email.' || ajaxRequest.responseText=='Your email is invalid.')
			{
			
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			else
			{
            $(eventfrid).animate({ height: 'hide'}, 'fast');
			$('#'+sid).animate({Display: 'block', opacity: 'show'}, 'slow' );
			$('#'+sid).fadeOut(4500).html(ajaxRequest.responseText);
			}
			
		}
	}
	
 var eventInvite = document.getElementById('eventInvitationFriendId').value;
   var friendInvitationId = document.getElementById('fidddd').value;
	var queryString = "?action=inviteFriends&eventInvitationId=" + eventInvite +"&friendInvitationId=" + friendInvitationId;
	ajaxRequest.open("GET", "includes/ajaxFunctions.php" + queryString, true);
	ajaxRequest.send(null); 
}



/*    */

////////////////////////////////AJAX CODE FOR DEFAULT PAGE////////////////////////


var xmlHttp

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

function showpage(str)
{
	xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="includes/ajaxFunctionsDefault.php";
url=url+"?qry="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
var ajax_response
	ajax_response = xmlHttp.responseText
var split_response=ajax_response.split("##");
document.getElementById("pagediv1").innerHTML=split_response[0];
document.getElementById("pagediv2").innerHTML=split_response[1];
document.getElementById("pagediv3").innerHTML=split_response[2];
document.getElementById("pagediv4").innerHTML=split_response[3];
document.getElementById("pagediv5").innerHTML=split_response[4];
}
}



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