/*######################################
## script copyright fusio.net         ##
## developed for efriends.ie	      ##
## by remi [at] fusio<.>net           ##
######################################*/

function ShowMe(ThisLayer) 
{ 
	// expand or contract
	if (document.getElementById(ThisLayer))
	{
		document.getElementById(ThisLayer).style.display = 'block';
	}
}
function HideMe(ThisLayer)
{
	if (document.getElementById(ThisLayer))
	{
	document.getElementById(ThisLayer).style.display = 'none';
	}
	//RefreshiMenu();
	return;
}


/*#############################
#### PostNewMsgID (MsgID) ####
#############################*/
function PostNewMsgID(MsgID)
{
	http_request = false;

	/*####################
	##    Post results  ##
	####################*/

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/xml');
        }
	} 
	else if (window.ActiveXObject) 
	{
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
				{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e) {}
		}
	}

	if (!http_request)
	{
	// alert('Giving up -- Cannot create an XMLHTTP instance');
	return false;
	}
	http_request.open('GET', '/messages/save_warning_msge.asp?MsgID='+MsgID);
	http_request.send(null);

}



/*#############################
####   AddToFav (UserID)   ####
#############################*/

function AddToFav(FavUserID,act,imgID)
{
	http_request = false;

	/*####################
	##    Post results  ##
	####################*/

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/xml');
        }
	} 
	else if (window.ActiveXObject) 
	{
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
				{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e) {}
		}
	}

	if (!http_request)
	{
	// alert('Giving up -- Cannot create an XMLHTTP instance');
	return false;
	}
	// http_request.onreadystatechange = alertContents;
	//prompt('','/members/manage_favourites.asp?FavUserID='+FavUserID+'&act='+act+'&httprequest=1')
	http_request.open('GET', '/members/manage_favourites.asp?FavUserID='+FavUserID+'&act='+act+'&httprequest=1');
	http_request.send(null);
	
	//change image add to fav
	if (!imgID || !isNaN(imgID)) 
	{
	imgID == 1
	//alert(imgID)
	}

	var ThisimgState = document.getElementById('addtofav'+imgID).src.indexOf("add_fav");
	//alert(ThisimgState)

	if (ThisimgState > 0)
	{
		document.getElementById('addtofav'+imgID).src = '/images/snippet_remove_from_fav.gif';
	}
	else
	{
		document.getElementById('addtofav'+imgID).src = '/images/snippet_add_fav.gif';
	}
	
	return true;
}

/*#############################
####   AddToBook (UserID)   ####
#############################*/

function AddToBook(RecipientID,act,imgID)
{

	http_request = false;

	/*####################
	##    Post results  ##
	####################*/

	if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/xml');
        }
	} 
	else if (window.ActiveXObject) 
	{
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try 
				{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
                }
				catch (e) {}
		}
	}

	if (!http_request)
	{
	// alert('Giving up -- Cannot create an XMLHTTP instance');
	return false;
	}
	// http_request.onreadystatechange = alertContents;
	http_request.open('GET', '/messages/addressbook/manage_book.asp?RecipientID='+RecipientID+'&act='+act+'&httprequest=1');
	http_request.send(null);
	

	var ThisimgState = document.getElementById('addtobook'+imgID).src.indexOf("snippet_add_to_book");
	//alert(ThisimgState)

	if (ThisimgState > 0)
	{
		document.getElementById('addtobook'+imgID).src = '/images/snippet_remove_from_book.gif';
	}
	else
	{
		document.getElementById('addtobook'+imgID).src = '/images/snippet_add_to_book.gif';
	}
	
	return true;
}

/*#######################################
####   launch instant communicator   ####
######################################*/
function launchIC( memberID, destinationMemberID )
	{
		window.open( "/icxml/ic.asp?strDestinationMemberID=" + destinationMemberID, "MBF_ICWindow", "width=360,height=420,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0" );
	}

/*#######################################
####   launch console                ####
#######################################*/
function OpenConsole() 
	{
	var FromTop = self.screenTop + 10 ;
	var FromLeft = self.screenLeft + 10 ;
	window.open("/console/default.asp","console","menubar=no,left="+FromLeft+",top="+FromTop+",width=225,height=205,screenX=10,screenY=10,status=0,menubar=0,toolbar=0,location=0,directories=0")
	}