function popup(page, scrollbars, width, height) {
	if(scrollbars == true)
		sb = 'scrollbars=yes';
	else sb = 'scrollbars=no';

	var top=(screen.height-height)/2;
	var left=(screen.width-width)/2;

	window.open(page, '_blank', sb+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,left='+ left +',top='+ top +',width=' + width + ',height=' + height);
}

$(document).ready(function () {
	/* Popup ... */
	$(".open-jpopup").bind ("click",function () {
		
		hostNameSite =  window.location.hostname;
		

		urlsplit = this.href.substring(this.href.indexOf("//")+2, this.href.indexOf('/',this.href.indexOf("//")+2)) ;
		
		if(urlsplit == hostNameSite) {
			// on considere que le meme nom domaine = dans sematic ...pour l'instant
			var page = this.href.substring (this.href.lastIndexOf('/'));
			window.open("/export/raw"+page, "" ,"width=800, height=600, scrollbars=yes");
		} else {
			window.open(this.href ,"" ,"width=800, height=600, scrollbars=yes");
		}
		return false;
	});
	
	/* New window ... */
	$(".open-popup").bind ("click",function () {
		window.open(this.href);
		return false;
	});	
	
	// onchange/submit
	$("#itemsPerPage").change(function (ev) {
		$(this).parent().parent("form").submit();
	});
	$("#itemsPerPage").siblings("input[type=submit]").css("display","none");
});

