
/* HELPER functions */

(function() {
	var vars = {};
	
	$.views.helpers({
		/* To convert the Date into Specific format */
		formatDate: function(val,format,convert) {
			return $.formatDate(val,format,convert);
		}
	});
	$.views.tags({
		setvar: function(key, value) {
			if (value) {
				vars[key] = value;
			} else {
				vars[key] = this.tagCtx.render();
			}
			return "";
		}
	});

	$.views.helpers({
		getvar: function(key) {
			return vars[key];
		}
	});
	
	$.views.helpers({
		truncate: function(string, limit,html) {
			if(html)
				var content	= $($.truncate(string,limit)).html();
			else
				var content	= $.truncate(string,limit);
			return $('<div/>').html(content).text();
		},
		
		getFormattedCurrency: function(originalPrice,decimalType,from,to) {
			return $.getFormattedCurrency(originalPrice,decimalType,from,to);
		},
		
		html_entity_decode: function(string) {
			return $.html_entity_decode(string);
		},
		
		
		htmlentities: function(string, quote_style, charset, double_encode) {
			return $.htmlentities(string, quote_style, charset, double_encode);
		},
		
		in_array: function(needle, haystack,type, argStrict) {
			return $.in_array(needle, haystack, argStrict);
		},
		split: function(string,needle) {
			console.log('sdf')
			console.log(string.split(needle));
			return string.split(needle);
		},
		
		print_r: function(data) {
			console.log(data)
		}
	});
})();
