jQuery(function ($) {
	var OSX = {
		container: null,
		init: function () {
			$("input.osx, a.osx").click(function (e) {
				e.preventDefault();

				$("#contato").modal({
					overlayId: 'overlay',
					containerId: 'container',
					closeHTML: null,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX.open,
					onClose: OSX.close
				});
			});
		},
		open: function (d) {
		    $('#nome').val("");
            $('#email').val("");
            $('#assunto').val("");
            $('#mensagem').val("");
            $('#empresa').val("");
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#contato", self.container).show('fast', function (){
    				d.container.slideDown('200', function () {
    					setTimeout(function () {
    						var h = $("#container", self.container).height()
    						d.container.animate({
    						},200,function () {
    								$("div.close", self.container).fadeIn('fast');
    								$("#form", self.container).fadeIn('fast');
							    }
						    );
					    });
				    });
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 50)}, 300,function(){}
			);
			d.overlay.delay(300).fadeOut('200', function() {
			    self.close();
			});
		}
	};

	OSX.init();

});


