$(document).ready(function(){
      if ((navigator.userAgent.indexOf('iPhone') != -1)
      || (navigator.userAgent.indexOf('iPod') != -1)
      || (navigator.userAgent.indexOf('iPad') != -1)
      || (navigator.userAgent.indexOf('Android') != -1)
      || (navigator.userAgent.indexOf('BlackBerry9000') != -1)
      || (navigator.userAgent.indexOf('BlackBerry') != -1)
      || (navigator.userAgent.indexOf('Windows CE') != -1)
      || (navigator.userAgent.indexOf('BlackBerry9700') != -1)
      || (screen.width <= 960)){
      			//alert(screen.width);
				
      			var parametres = window.location.search;
				//var href = window.location.href;
				//var host = "http://"+window.location.host+"/";
				//alert(href);
				//alert(host);
      			//if (window.location.search.substring(1).split('?') != 'mobile=1') {
      			/*if ((parametres.substring(parametres.lastIndexOf("?")) != '?mobile=1') || (window.location.href == "http://"+window.location.host) || (window.location.href == "https://"+window.location.host)) {
					var question = confirm("Voulez-vous consulter la version optimisée pour votre mobile de Audiens.org ?"); 
				}*/
				
				if ((parametres.substring(parametres.lastIndexOf("?")) != '?mobile=1') && (!$.cookie("cookie_audiens"))) {
					var question = confirm("Voulez-vous consulter la version optimisée pour votre mobile de Audiens.org ?"); 
				}
				
				if (!$.cookie("cookie_audiens")) {
					$.cookie("cookie_audiens","OK");
				}
				
				
            if (question) { 
                 window.location = "http://mobile.audiens.org";
            }
	  }
});


//|| ((navigator.userAgent.indexOf('Windows') == -1) && (navigator.userAgent.indexOf('X11') == -1) && (navigator.userAgent.indexOf('Mac') == -1))

