/* ****************************** GENERIC FUNCTIONS ******************************** */

_contains = function( arr, val ){
	for(var x in arr ){
		if( arr[x] == val ) return true;
	}
	return false;
}

/* ****************************** GENERIC FUNCTIONS ******************************** */

_resizeStore = function(){
	var $store				= $('#onlineStore'),
		bodyHeight			= $('body').height(),
		headerHeight		= $('#header').outerHeight(true),
		footerHeight		= $('#footer').outerHeight(true),
		storeFooterHeight	= $('#storeFooter').outerHeight(true);
		
	var storeHeight			= $('#footer:visible').size() ? bodyHeight - headerHeight - footerHeight : bodyHeight - headerHeight - storeFooterHeight;
	
	$store.height(storeHeight);
}

/* ****************************** STRING FUNCTIONS ********************************* */

// Uppercases first letters of a string //
_UCWords = function(str){
	var text = '';
	if(str){
	
		if(str.indexOf(' ') != -1){
			var arr = str.split(" ");
		} else {
			var arr = new Array(str);
		}
		
		var y =0;
		for (var x in arr){
			str = arr[x];
			var firstChar = str.substr(0, 1).toUpperCase();
			var restChar = str.substr(1);
			if(arr.length > 0 && y > 0){
				text += ' ';
			}
			text += (firstChar + restChar);
			y++;
		}
		return text;
	}
}

// Gets a date or current date and returns array of different options (so far digital time) //
_date = function(date) {

	if(date){
		date = date * 1000;
		date = new Date(date);
	} else {
		var date = new Date();
	}
	  
	var arr = [];
	
	// For digital time //
	var hours = date.getHours();
	var mins = date.getMinutes();
	var secs = date.getSeconds();
	
	var indicator = '';
	
	if(mins <= 9){
		mins = '0' + mins;
	}
	
	if(secs <= 9){
		secs = '0' + secs;
	}
	
	if(hours >= 12){
		indicator = ' pm';
		} else {
		indicator = ' am';
	}
	
	arr['time'] = hours + ':' + mins + indicator;
	
	// For date //
	arr['date'] = '';
	
	return arr;
  
}
