/*!
* JS Redirection Mobile
*
* Copyright (c) 2010 Sebastiano Armeli-Battana (http://sebarmeli.com)
* MIT Licensed: http://www.opensource.org/licenses/mit-license.php
* @link http://github.com/sebarmeli/JS-Redirection-Mobile-Site/
*/
(function(window,document,navigator){var addTimeToDate=function(msec){var exdate=new Date();exdate.setTime(exdate.getTime()+msec);return exdate;};var agent=navigator.userAgent.toLowerCase(),param="isStandardSite",TRUE="true",mobile_prefix="m",host=document.location.host,mobile_host=mobile_prefix+"."+(!!host.match(/^www\./i)?host.substring(4):host),cookie_hours=1,isUAMobile=!!(agent.match(/(iPhone|iPod|iPad|blackberry|android|htc|kindle|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone)/i));if(document.referrer.indexOf(mobile_host)>=0){if(window.sessionStorage){window.sessionStorage.setItem(param,TRUE);}else{document.cookie=param+"="+TRUE+";expires="+addTimeToDate(3600*1000*cookie_hours).toUTCString();}}var isSessionStorage=(window.sessionStorage)?(window.sessionStorage.getItem(param)===TRUE):false,isCookieSet=document.cookie?(document.cookie.indexOf(param)>=0):false;if(isUAMobile&&!(isCookieSet||isSessionStorage)){document.location.href=document.location.protocol+"//"+mobile_host;}}(window,document,navigator));


