$.noConflict();

jQuery(document).ready(function($) {
		
	/* begin UA sniffing for mobile devices */
	
	if(typeof(clearCookie) != "undefined") {
		if(clearCookie===true) {
			$.cookie("viewMobile", null);
		}
	}
	
	if( navigator.userAgent.match(/Android/i) ||
 	navigator.userAgent.match(/webOS/i) ||
 	navigator.userAgent.match(/BlackBerry/i) ||
 	navigator.userAgent.match(/Windows Phone/i) ||
 	navigator.userAgent.match(/iPhone/i) ||
 	navigator.userAgent.match(/iPod/i) ||
 	navigator.userAgent.match(/iPad/i)
 	) {
 		var viewMobile = $.cookie('viewMobile');
 		
 		if(viewMobile==="true") {
 			document.location = "/mobi/";
 		} else if (viewMobile==="false") {
 			alert('false')
 			// if user selected 'no' to previous dialog
 		} else {
 			var agree = confirm("Proceed to mobile site?");
			if (agree) {
				$.cookie("viewMobile", "true", { path: "/", expires: 1 });
				document.location = "/mobi/";
			}
 		}
	}
	
	/* end UA sniffing for mobile devices */
});
