$(document).ready(function(){$.eo={};$.eo.order=cookie.read("eo-order");$.eo.fblikes=cookie.read("eo-fblikes");$.eo.bookprice=5;initOrder();initFbLikes();$("a[title='@Facebook']").click(function(){$(this).attr("target","_blank")});$("a.close").click(function(){$(this).parent().parent().hide();if(document.location.hash&&document.location.hash!="#none")document.location.hash="none";else{var href=window.location.href.substring(0,window.location.href.indexOf("?"))}return false});$(".gototop").click(function(){$.scrollTo(0,700);return false});$(".menu-sub li a").click(function(){$.scrollTo($("#"+$(this).attr("href")).position().top-20,700);return false});$(".order-book").click(function(){addOrder($(this).attr("id").replace(/[a-z A-Z -]+/,""))});$(".orderbooks input").change(function(){checkOrder($(this).val())})});$(function(){$(window).hashchange(function(){var hash=location.hash.replace(/^#/,'');if(!hash)hash="";try{$("div.teaser").hide();$("#"+hash).show(0,function(){$.scrollTo(0,350)});return false}catch(err){return false}});$(window).hashchange()});$(window).load(function(){});function initFbLikes(){var fblikes=cookie.read("eo-fblikes");if(fblikes)$("#likes").html(fblikes);$.getJSON("https://graph.facebook.com/92454758642?callback=?",function(data){$.eo.fblikes=cookie.create("eo-fblikes",data.likes);$("#likes").html(data.likes)})}function initOrder(){var order=cookie.read("eo-order");var books="";if(order!=null&&order!=""){var orderArr=order.split("|");var orderCount=orderArr.length-1;for(var i=0;i<orderCount;i++){var bookId=parseInt(orderArr[i]);$("#book-"+bookId).attr("checked","checked");books=(books=="")?bookId:books+", "+bookId}}$("#wpcf7-f2-p10-o1 #orderbooks").val(books)}function addOrder(bookNo){var order=cookie.read("eo-order");if(order==null)order=bookNo+"|";else if(order.indexOf(bookNo)!=-1)order=order.replace(bookNo+"|","");else order=order+bookNo+"|";$.eo.order=cookie.create("eo-order",order);initOrder()}function checkOrder(books){var order=cookie.read("eo-order");var newOrder="";if(books!=null&&books!=""){var booksArr=books.split(",");var booksCount=booksArr.length;$(".wrap input[type=checkbox]").attr("checked","");for(var i=0;i<booksCount;i++){var bookNo=parseInt(booksArr[i]);if($("#book-"+bookNo).size()>0){$("#book-"+bookNo).attr("checked","checked");if(newOrder.indexOf(bookNo)==-1)newOrder=newOrder+bookNo+"|"}}$.eo.order=cookie.create("eo-order",newOrder);initOrder()}}function clearOrder(){$(".wpcf7-form table").hide();$(".order-book").attr("checked","");$.eo.order=cookie.erase("eo-order")}function runPayPalGateway(){}jQuery.scrollTo=function scrollTo(to,speed){$('html, body').animate({scrollTop:to},speed)};jQuery.redirect=function(url){window.location.replace(url)};
