app.service('services', ['$location', '$http', function ($l, $h) {

	var menu = [
		{
			'title':'Home',
			'link':'#/home'
		},
		{
			'title':'Software',
			'link':'#/software'
		},
		{
			'title':'In Progress',
			'link':'#/inprogress'
		},
		{
			'title':'Categories',
			'link':'#/categories'
		},
		{
			'title':'Contact Us',
			'link':'#/contactus'
		},
	];

	this.mainMenu = function(cb, pos){
		var m = [];
		var a = 1;
		var p = $l.path();
		var i = (pos)?pos:(p === '/home')?1:(p === '/software')?2:(p === '/inprogress')?3:(p==='/categories')?4:5;

		angular.forEach(menu,function(x){
			if(a === i){
				x.class = 'active';
			}else{
				x.class = '';
			}
			m.push(x);
			if(a >= menu.length){
				cb(m);
			}
			a++;
		});
	};

}]);

