var url_about,button_showAbout,browse_height,browse_width,scrollTop,timeid_nav,post_canresize=false,content_data=null,content_animate_finished=false,current_url="http://www.inn823.com/",content_page=1,aboutData,mainPageUrl="http://www.inn823.com/",chineseMainPageUrl="http://www.inn823.com/zh/",prevUrl="http://www.inn823.com/#everything",loadAboutComplete=false,showAboutFlag=false,showingHeadHover=false,hiddingHeadHover=false;
$(function(){if(window.location.href.indexOf(chineseMainPageUrl)!=-1)mainPageUrl=chineseMainPageUrl;(new Image).src="http://www.inn823.com/wp-content/themes/inn823/images/single-btns.png";$("body").append("<div id='about_data'></div>");$("#show_more .hide").hide();initVariable();$.post($("#about_url").html(),{glll:"ajax"},function(a){$("#about_data").html(a);aboutData=$("#about_data").find("#page-bg");$("#about_data").empty();setHeaderHover();initAction();if(showAboutFlag)showAbout();else loadAboutComplete=
true});initView();initPostAction();initBtnsAction();initNavAm();initImgAction();initMoreAction();$("#container .post").length<10&&$("#show_more img").hide();$("#cat-nav").find("a").click(function(){var a=Math.max($("body").height(),$(window).height());$('<div class="loadingContent"><div class="loadingIcon"></div></div>').height(a).css("opacity",0.1).children().height($(window).height()).end().appendTo("body").fadeTo(500,0.7);a=$(this).attr("href");var b=$(this).parents("li");b.siblings(".current").removeClass("current").children("a").css("background-position",
"100% 0%");b.addClass("current");setCurrentUrl(a.substring(mainPageUrl.length),true);current_url=a;content_page=1;var c=$("#container").children();$("#show_more .hide").hide();$.post(a,{glll:"ajax"},function(d){$(".loadingContent").stop(true,true).fadeTo(600,0.1,function(){$(this).remove()});d=$(d).filter(".post").hide();if(d.length>c.length){for(var e=0;e<c.length;e++)d.eq(e).insertAfter(c.eq(e));d.filter(":gt("+(c.length-1)+")").appendTo("#container")}else for(e=0;e<d.length;e++)d.eq(e).insertAfter(c.eq(e));
c.remove();d.show();initPostAction();initImgAction();initBtnsAction();d.length<10?$("#show_more img").hide():$("#show_more img").show();waitForArticleImage()},"text");return false});setDefaultPage(window.location.href);initWheelToNextArticleEvent();waitForArticleImage()});function setCurrentUrl(a,b){if(b)prevUrl=window.location.href==mainPageUrl+"#"?window.location.href+"everything/":window.location.href;window.location.href=mainPageUrl+"#"+a}
function setPrevUrl(){if(prevUrl==mainPageUrl)prevUrl+="#everything/";window.location.href=prevUrl}function setDefaultPage(a){var b=a.lastIndexOf("#");if(b!=-1){var c=false;a=mainPageUrl+a.substring(b+1);$("#cat-nav a").each(function(){if($(this).attr("href")==a){c=true;$(this).click()}});if(!c){$("#container .post .thumb a").each(function(){$(this).attr("url")==a&&$(this).click()});if(a==$("#about_url").html())if(loadAboutComplete)showAbout();else showAboutFlag=true}}}
function initWheelToNextArticleEvent(){var a=$("body > .wrapper").offset().top,b=$("#container > .post").outerHeight(true),c=0;$("body").mousewheel(function(d,e){if($("#am_post, #about").length!=0)return false;var f=$(document).scrollTop(),g=Math.floor((f-a)/b);$("html, body").stop();if(e>0){(f-a)%b==0&&g--;if(c!=0)g-=c;f=a+g*b}else{if(c!=0)g+=c;f=a+(g+1)*b}c++;c=Math.min(c,2);$("html, body").animate({scrollTop:f},300,function(){c=0});return false})}
function waitForArticleImage(){var a=$("#container .post .thumb img");if(a.length!=0){$("#container").append('<div class="pos waitforContent"><div class="loading"></div></div>');var b=a.length,c=0;a.each(function(d,e){if(e.complete){c++;c==b&&$("#container .waitforContent").remove()}else $(e).load(function(){c++;c==b&&$("#container .waitforContent").remove()})})}}
function setHeaderHover(){$('<div id="headHoverArrowContainer"><div id="headHoverArrow"></div></div>').hide().insertBefore("#logo");$("#headHoverArrow").hide();$("#header").hover(function(){showingHeadHover||showHeadHover()},function(){hiddingHeadHover||hideHeadHover()})}
function showHeadHover(){showingHeadHover=true;$("#cat-nav").stop(true,true).animate({top:110},500);$("#headHoverArrowContainer").stop(true,true).slideDown(500,function(){$("#headHoverArrow").stop(true,true).slideDown(250,function(){showingHeadHover=false})})}function hideHeadHover(){hiddingHeadHover=true;$("#cat-nav").stop(true,true).animate({top:80},500);$("#headHoverArrowContainer").stop(true,true).slideUp(500,function(){$("#headHoverArrow").hide();hiddingHeadHover=false})}
function setContentData(){$("#container").html(content_data.filter(":lt(10)")).slideDown(1E3);initPostAction();initImgAction()}
var showAbout=function(){setCurrentUrl("about-us/",true);var a=$(document).scrollTop(),b=false;$("body").height()<=$(window).height()&&$("body").css("overflow","hidden").css("overflow-x","hidden").css("overflow-y","hidden");$("body").append($("<div id='about'><div class='scrollPane'><div class='scrollBlock'></div></div><div class='container'></div><a href='javascript:' class='back'></a></div>").css("visibility","hidden"));$("#about .container").html(aboutData.html());$("#contact input, #contact textarea").hover(function(){$(this).stop(true,
true).animate({backgroundColor:"#333333"},400)},function(){this.focusFlag||$(this).stop(true,true).animate({backgroundColor:"#131313"},400)}).focus(function(){this.focusFlag=true;$(this).stop(true,true).animate({backgroundColor:"#333333"},400)}).blur(function(){this.focusFlag=false;$(this).stop(true,true).animate({backgroundColor:"#131313"},400)});var c=$("#about");$("#about .container").mousewheel(function(d,e){if(e>0){$("#about .container").scrollTop($("#about .container").scrollTop()-50);$("#about .scrollBlock").css("top",
($("#about .scrollPane").height()-$("#about .scrollBlock").height())*($("#about .container").scrollTop()/($("#about .container")[0].scrollHeight-$("#about .container").height())))}else if(e<0){$("#about .container").scrollTop($("#about .container").scrollTop()+50);$("#about .scrollBlock").css("top",($("#about .scrollPane").height()-$("#about .scrollBlock").height())*($("#about .container").scrollTop()/($("#about .container")[0].scrollHeight-$("#about .container").height())))}return false});setTimeout(function(){var d=
$("body"),e=$("<div class='b'></div>").appendTo(d),f=$("<div class='l'></div>").appendTo(d),g=$("<div class='h'></div>").appendTo(d),h=$(window).scrollTop();w_h=$(window).height();dealy=800;wait=300;ease="easeInExpo";finalEase="easeInOutExpo";g.css({height:w_h,top:-w_h+h+30});f.css({height:w_h,top:-w_h+h});e.css({height:w_h,top:-w_h+h});c.css({height:w_h,top:-w_h+h});g.animate({top:h},dealy,ease);setTimeout(function(){f.animate({top:h},dealy,ease)},wait*2);setTimeout(function(){e.animate({top:h},
dealy,ease,function(){$("#about").css("visibility","visible");$("body").bind("mousewheel",function(i){i.preventDefault();return false}).css("overflow","hidden").css("overflow-x","hidden").css("overflow-y","hidden");browse_width=$(window).width();$("#about .container").height(browse_height).css("left",(browse_width-$("#about .container").width())/2);$("#about .back").css("top",0).css("left",browse_width-(browse_width/2-$("#about .container").width()/2)+1)})},wait);setTimeout(function(){c.animate({top:h},
dealy,finalEase,function(){g.remove();f.remove();e.remove();var i=$("#about .container").height(),j=$("#about .container").width(),k=$("#about .container")[0].scrollHeight;$("#about .container").scrollTop(0);$("#about .scrollBlock").height(i*(i/k)).draggable({start:function(){},drag:function(){var l=$("#about .scrollPane").height(),m=$(this)[0].offsetTop;$("#about .container").scrollTop(k*(m/l))},stop:function(){},containment:$("#about .scrollPane"),scroll:false,cursor:"pointer"});$("#about .scrollPane").css("top",
0).css("left",browse_width-(browse_width/2-j/2)-6).height(i).fadeIn(300);b=true})},wait*4)},100);$(window).resize(function(){if(b){$("#about").height(browse_height);$("#about .container").height(browse_height).css("left",(browse_width-$("#about .container").width())/2).scrollTop(0);var d=$("#about .container").height(),e=$("#about .container").width(),f=$("#about .container")[0].scrollHeight;$("#about .back").css("top",0).css("left",browse_width-(browse_width/2-e/2)+1);$("#about .scrollPane").css("top",
0).css("left",browse_width-(browse_width/2-e/2)-6).height(browse_height);$("#about .scrollBlock").height(d*(d/f)).css("top",0)}});$("#about .back").click(function(){setPrevUrl();b=false;c.animate({top:-browse_height+a},800,"easeInExpo",function(){$("body").unbind("mousewheel").css("overflow","auto").css("overflow-x","auto").css("overflow-y","auto");c.remove();initWheelToNextArticleEvent()})})},initVariable=function(){url_about=$("#about_url").html();button_showAbout=$("#button_showAbout");browse_height=
$(window).height();browse_width=$(window).width();scrollTop=$(window).scrollTop()},initView=function(){},initAction=function(){button_showAbout.click(showAbout);$("#headHoverArrowContainer").click(showAbout);$(window).resize(function(){initVariable();initView()});$(window).scroll(function(){initVariable();initView();initNavAction()})},initNavAction=function(){clearTimeout(timeid_nav)},hearamdoing=false,preScrollTop=0;
function headerAction(){clearTimeout(timeid_nav);var a=$(document).scrollTop();if(a>80){if(hearamdoing){a=preScrollTop;$(document).scrollTop(a)}if(preScrollTop>a){$("#header-bottom").hide();$("#header").hide()}$("#lang-c").css("top",a+50);$("#cat-nav").css("top",a+80);$("#lang-c").slideUp(10);$("#cat-nav").slideUp(10);$("#header-bottom").css("top",a-80);$("#header").css("top",a-80);timeid_nav=setTimeout(function(){hearamdoing=true;if(preScrollTop>a){$("#header-bottom").show();$("#header").show()}preScrollTop=
a;$("#header").gravity({point:a,step:0.1});$("#header-bottom").gravity({point:a,step:0.1,endfn:function(){$("#lang-c").slideDown(300);$("#cat-nav").slideDown(300);hearamdoing=false}})},1E3)}else{if(preScrollTop>a){$("#header-bottom").show();$("#header").show()}preScrollTop=a;$("#lang-c").css("top",50);$("#cat-nav").css("top",80);$("#lang-c").slideDown(300);$("#cat-nav").slideDown(300);$("#header-bottom").css("top",0);$("#header").css("top",0)}}
var initPostAction=function(){var a=$(".thumb a").size();$(".thumb a").each(function(b){var c=$(".thumb a").eq(b);c.unbind("click");c.click(function(){showPost($(this).attr("url"),b,a)})})},showPost=function(a,b,c){setCurrentUrl(a.substring(mainPageUrl.length),true);var d=false,e=$(document).scrollTop();$("body").append("<div id='am_post_cyan'></div>");$("body").append("<div id='am_post'><div class='loading'></div><div class='scrollPane'><div class='scrollBlock'></div></div><div class='container'></div><li class='back'><a href='javascript:'></a></li><li class='pre'><a href='javascript:'></a></li><li class='next'><a href='javascript:'></a></li></div>");
var f=$("#am_post_cyan"),g=$("#am_post");f.height(browse_height*2).css("top",-browse_height*2+e);g.height(browse_height).css("top",e+browse_height);$("#am_post .container").css("opacity",1).height(browse_height).css("left",(browse_width-$("#am_post .container").width())/2);$("#am_post .back").css("top",0).css("left",browse_width-(browse_width/2-$("#am_post .container").width()/2)+1);$("#am_post .pre").css("top",70).css("left",browse_width-(browse_width/2-$("#am_post .container").width()/2)+1);$("#am_post .next").css("top",
140).css("left",browse_width-(browse_width/2-$("#am_post .container").width()/2)+1);$("#am_post .container").mousewheel(function(i,j){if(j>0){$("#am_post .container").scrollTop($("#am_post .container").scrollTop()-50);$("#am_post .scrollBlock").css("top",($("#am_post .scrollPane").height()-$("#am_post .scrollBlock").height())*($("#am_post .container").scrollTop()/($("#am_post .container")[0].scrollHeight-$("#am_post .container").height())))}else if(j<0){$("#am_post .container").scrollTop($("#am_post .container").scrollTop()+
50);$("#am_post .scrollBlock").css("top",($("#am_post .scrollPane").height()-$("#am_post .scrollBlock").height())*($("#am_post .container").scrollTop()/($("#am_post .container")[0].scrollHeight-$("#am_post .container").height())))}return false});f.gravity({point:-browse_height+e,step:0.2,speed:15,endfn:function(){g.animate({top:e},300);setTimeout(function(){post_canresize=true;$("#am_post .container").css("opacity",1).load(a+" #single-wrapper",function(){$("#am_post > .loading").fadeOut();var i=$("#am_post .container")[0].scrollHeight,
j=$("#am_post .container").height(),k=$("#am_post .container").width();if(j==i)$("#am_post .scrollBlock").hide();else{$("#am_post .scrollBlock").height(j*(j/i)).draggable({start:function(){},drag:function(){var l=$("#am_post .scrollPane").height(),m=$(this)[0].offsetTop;$("#am_post .container").scrollTop(i*(m/l))},stop:function(){},containment:$("#am_post .scrollPane"),scroll:false,cursor:"pointer"});$("#am_post .scrollPane").css("top",0).css("left",browse_width-(browse_width/2-k/2)-6).height(j).fadeIn(300,
function(){d||$("#container").hide()})}});$("body").css("overflow","hidden").css("overflow-x","hidden").css("overflow-y","hidden")},300)}});$("#am_post .back").click(function(){setPrevUrl();post_canresize=false;d=true;$("#container").show();g.gravity({point:browse_height+e,step:0.1,speed:25,endfn:function(){f.animate({top:-browse_height*2+e},300);$("body").css("overflow","auto").css("overflow-x","auto").css("overflow-y","auto");setTimeout(function(){post_canresize=false;f.remove();g.remove()},300)}})});
$(window).resize(function(){if(post_canresize){$("#am_post").height(browse_height);$("#am_post .container").height(browse_height).css("left",(browse_width-$("#am_post .container").width())/2).scrollTop(0);var i=$("#am_post .container").height(),j=$("#am_post .container").width(),k=$("#am_post .container")[0].scrollHeight;$("#am_post .back").css("top",0).css("left",browse_width-(browse_width/2-j/2)+1);$("#am_post .pre").css("top",70).css("left",browse_width-(browse_width/2-j/2)+1);$("#am_post .next").css("top",
140).css("left",browse_width-(browse_width/2-j/2)+1);$("#am_post .scrollPane").css("top",0).css("left",browse_width-(browse_width/2-j/2)-6).height(browse_height);$("#am_post .scrollBlock").height(i*(i/k)).css("top",0);checkPrevNextBtn(b,c)}});checkPrevNextBtn(b,c,false);$("#am_post .pre").click(function(){b--;h(b)});$("#am_post .next").click(function(){b++;h(b)});var h=function(i){$("#am_post > .loading").show();i=$(".thumb a").eq(i).attr("url");setCurrentUrl(i.substring(mainPageUrl.length),false);
$("#am_post .container").stop(true,true).css("opacity",1).load(i+" #single-wrapper","",function(){$("#am_post > .loading").fadeOut();var j=$("#am_post .container")[0].scrollHeight,k=$("#am_post .container").height(),l=$("#am_post .container").width();if(k==j)$("#am_post .scrollBlock").hide();else{$("#am_post .scrollBlock").css("top",0).height(k*(k/j)).draggable({start:function(){},drag:function(){var m=$("#am_post .scrollPane").height(),n=$(this)[0].offsetTop;$("#am_post .container").scrollTop(j*
(n/m))},stop:function(){},containment:$("#am_post .scrollPane"),scroll:false,cursor:"pointer"});$("#am_post .scrollPane").css("top",0).css("left",browse_width-(browse_width/2-l/2)-6).height(k).fadeIn(300,function(){})}});checkPrevNextBtn(b,c,true)}},initBtnsAction=function(){$(".btns").each(function(a){a=$(".btns").eq(a);var b=a.parent("div").children(".text_display").find(".text"),c;a.find("li").unbind("mouseover").mouseover(function(){var d=$(this).find("a").html();b.stop().animate({marginLeft:-100},
300);setTimeout(function(){c=b.text();b.html(d);b.stop().animate({marginLeft:0},300)},300)}).unbind("mouseout").mouseout(function(){b.stop().animate({marginLeft:-100},300);setTimeout(function(){b.html(c);b.stop().animate({marginLeft:0},300)},300)})});$("#container .btns a.view").click(function(){$(this).parent().parent().parent().siblings(".thumb").children("a").click();return false})};
function checkPrevNextBtn(a,b,c){if(a==0)if(c){$("#am_post .pre").slideUp(500);$("#am_post .next").animate({top:70},500)}else{$("#am_post .pre").hide();$("#am_post .next").css({top:70})}else if(c){$("#am_post .pre").slideDown(500);$("#am_post .next").animate({top:140},500)}else{$("#am_post .pre").show();$("#am_post .next").css({top:140})}if(a==b-1)c?$("#am_post .next").slideUp(500):$("#am_post .next").hide();else c?$("#am_post .next").slideDown(500):$("#am_post .next").show()}
(function(a){a.extend(a.fx.step,{backgroundPosition:function(b){function c(e){e=e.replace(/left|top/g,"0px");e=e.replace(/right|bottom/g,"100%");e=e.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");e=e.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);return[parseFloat(e[1],10),e[2],parseFloat(e[3],10),e[4]]}if(b.state===0&&typeof b.end=="string"){var d=a.browser.msie?a.curCSS(b.elem,"backgroundPositionX")+" "+a.curCSS(b.elem,"backgroundPositionY"):a.curCSS(b.elem,"backgroundPosition");d=c(d);
b.start=[d[0],d[2]];d=c(b.end);b.end=[d[0],d[2]];b.unit=[d[1],d[3]]}d=[];d[0]=(b.end[0]-b.start[0])*b.pos+b.start[0]+b.unit[0];d[1]=(b.end[1]-b.start[1])*b.pos+b.start[1]+b.unit[1];b.elem.style.backgroundPosition=d[0]+" "+d[1]}})})(jQuery);
var initNavAm=function(){$("#cat-nav a").hover(function(){$(this).parent("li").hasClass("current")?$(this).css("background-position","100% 100%"):$(this).stop(false,true).animate({backgroundPosition:"(100% 100%)"},700).siblings().stop(false,true)},function(){$(this).parent("li").hasClass("current")||$(this).stop(false,true).animate({backgroundPosition:"(100% 0%)"},700).siblings().stop(false,true)});$("#cat-nav li.current a").css("background-position","100% 100%")},initImgAction=function(){$(".thumb").unbind("mouseenter").mouseenter(function(){$(this).find(".img_label > .label").css("left",
-750).show().animate({left:0},300)}).unbind("mouseleave").mouseleave(function(){$(this).find(".img_label > .label").fadeOut(300)})},initMoreAction=function(){$("#show_more .hide").click(function(){var a=$(this),b=$("#container .post");content_page=1;b.filter(":gt(9)").fadeOut(1E3,function(){$(this).remove()});a.fadeOut(1E3);$("#container .post").length>=10&&$("#show_more img").show();return false});$("#show_more img").click(function(){url=$("#show_more .url").html();content_page++;$("#container").append('<div class="pos waitforContent"><div class="loading"></div></div>');
if(current_url.charAt(current_url.length-1)!="/")current_url+="/";$.post(current_url+"page/"+content_page,{glll:"ajax"},function(a){a=$(a).filter(".post");if(a.length==0)$("#container .waitforContent").remove();else{a.length<10&&$("#show_more img").hide();$("#show_more .hide").fadeIn();preloadAppendContent(a,0)}})})};
function preloadAppendContent(a,b){if(b>=a.length){$("#container .waitforContent").remove();initPostAction();initImgAction();initBtnsAction()}else{var c=a.eq(b).find("img"),d=new Image;d.src=c.attr("src");d.complete?appendMoreCotent(a,b):$(d).load(function(){appendMoreCotent(a,b)})}}function appendMoreCotent(a,b){var c=$("#container .waitforContent:first");a.eq(b).hide().insertBefore(c).fadeIn(1E3);b++;preloadAppendContent(a,b)}
$.fn.gravity=function(a){var b={direction:"top",point:400,step:0.1,speed:15,endfn:function(){},wait:0};if(a!=undefined){if(a.time!=undefined)b.time=a.time;if(a.direction!=undefined)b.direction=a.direction;if(a.point!=undefined)b.point=a.point;if(a.speed!=undefined)b.speed=a.speed;if(a.endfn!=undefined)b.endfn=a.endfn;if(a.wait!=undefined)b.wait=a.wait}var c=$(this),d=c[0].offsetTop,e=c[0].offsetLeft;if(b.direction=="top"){var f=d,g=function(){var h=c[0].offsetTop;f=h-d+10;h+=f*b.step;c.css("top",
h);if(h<b.point)setTimeout(function(){g()},b.speed);else{c.css("top",b.point);b.endfn()}};setTimeout(function(){g()},b.wait)}if(b.direction=="left"){f=e;g=function(){var h=c[0].offsetLeft;f=h-e+10;h+=f*b.step;c.css("left",h);if(h<b.point)setTimeout(function(){g()},b.speed);else{c.css("left",b.point);b.endfn()}};setTimeout(function(){g()},b.wait)}return c};var topjquery=function(){};
(function(a){function b(d){var e=[].slice.call(arguments,1),f=0;d=a.event.fix(d||window.event);d.type="mousewheel";if(d.wheelDelta)f=d.wheelDelta/120;if(d.detail)f=-d.detail/3;e.unshift(d,f);return a.event.handle.apply(this,e)}var c=["DOMMouseScroll","mousewheel"];a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var d=c.length;d;)this.addEventListener(c[--d],b,false);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var d=c.length;d;)this.removeEventListener(c[--d],
b,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}})})(jQuery);
(function(){function a(c){return document.getElementById(c)}function b(c,d){a(c).style.display=d}window.MGJS={};window.MGJS.$=a;window.MGJS.setStyleDisplay=b;window.MGJS.goTop=function(){var c=jQuery(jQuery.browser.safari?"body":"html"),d=jQuery(window).scrollTop()/2;d=(d-1500)/4+1500;c.animate({scrollTop:0},d,"easeInOutExpo")};window.MGJS.switchTab=function(c,d,e,f,g,h){a(e).className=f;a(g).className=h;e=c.split(",");for(f=0;f<e.length;f++){c=e[f];a(c)&&b(c,"block")}e=d.split(",");for(f=0;f<e.length;f++){c=
e[f];a(c)&&b(c,"none")}};window.MGJS.loadCommentShortcut=function(){a("comment").onkeydown=function(c){var d=null;d=window.event?window.event:c;d!=null&&d.ctrlKey&&d.keyCode==13&&a("submit").click()};a("submit").value+=" (Ctrl+Enter)"};window.MGJS.getElementsByClassName=function(c,d,e){e=e||document;d=d=="*"&&e.all?e.all:e.getElementsByTagName(d);e=[];c=c.replace(/\-/g,"\\-");c=RegExp("(^|\\s)"+c+"(\\s|$)");for(var f,g=0;g<d.length;g++){f=d[g];c.test(f.className)&&e.push(f)}return e}})();

