/*
* JS Redirection Mobile
*
* Developed by
* Sebastiano Armeli-Battana (@sebarmeli) - http://www.sebastianoarmelibattana.com
* Dual licensed under the MIT or GPL Version 3 licenses.
* @version 0.9.5
*/
window.SA||(window.SA={}),SA.redirection_mobile=function(a){var b=function(a){var b=new Date;return b.setTime(b.getTime()+a),b},c=function(a){if(!a)return;var b=document.location.search,c=b&&b.substring(1).split("&"),d=0,e=c.length;for(;d<e;d++){var f=c[d],g=f&&f.substring(0,f.indexOf("="));if(g===a)return f.substring(f.indexOf("=")+1,f.length)}},d=navigator.userAgent.toLowerCase(),e="false",f="true",g=a||{},h=g.noredirection_param||"noredirection",i=g.mobile_prefix||"m",j=g.mobile_url,k=g.mobile_scheme?g.mobile_scheme+":":document.location.protocol,l=document.location.host,m=c(h),n=j||i+"."+(l.match(/^www\./i)?l.substring(4):l),o=g.cookie_hours||1,p=g.keep_path||!1,q=g.keep_query||!1,r=g.tablet_url||n,s=!!d.match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i);if(document.referrer.indexOf(n)>=0||m===f)window.sessionStorage?window.sessionStorage.setItem(h,f):document.cookie=h+"="+f+";expires="+b(36e5*o).toUTCString();var t=window.sessionStorage?window.sessionStorage.getItem(h)===f:!1,u=document.cookie?document.cookie.indexOf(h)>=0:!1;if(!!d.match(/(iPad|SCH-I800|xoom|kindle)/i)){var v=g.tablet_redirection!==f&&!g.tablet_url?!1:!0;s=!1}if((v||s)&&!u&&!t){if(g.beforeredirection_callback&&!g.beforeredirection_callback.call(this))return;var w="";p&&(w+=document.location.pathname),q&&(w+=document.location.search),v?document.location.href=k+"//"+r+w:s&&(document.location.href=k+"//"+n+w)}}
