var actionurl = '?action=admin;area=smileys;sa=install;set_gz=';
if (typeof(window.smfForum_sessionvar) == "undefined")
	window.smfForum_sessionvar = 'sesc';

var smf_smileysInfo = {

	4099: {
		name: 'EmojiOne 0.3.2',
		versions: ['84'],
		desc: 'EmojiOne is not BBC but functions in the same space as BBC.<br /><br />This mod add some support for converting emoji decimal input into their hexadecimal counterpart. With the hexadecimal data this mod replaces the decimal data with the appropriate emoji from the EmojiOne CDN server.<br /><br /><strong>License</strong><br />Copyright (c) 2016, Russell Najar<br />All rights reserved.<br /><br />Redistribution and use in source and binary forms, with or without<br />modification, are permitted provided that the following conditions are met:<br /><br />* Redistributions of source code must retain the above copyright notice, this<br />&nbsp; list of conditions and the following disclaimer.<br /><br />* Redistributions in binary form must reproduce the above copyright notice,<br />&nbsp; this list of conditions and the following disclaimer in the documentation<br />&nbsp; and/or other materials provided with the distribution.<br /><br />THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;<br />AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br />IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE<br />FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL<br />DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR<br />SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER<br />CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,<br />OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE<br />OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.',
		file: 'SMF-EmojiOne.tar.gz'
	},
	4049: {
		name: 'Flat emoji (Twitter Emoji) 1.0.1',
		versions: ['81', '82'],
		desc: '<div align="center"><strong>Flat Emoji</strong><br /><hr /><img src="https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg.iammichael.nl%2Fd26d3.png&hash=018e0f573d2709203d189f0064bf7ac9" alt="" class="bbc_img" /><br /><hr /><br />These flat twitter emoji will make your forum look much better, especially when you like flat design!<br />Originally made for NMOT (<a href="http://nmot.nl" class="bbc_link" target="_blank">http://nmot.nl</a>).</div>',
		file: 'FlatEmoji.zip'
	},
	4045: {
		name: 'sdgirlsmilies 1.0',
		versions: ['81', '82'],
		desc: 'Set of over-sized smilies of a girls face with the default SMF emotions<br /><br />NOTE: These will also work with SMF 2.1 B1<br /><br /><img src="https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi133.photobucket.com%2Falbums%2Fq72%2FGrumpy_075%2Fsmfsmilies%2Fsdgirldemo.jpg&hash=8761b37ffdd21514615ec2e1e06f4e69" alt="" class="bbc_img" />',
		file: 'sdgirlsmilies.zip'
	},
	4044: {
		name: 'sdboysmilies 1.0',
		versions: ['81', '82'],
		desc: 'Set of over-sized smilies of a boys face with the default SMF emotions<br /><br />NOTE: These will also work with SMF 2.1 B1<br /><br /><img src="https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi133.photobucket.com%2Falbums%2Fq72%2FGrumpy_075%2Fsmfsmilies%2Fsdboydemo.jpg&hash=96b491c3b4e34778a295e7a01da0bccc" alt="" class="bbc_img" />',
		file: 'sdboysmilies.zip'
	},};
var smf_latestSmileys = [4099, 4049, 4045];

function smf_packagesMoreInfo(id)
{
	window.smfLatestSmileys_temp = document.getElementById("smfLatestSmileysWindow").innerHTML;

	setInnerHTML(document.getElementById("smfLatestSmileysWindow"),
	'\
		<h3 style="margin: 0; padding: 4px;">' + smf_smileysInfo[id].name + '</h3>\
		<h4 style="padding: 4px; margin: 0;"><a href="' + window.smfForum_scripturl + actionurl + 'http://custom.simplemachines.org/mods/downloads/' + id + '/' + smf_smileysInfo[id].file + ';' + window.smfForum_sessionvar + '=' + window.smfForum_sessionid + '">Install Now!</a></h4>\
		<div style="margin: 4px;">' + smf_smileysInfo[id].desc.replace(/<a href/g, '<a href') + '</div>\
		<div class="titlebg" style="padding: 4px; margin: 0;"><a href="javascript:smf_packagesBack();void(0);">(go back)</a></div>');
}

function smf_packagesBack()
{
	setInnerHTML(document.getElementById("smfLatestSmileysWindow"), window.smfLatestSmileys_temp);
	window.scrollTo(0, findTop(document.getElementById("smfLatestSmileysWindow")) - 10);
}

window.smfLatestSmileys = '\
	<div id="smfLatestSmileysWindow" style="overflow: auto;">\
		<img src="https://www.simplemachines.org/smf/images/smileys.png" width="102" height="98" style="float: right; margin: 4px;" alt="(package)" />\
		<h3 style="margin: 0; padding: 4px;">Smiley of the Moment:</h3>\
		<div style="padding: 0 4px;">\
			<a href="javascript:smf_packagesMoreInfo(4044);void(0);">sdboysmilies 1.0</a>\
		</div>';

window.smfLatestSmileys += '\
		<h3 style="margin: 0; padding: 4px;">New Smileys:</h3>\
		<ul style="list-style: none; margin-top: 3px; padding: 0 4px;">';

for (var i = 0; i < smf_latestSmileys.length; i++)
{
	var id_mod = smf_latestSmileys[i];

	window.smfLatestSmileys += '<li><a href="javascript:smf_packagesMoreInfo(' + id_mod + ');void(0);">' + smf_smileysInfo[id_mod].name + '</a></li>';
}

window.smfLatestSmileys += '\
		</ul>';

window.smfLatestSmileys += '\
	</div>';

function findTop(el)
{
	if (typeof(el.tagName) == "undefined")
		return 0;

	var skipMe = in_array(el.tagName.toLowerCase(), el.parentNode ? ["tr", "tbody", "form"] : []);
	var coordsParent = el.parentNode ? "parentNode" : "offsetParent";

	if (el[coordsParent] == null || typeof(el[coordsParent].offsetTop) == "undefined")
		return skipMe ? 0 : el.offsetTop;
	else
		return (skipMe ? 0 : el.offsetTop) + findTop(el[coordsParent]);
}

function in_array(item, array)
{
	for (var i in array)
	{
		if (array[i] == item)
			return true;
	}

	return false;
}