// Copyright (c) 2010 SANKEI DIGITAL INC. All rights reserved. for mobile  redirect proc 2011.10.17 5.5

var skdRD=(function(){var o=function(){var w=["SC-01C"];var v=""+navigator.userAgent;var t=false;var e=w.length;for(var u=0;u<e;++u){if(v.indexOf(w[u])!=-1){t=true;break}}return t};var r=function(){var e=""+navigator.userAgent;e=e.toLowerCase();var v=/[^a-z](?:iPhone|iPod)[^a-z]/i;var z=/[^a-z](?:iPad)[^a-z]/i;var A=/[^a-z]android[^a-z]/i;var w=/[^a-z]Windows Phone OS[^a-z]/i;var x=/[^a-z](?:mobile[^a-z]|mobi\/|mini\/)/i;var C=v.test(e);var B=z.test(e);var u=A.test(e);var t=w.test(e);var y=x.test(e);return{iPhone:C,iPad:B,Android:u&&y,AndroidTab:u&&!y,WindowsPhone:t,Other:!C&&!B&&!u&&!t}};var d=function(){return{width:window.screen.width,height:window.screen.height}};var b=function(){var u=""+location.href;var t="("+location.host+")";var e=new RegExp(t);u=u.replace(e,function(){return RegExp.$1+"/smp"});u=u.replace(/\-(?:n[0-9]+)\.htm(|l)/,function(){return"-s.htm"+RegExp.$1});u=u.replace(/(\?|&)view=(?:pc|smp)($|&)/i,function(){if(RegExp.$2){return RegExp.$1}else{return""}});return u};var s=function(v){var u="";var t="";if(document.cookie.length>0){u=document.cookie.indexOf(v+"=");if(u!=-1){u=u+v.length+1;t=document.cookie.indexOf(";",u);if(t==-1){t=document.cookie.length}var e=""+decodeURIComponent(document.cookie.substring(u,t));e=e.toLowerCase();return e}}return""};var c=function(v){function y(C){var A=C[0],D=C[1],z=C[2];var B="";if(z){B=encodeURIComponent(A)+"="+encodeURIComponent(D)}else{B=A+"="+D}return B}function e(z){return z.join("; ")}var w=[];var t=v.length;for(var u=0;u<t;++u){w.push(y(v[u]))}var x;if(w.length>0){x=e(w)}document.cookie=x};var h,m;if(window.sessionStorage){h=function(t){var e=window.sessionStorage.getItem(t);return e};m=function(w){var e=w.length;var u,x,t;for(var v=0;v<e;++v){u=w[v][0];x=w[v][1];t=w[v][2];if(t){window.sessionStorage.setItem(encodeURIComponent(u),encodeURIComponent(x))}else{window.sessionStorage.setItem(u,x)}}}}var p=(function(){var e="SmpMode";return{get:function(){return s(e)},set:function(u){var w=new Date();w.setTime(w.getTime()+1209600000);c([[e,u,true],["expires",w.toGMTString()],["path","/"]])}}})();var g=(function(){var e="ViewMode";return{get:h?function(){try{var t=h(e);if(!t){t=s(e)}return t}catch(u){return s(e)}}:function(){return s(e)},set:m?function(t){try{m([[e,t,true]])}catch(u){c([[e,t,true],["path","/"]])}}:function(t){c([[e,t,true],["path","/"]])}}})();var k;try{var n=p.get();if(!n){var n="n";var j=r();if(j.iPhone){n="y"}else{if(j.Android||j.AndroidTab){if(!o()){location.href="/smp/js/redirect/s.html?ref="+encodeURIComponent(location.href);return}}}p.set(n)}}catch(q){n="n"}if(n=="y"){try{var l=location.search.substring(1);var f=/(?:^|&)view=(pc|smp)(?:$|&)/i;var i=f.exec(l);if(i){i=i[1];g.set(i)}else{i=g.get();if(!i){i="smp";g.set(i)}}}catch(q){i="smp";g.set(i)}if(i=="smp"){var a=b();location.href=a;return}else{k={setLink:function(G,B){try{if(G){var v=document.createElement("div");v.innerHTML=G;var I=b();var E=function(e){g.set("smp")};var u=document.createDocumentFragment();var w=v.getElementsByTagName("a");var A=w.length;for(var z=0;z<A;++z){var y=w[z];if(y.getAttribute("href")=="#"){y.setAttribute("href",I);if(y.addEventListener){y.addEventListener("click",E,false)}else{if(y.attachEvent){y.attachEvent("onclick",E)}}}}u.appendChild(document.createComment("chgview tag"));var t=v.childNodes;var H=t.length;for(var x=H-1;x>=0;--x){var F=t[x];if(F&&F.nodeType==1){u.insertBefore(F,u.firstChild)}}var D=B&&B.id?B.id:"chgview";D=document.getElementById(D);if(D){D.appendChild(u)}else{document.body.appendChild(u)}}}catch(C){}}}}}return k})();
