/* Copyright(c) 2011 One.Com */
function onReady(a){onReady.bindReady();if(onReady.isReady){a.call(window)}else{onReady.readyList.push(function(){return a.call(window)});return this}}onReady.isReady=false;onReady.readyList=[];onReady.ready=function(){if(!onReady.isReady){onReady.isReady=true;if(onReady.readyList){var b=onReady.readyList.length,a=0;for(;a<b;a+=1){onReady.readyList[a].call(window)}onReady.readyList=null}}};onReady.readyBound=false;onReady.bindReady=function(){if(onReady.readyBound){return}onReady.readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",onReady.ready,false)}if(window.addEventListener){window.addEventListener("load",onReady.ready,false)}else{if(window.attachEvent){window.attachEvent("onload",onReady.ready)}else{var a=window.onload;window.onload=function(){if(a){a.call(window)}onReady.ready()}}}};onReady.addEventHandler=function(a,d,c,b){b=b||window;if(a.addEventListener){a.addEventListener(d,function(){c.apply(b,arguments)},false)}else{if(a.attachEvent){a.attachEvent("on"+d,function(){c.apply(b,arguments)})}}};var UrlRewriter=function(){var e=navigator.userAgent.toLowerCase(),b=e.indexOf("mobile")!==-1||e.indexOf("iphone")!==-1||e.indexOf("blackberry")!==-1||(document.cookie.match(/is_mobile=true/)&&!document.cookie.match(/is_mobile=false/)),d=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/),c=function(h){var g=h.match(/([^\.\/]+)\.((?:[^\/]+\.)+[^\/]+)/),f;if(g){f={location:g[1],domain:g[2]}}else{g=h.match(/([^\/]+)\/([^\/]+)/);if(g){f={domain:g[1],location:g[2]}}}return f},a;a=(function(){var k=this,j=document.getElementById("mainFrame"),h=window.location.hash,i,f,g;return{init:function(){var l=c(window.location.toString());if(l){f=l.location;i=l.domain;g="http://iloapp."+i+"/gallery/"+f+"?";if(b){window.location="http://iloapp."+i+"/gallery/"+f+"?Mobile"}else{if(h===""){this.updateHash("home")}else{this.updateFrame()}if(window.history){onReady.addEventHandler(window,"popstate",function(m){if(h!==window.location.hash){this.updateFrame(window.location.hash)}},this)}else{if("onhashchange" in window){onReady.addEventHandler(window,"hashchange",function(m){if(h!==window.location.hash){this.updateFrame(window.location.hash)}},this)}}if(window.postMessage){onReady.addEventHandler(window,"message",function(m){this.updateHash(m.data)},this)}}}},updateFrame:function(l){if(!l){h=window.location.hash}else{h=l}var m=this.hashToSrc(h);if(j.src!==m){j.src=m}},updateHash:function(l){var m="#"+l;if(h!==m){h=m;if(window.history&&window.history.replaceState){window.history.replaceState({message:l},"",m)}else{window.location.hash="#"+l}}},hashToSrc:function(o){var n=o.match(/^#home(\.(\d+))?$/),p=g,l,m;if(n){if(n[2]!==undefined){p+="Home&page="+parseInt(n[2],10)}else{p+="Home"}}else{n=o.match(/^#(\d+)(?:\.(\d+))?/);if(n){l=n[1];m=n[2];p+="Album&album="+l;if(m!==null){p+="&image="+m}}}return p}}}());a.init();UrlRewriter=function(){return a};return UrlRewriter()};onReady(function(){var a=new UrlRewriter()});
