var page='';
var pageacharegr='';

$(document).ready(function(){
	page = document.location.pathname;

	page = page.substr(page.lastIndexOf('/')+1);
	page = page.substr(0,page.lastIndexOf('_'))+'.html';
	rep = page.match(/([0-9_]{8})_([0-9_]{6})/);
	if (rep != null ){
		page = '/comms/'+(rep[1]).substr(0,4)+'/'+(rep[1]).substr(4,2)+'/'+page;
	}
	else{
		page = '/comms/'+page;
	}
	pageacharger = page.replace(/.html/,'_0.html');
	
	$('#com-pagination').find('a').click(function (){
		var type = $(this).attr('id').replace(/Comm/,'');
		var page_comm = parseInt(type);
		url = page.replace(/.html/,'')+'_'+page_comm+'.html';
		document.location.href = url;
	});
	TraiteComms();
});
