function interactive_action(trigger, modalWindow,urlForm) { 
$.jqm.params = { modal:false, overlay: 20, onHide: function(h) { h.w.remove(); h.o.remove(); } };
var self = this; 
self.trigger = (trigger) ? trigger : ".wizard-signup";
self.modal = (modalWindow) ? $(modalWindow) : $("<div class='jqmWrap'><div class='jqmWindow'></div></div>"); 
self.urlForm = urlForm;
self.htmlForm = null;
this.bind = function() {
	$.ajax({ 
		url: self.urlForm, 
		success: function(response){ 
			  self.htmlForm = response;
			  self.init(response);
		} 
	});
	$(self.trigger).live('click', function() {
		self.modal.appendTo('body').jqm(null);
		$(".jqmWindow", self.modal).html(self.htmlForm);
		var wWidth = $(window).width();
		var wHeight = $(window).height();
		var pWidth = self.modal.width();
		var pHeight = self.modal.height();
		var pCount = $(".jqmWrap").length;
		var layer = parseInt(self.modal.css('z-index'));		
		self.modal.css({
			"top": 200,
			"left": wWidth / 2 - pWidth / 2 + pCount * 10,
			"z-index": layer + pCount * 10,
			"block":"block"	
		});		
		self.modal.jqmShow();
	});
} 
this.init = function(response) {
	if (response) {
		var urlFormReg = $(response).find('form').attr('action');
		var FormMethodReg = $(response).find('form').attr('method');
		var FormSubmit = $(response).find('input[type=submit]').attr('class');
		if (urlFormReg && FormMethodReg && FormSubmit) {
			$('form .'+FormSubmit).live('click', function() {
				$.ajax({ 
					data: $(".jqmWindow", self.modal).find('form').serializeArray(),
					type: FormMethodReg,
					url: urlFormReg, 
					success: function(json) {
						if (typeof json !== 'object') {
							json = jQuery.parseJSON(json);
						}
						if (json.response && json.response['@'].status == 'success') {
							$(".jqmWindow", self.modal).find('div.errors').hide();
							$(".jqmWindow", self.modal).find('.success').css('margin-bottom','10px').css('color','#3674B9').show();
							if (typeof json.response.register !== 'undefined') {
								$(".jqmWindow", self.modal).find('.success').text('Регистрация прошла успешно!');
							} else {
								$(".jqmWindow", self.modal).find('.success').text('На ваш емайл было отправлено письмо с новым паролем!');
							}
						} else {
							$(".jqmWindow", self.modal).find('.success').hide();
							if(typeof json.response.register !== 'undefined') {
								$(".jqmWindow", self.modal).find('div.errors').html('');
								for(var name in json.response.register.errors) {
									//$(".jqmWindow", self.modal).find('label[for='+name+'] em').text('<span style="color:red">' + json.response.register.errors[name] + '</span>');
									$(".jqmWindow", self.modal).find('div.errors').append("<li>" + json.response.register.errors[name] + "</li>").show();
								}					
							} else if (typeof json.response['@'].error !== 'undefined') {
								$(".jqmWindow", self.modal).find('div.errors').html("<li>" + json.response['@'].error + "</li>").show();
							} else {
								$(".jqmWindow", self.modal).find('div.errors').html("<li>" + json.response['@'].error + "</li>").show();
							}
						}
					},
					error: function(xhr, error) {
						$(".jqmWindow", self.modal).find('div.errors').html("<li>" + error + "</li>").show();
					}					
				});	
			});		
		} else {
			alert('Ошибка чтения данных повторите чуть позже!');
		}
	} else {
		alert('Приносим наши извинения но произошла ошибка!');
	}
 
}

self.bind();
}

