jQuery(function(){
	//jQuery('#div_modal_window')
	jQuery('.close','#div_modal_window').click(function (){
		jQuery('#div_modal_window').hide(500);
	});
	
	Submit = function (){
		jQuery('#div_modal_window').hide(500);
		jQuery('#fmLogin').submit();
	}
	
	SubmitNewAccount = function(){
		jQuery('#radio_create').attr('checked','checked');
		jQuery('#div_modal_window').hide(500);
		jQuery('#fmLogin').submit();
	}
	
	SubmitForgotPassword = function (){
		jQuery('#div_modal_window').hide(500);
		jQuery('#btn_forgot_password','#fmLogin').click();
	}
	
	jQuery('#btn_forgot_password','#fmLogin').click(function(){
		
		var params = jQuery('#fmLogin').serializeArray();
		for(key in params){
			if (params[key].name=='do'){
				params[key].value = 'forgot_password';
			}
		}
		var options = {
			show_inline_loader_for:'#btn_submit',
			callAfterSuccess:function(data){
				jQuery('#btn_submit').html('<input type="submit"  class="continue" value="" style="border:none; cursor:pointer;  margin-top:-6px;">');
			},
			callAfterFailed:function(data){
				jQuery('#btn_submit').html('<input type="submit"  class="continue" value="" style="border:none; cursor:pointer;  margin-top:-6px;">');
			}
		}
		
		jQuery('#fmLogin').trigger('submit',[params,options]);
		return false;
	});
	
	jQuery('#fmLogin').submit(function(event,params,options){
		if (typeof options == 'undefined'){
			var options = {
				show_inline_loader_for:'#btn_submit',
				callAfterSuccess:function(data){
					jQuery('#btn_submit').html('<span style="float:right">Redirecting...</span>');
				},
				callAfterFailed:function(data){
					jQuery('#btn_submit').html('<input type="submit"  class="continue" value="" style="border:none; cursor:pointer;  margin-top:-6px;">');
				}
			}
		}
		return Goingup.Form.Submit(this,params,options);	
	});
	
	
});
