function formsinit(){
	// $( '.element input[type="text"], .element textarea, .element input[type="password"]' ).validate({ 'process_numbers' : true, 'lengthlimit' : { 'enable' : true } });
	var url_domain = 'http://www.philippinepropertyfinder.com/';

	if( $( '#submit' ).length > 0 ){
		$( '#submit' ).validate_form( { 'callback' : true, 'callback_function' : function( options ){
				var $this = $( this );
				$this.attr( { 'disabled' : true, 'value' : 'Sending..' } );
				$.post( options.url, options.elements, function(data){
					$this.attr( { 'disabled' : false, 'value' : 'Sign Up' } );
					if( data.response ){
						$( '#signup-form .element input, #signup-form .element textarea' ).each(function(){
							$( this ).val( '' );
						});
						alert( data.message );
						window.location = window.location.toString();
					} else{
						alert( data.message );
					}
				}, "json" );
			}, 'ajax' : true, 'url' : url_domain + 'ajaxcalls/ajaxuser.inc.php?action=add', 'data_containers' : '#signup-form .element', 'imgs' : '#signup-form .validate img'
		}).attr( 'disabled', false );
	}

	if( $( '#submit-login' ).length > 0 ){
		$( '#submit-login' ).validate_form( { 'callback' : true, callback_function : function( options ){
				var $this = $( this );
				$this.attr( { 'disabled' : true, 'value' : 'Logging In..' } );
				$.post( options.url, options.elements, function( data ){
					$this.attr( { 'disabled' : false, 'value' : 'Login' } );
					if( data.response ){
						$( '#submit-login .element input' ).each(function(){
							$( this ).val( '' );
						});
						alert( data.message );
						window.location = data.redirect_page;
					} else{
						alert( data.message );
					}
				}, "json" );
			}, 'ajax' : true, 'url' : url_domain + 'ajaxcalls/ajaxuser.inc.php?action=login', 'data_containers' : '#login-form .element', 'imgs' : '#login-form .validate img'
		});
	}
	
	if( $( '#submit-forgot-element' ).length > 0 ){
		$( '#submit-forgot-element' ).validate_form({
			callback : true,
			callback_function : function( options ){
				var $this = $( this );
				$this.attr({
					'disabled' : true,
					'value' : 'Sending Request...'
				});
				$.post( options.url, options.elements, function( data ){
					alert( data.message );
					if( data.response ){
						window.location = window.location.toString();
					}
				}, "json" );
			},
			ajax : true,
			url : url_domain + 'ajaxcalls/ajaxuser.inc.php?action=forgot',
			data_containers : '#forgot-form .element',
			imgs : '#forgot-form .validate img'
		});
	}
	
	if( $( '#submit-search' ).length > 0 ){
		var search_button = $( '#submit-search' );
		search_button.validate_form( { callback : true, callback_function : function( options ){
			window.location = ( $( '#search-advanced-search' ).css( 'display' ) == 'none' ) ? url_domain +escape( $( '#search-input' ).val() ) + '/s/1' : url_domain + escape( $( '#search-input' ).val() ) + '/s/1/' + escape( $( '#search-input-min' ).val() ) + '/' + escape( $( '#search-input-max' ).val() ) + '/' + escape( $( '#search-input-select' ).val() ) + '/' + escape( $( '#search-input-select-order' ).val() );
		}, ajax : true, 'url' : 'search.php?s=', data_containers : '#search-form .element, #search-advanced-search .element, #search-form-index .element', imgs : '#search-form .validate img, #search-form-index .validate img' } );
	}
}

