
function detectTapatalk() {
	if (document.cookie.indexOf("tapatalk_redirect=false") < 0) {
		if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
			if (confirm("Ce forum a son application iPhone ! Clique OK pour en savoir plus sur Tapatalk.")) {            
				document.cookie = "tapatalk_redirect=false"; 
				window.location = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=307880732&mt=8";
			} else {
				setTapatalkCookies();
			}
		} else if(navigator.userAgent.match(/android/i)) {
			if (confirm("Ce forum a son application Android ! Clique OK pour en savoir plus sur Tapatalk.")) {            
				document.cookie = "tapatalk_redirect=false"; 
				window.location = "market://search?q=pname:com.quoord.tapatalkpro.activity";
			} else {
				setTapatalkCookies();
			}
		} else if((navigator.userAgent.match(/Symbian/i)) || (navigator.userAgent.match(/Nokia/i))) {
			if (confirm("Ce forum a son application Nokia ! Clique OK pour en savoir plus sur Tapatalk.")) {            
				document.cookie = "tapatalk_redirect=false"; 
				window.location = "http://store.ovi.com/content/22647?clickSource=browse&contentArea=applications";
			} else {
				setTapatalkCookies();
			}
		}
	}
}

function setTapatalkCookies() {
	var date = new Date();
	var days = 30;
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+ date.toGMTString();
	document.cookie = "tapatalk_redirect=false" + expires; 
}

detectTapatalk();
