var HOME = (function() 
{
    function init()
    {
		$$("ul .cooltip").each( function(link) 
		{
			new Tooltip(link, {opacity: 0.95, maxWidth: 340, backgroundColor: 'Snow', mouseFollow: false});
		});

		FORM.addIContact = function(formID)
		{
			var convert = $H(
			{
				first_name		: 'fields_fname',
				last_name		: 'fields_lname',
				email			: 'fields_email',
				zip				: 'fields_zip'
			});
		
			var result = $H({
				'listid' 			: '20805',
				'specialid:20805' 	: '7ROW',
				'clientid' 			: '231202',
				'formid'			: '2177',
				'reallistid' 		: '1',
				'doubleopt' 		: '0',
				'Submit' 			: 'Submit'		
			});
				
			$H(Form.serializeElements(Form.getElements($(formID)), true)).each(function(element)
			{
				if (typeof(element.value) == 'string')
				{
					if (convert[element.key])
					{
						result[convert[element.key]] = element.value;
					}
				}
				else
				{
					if (convert[element.key])
					{
						element.value.each(function(value)
						{
							result[convert[element.key][value]] = 'on';
						});
					}
				}
			});

    		new Ajax.Request('http://app.icontact.com/icp/signup.php', 
			{
  				method		: 'post',
				parameters	: result
			});
		}

        FORM.activateSubmitButton('img_submit', 'subscribers');
    }

    return {
		init      : init
    }	
})();


Event.observe(window, 'load', HOME.init);