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

var smf_smileysInfo = {

	3840: {
		name: 'Android smileys 1.0',
		versions: ['77'],
		desc: 'This is just a simple modification that adds new smileys set to your forum.<br />The icons were made by Google for Android system and are under open-source license.',
		file: 'Android_smileys_1.0.zip'
	},
	3628: {
		name: 'BBPh Smileys 1.0',
		versions: ['72', '73'],
		desc: 'Made to easily replace default ones.<br /><br /><img src="http://dl.dropbox.com/u/1684364/arc/bbph.gif" alt="" class="bbc_img" /><br /><br />These are just my favorites since the first forum I ever lived on was based on phpBB. Some are animated. package-info.xml included.<br /><br />Original smileys belong to phpBB. Some minor mods by me.',
		file: 'bbph.zip'
	},
	3290: {
		name: 'Blue Smiley Animation 2.0',
		versions: ['67', '72', '68', '73'],
		desc: '<div align="center"><span style="font-size: 1.45em;" class="bbc_size"><span style="color: green;" class="bbc_color"><strong>Blue Smiley Animation</strong></span></span></div><div align="center"><a href="http://www.simplemachines.org/community/index.php?topic=464629.0" class="bbc_link" target="_blank">English Support</a> | <a href="http://smf-portal.hu" class="bbc_link" target="_blank">Hungarian Support</a> | <a href="http://custom.simplemachines.org/mods/index.php?action=profile;u=221448" class="bbc_link" target="_blank">My Mods</a></div><hr /><br /><strong>Autor:</strong><br /><a href="http://www.simplemachines.org/community/index.php?action=profile;u=221448" class="bbc_link" target="_blank">WasdMan</a> and Cserrobi<br /><br /><strong>Description (Hungarian):</strong> <br />Kék mosolygó arcok<br /><br /><strong>Description (English):</strong><br />Blue Smiley package<br /><br /><img src="http://smf-portal.hu/Download/Egyeb/keksmiley.png" alt="" width="600" height="237" class="bbc_img resized" /><br /><br /><strong>Compatibility: </strong><br /><ul class="bbc_list"><li>1.0 - 1.99.99</li><li>2.0 - 2.99.99</li></ul>',
		file: 'BlueSmileyAnimation_2.1_UNI.zip'
	},
	3231: {
		name: 'Softs Emoticons v1',
		versions: ['65', '68'],
		desc: '<div align="center"><img src="http://bit.ly/kZVDB6" alt="" width="443" height="115" class="bbc_img resized" /></div><br /><div align="center"><span style="text-shadow: black 1px 1px 1px"><span style="color: purple;" class="bbc_color"><span style="font-size: 16pt;" class="bbc_size"><strong>Softs Emoticons</strong></span></span></span><br /><strong>Developed by</strong> <strong><a href="http://www.smfsimple.com/index.php?action=profile;u=1045" class="bbc_link" target="_blank">Cesar</a></strong> <strong>for </strong><strong><a href="http://www.smfsimple.com" class="bbc_link" target="_blank">SMFSimple.com</a></strong><br /><em><strong>SMF 2.0 - 2.0.1</strong></em></div><br /><hr /><br /><div align="center"><span style="text-shadow: black 1px 1px 1px"><span style="color: orange;" class="bbc_color"><span style="font-size: 14pt;" class="bbc_size"><strong>El soporte oficial de los desarrolladores de nuestros mods lo encontraras en SMFSimple.com<br />Official Support in <a href="http://www.SmfSimple.com" class="bbc_link" target="_blank">www.SmfSimple.com</a></strong></span></span></span></div><br /><hr /><br /><span style="text-shadow: black 1px 1px 1px"><span style="color: orange;" class="bbc_color"><span style="font-size: 13pt;" class="bbc_size"><span class="bbc_u"><strong>Description:</strong></span></span></span></span><br /><em><strong>Emoticons Pack created by <a href="http://super-cwis.deviantart.com/" class="bbc_link" target="_blank">Super-Cewis</a> and packaged by Cesar to SmfSimple.com</strong></em><br /><br /><span style="text-shadow: black 1px 1px 1px"><span style="color: orange;" class="bbc_color"><span style="font-size: 13pt;" class="bbc_size"><span class="bbc_u"><strong>Descripcion:</strong></span></span></span></span><br /><em><strong>Pack de Emoticones creados por <a href="http://super-cwis.deviantart.com/" class="bbc_link" target="_blank">Super-Cewis</a> y empaquetados para SmfSimple.com por Cesar</strong></em><br /><br /><hr /><br /><div align="center"><span style="text-shadow: black 1px 1px 1px"><span style="color: red;" class="bbc_color"><span style="font-size: 13pt;" class="bbc_size"><strong>Screenshots | Imagenes</strong></span></span></span></div><br /><div align="center"><img src="http://i.imgur.com/xs1vH.png" alt="" width="455" height="242" class="bbc_img resized" /></div><br /><br /><br /><hr /><span style="color: teal;" class="bbc_color"><span class="bbc_u"><strong>Language Support | Lenguajes Soportados</strong></span></span><br /><span style="color: teal;" class="bbc_color"><strong>- English<br />- Spanish_latin<br />- Spanish_latin-utf8<br />- Spanish_es<br />- Spanish_es-utf8</strong></span><br /><hr /><br /><div align="center"><span style="text-shadow: black 1px 1px 1px"><span style="color: green;" class="bbc_color"><span style="font-size: 15pt;" class="bbc_size"><strong>Softs Emoticons</strong></span></span></span></div><br /><div align="center"><span style="text-shadow: black 1px 1px 1px"><span style="color: green;" class="bbc_color"><span style="font-size: 13pt;" class="bbc_size"><strong>Copyright 2011 | <a href="http://www.smfsimple.com" class="bbc_link" target="_blank">SMFSimple.com</a></strong></span></span></span></div><br /><div align="center"><a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" class="bbc_link" target="_blank"><img src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="" width="88" height="31" class="bbc_img resized" /></a></div>',
		file: 'softs.zip'
	},};
var smf_latestSmileys = [3840, 3628, 3290];

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="http://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(3231);void(0);">Softs Emoticons v1</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;
}