text: 	/**
  	 * Make seo friendly url replace #3 from page=3
  	 */
  	$(window).on('hashchange', function () {
  		if (window.location.hash) {
  			var page = window.location.hash.replace('#', '');
  			if (page == Number.NaN || page <= 0) {
  				return false;
  			} else {
  				//getRestaurants(page);
  			}
  		}
  	});
  
  	/**
  	 * Gritter notifications when user does something
  	 *
  	 * E.g. alertGritter('Restaurants', 'Request for listing restaurants failed', 'growl-error');
  	 *
  	 * @param title = title of the popup
  	 * @param content = content inside popup
  	 * @param status = 'growl-error', 'growl-success', 'growl-warning' etc.
  	 */
  	/*function alertGritter(title, content, status) {
  		$.gritter.add({
  			title: title,
  			text: content,
  			class_name: status,
  			sticky: false,
  			time: ''
  		});
  	}*/
  	
  	/**
  	 * On click on next or previous button get the next page href and by splitting it get only page number to pass in ajax
  	 */
  	$(document).ready(function () {
  		$(document).on('click', '#pagination li a', function (e) { 
  			e.preventDefault();
  			getRecords($(this).attr('href').split('page=')[1]);
  			
  		});
  	
  	});
  	
  	/**
  	 * Ajax call for pagination
  	 * Para : page (as page number)
  	 * Para : view name to display on template
  	 */
  	function getRecords(page) {
  		
  		var search_str = document.getElementById("search_str").value;
  		var search_by = document.getElementById("search_by").value;
  		var status = document.getElementById('crm_account_type_status').value;
  
  		
  		$.ajax({
  			// Add page number and title in current url make call for next or previous page and page title
  		   // url: '?page=' + page + '&title=' + title + '&from_date=' + from_date + '&to_date=' + to_date + '&status=' + status + '&search_str=' + search_str + '&test_order=' + test_order + '&search_by=' + search_by,
  			url: '?page='+page+'&search_str='+search_str+'&search_by='+search_by+'&crm_account_type_status='+status,
  			dataType: 'json'
  		}).then(function (data) {
  			// On success pass the respone to view
  			$('.crm_account_typeListing').html(data);
  			location.hash = page;
  		}).fail(function () {
  		   // alertGritter('Restaurants', 'Request for restaurants list could not be loaded', 'growl-error');
  		});
  	}
  
  	// Update Investment Sub List Using Ajax
  	function change_status(id) {
  		if($(".crm_account_type_table #status"+id).hasClass('btn-success')){
  			var new_status = 0;	
  		}else{
  			var new_status = 1;
  		}
  		if (confirm('Are you sure you want to change Status?')) {
  		   $.ajax({
  			   method: 'PUT',
  			   url: 'crmaccount-type/mode',
  			   headers: {
  				   'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  			   },
  			   data: {
  				   id: id,
  				   status: new_status,
  				   _token: $('#_token').val()
  			   }
  		   }).then(function (data) {
  				if(new_status==0){
  					$(".crm_account_type_table td #status"+id).text('Inactive');
  					$(".crm_account_type_table td #status"+id).removeClass("btn-success");
  					$(".crm_account_type_table td #status"+id).addClass("btn-warning");
  				}else{
  					$(".crm_account_type_table td #status"+id).text('Active');
  					$(".crm_account_type_table td #status"+id).removeClass("btn-warning");
  					$(".crm_account_type_table td #status"+id).addClass("btn-success");
  				}
  				alertGritter('Update Status', 'Request Updating Status success', 'growl-success');
  		   }).fail(function (data) {
  			   alertGritter('Update Status', 'Request Updating Status failed', 'growl-error');
  		   });
  	   }
     	}
  	
  	
  	//Using Filters
  	// Serch filters
  	    /**
       * Ajax search for event
       * @constructor
       */
      var crm_account_typeSearch = function () {
  			
          $.ajax({
              type: 'GET',
              url: '',
              data: $('#crm_account_type_filter').serialize()
          }).then(function (data) {
              $('.crm_account_typeListing').html(data);
          }).fail(function (data) {
              alertGritter('Report search', 'Request for searching reports failed', 'growl-error');
          });
      };
  
      //$('#switchStatus').on('switchChange.bootstrapSwitch', ReportSearch);
      $('#crm_account_typeSearch').click(crm_account_typeSearch);
      $('#crm_account_typeSearchBtn').click(crm_account_typeSearch);
   //   $('#ownership_status').change(OwnerSearch);
      
  
  //delete	
  
  	$(document).ready(function () {
      $('.crm_account_typeListing').on('click','.crm_account_typeDelete', function () {
  
             var id = $(this).data('crm_account_type_id');
  		//alert(id);
             var siteurl = $(this).data('url');
  		   //alert(siteurl);
             if (confirm('Are you sure you want to delete this?')) {
                 $.ajax({
                     method: 'DELETE',
                     url: 'crmaccount-type/destroy',
                     headers: {
                         'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                     },
                     data: {//alert(1);
                         id: id,
                         _token: $('#_token').val(),
  					}
                 }).then(function (data) {//alert(data);
                     $('#crm_account_type_tr' + id).fadeOut();
  				   alertGritter('Delete', 'Request deleting success', 'growl-success');
                 }).fail(function (data) {
                      alertGritter('Delete', 'Request deleting failed', 'growl-error');
                 });
             }
      });
  });