//extend the plugin
(function($){

	//define the new for the plugin ans how to call it	
	$.fn.contactable = function(options) {
		var defaults = {};

		//call in the default otions
		var options = $.extend(defaults, options);
		//act upon the element that is passed into the design    
		return this.each(function(options) {
			//construct the form
			$(this).html('<div id="contactable"></div><form id="contactForm"><p class="testo" style="color=white">IL TEMPO ALL\'ABETONE<br><iframe vspace="0" height="450" marginHeight="0" frameBorder="0" width="330" marginWidth="0" scrolling="no" hspace="0" src="/meteo_inclusione.asp" name="I1"></iframe><p class="testo">Il servizio è offerto da <a href="http://www.meteotoscana.com" rel="nofollow" target="_blank">www.meteotoscana.com</a></p></form>');
			//show / hide function
			$('div#contactable').toggle(function() {
				$('#overlay').css({display: 'block'});
				$(this).animate({"marginLeft": "-=5px"}, "fast"); 
				$('#contactForm').animate({"marginLeft": "-=0px"}, "fast");
				$(this).animate({"marginLeft": "+=390px"}, "slow"); 
				$('#contactForm').animate({"marginLeft": "+=390px"}, "slow"); 
			}, 
			function() {
				$('#contactForm').animate({"marginLeft": "-=390px"}, "slow");
				$(this).animate({"marginLeft": "-=390px"}, "slow").animate({"marginLeft": "+=5px"}, "fast"); 
				$('#overlay').css({display: 'none'});
			});
			

		});
	};
})(jQuery);

