 $(document).ready(function(){

var volvelles = ".back1029,.back1030,.back1,.back2,.back3,.back4,.back5,.back6,.back7,.back8,.back9,.back10,.back11,.back12,.back13,.back1000,.back57,.back400,.back401,.back402,.back403,.back404,.back405,.back406,.back407,.back408,.back409,.back410,.back300,.back301,.back302,.back303,.back304,.back305,.back306,.back307,.back308,.back309,.back310,.back311,.back312,.back313,.back314,.back315,.back316,.back317,.back318,.back319,.back320,.back321,.back322,.back323,.back1021,.back1022,.back1023,.back1024,.back1025,.back1026,.back1028,.back190"
var stammworter = ".back14,.back15,.back16,.back17,.back18,.back19,.back20,.back21,.back22,.back23,.back24,.back25,.back26,.back27,.back28,.back29,.back30,.back31,.back1007"
var kabbalah = ".back32,.back33,.back34,.back35,.back36,.back37,.back38,.back39,.back40,.back41,.back42"
var materiality = ".back46,.back4611,.back4622,.back4633,.back4644,.back4655,.back47,.back48,.back49,.back12011,.back411,.back412,.back413,.back414,.back415,.back416,.back417,.back418,.back419,.back1009,.back1010,.back1015,.back1031,.back1033"
var hands = ".back53,.back54,.back55,.back5511,.back5522,.back56,.back5611,.back5622,.back5633,.back5644,.back58,.back1001,.back1002,.back1012,.back1013,.back1014,.back1027";
var thirtyyearswar = ".back59,.back60,.back61,.back62,.back63,.back64,.back65,.back66,.back67,.back68,.back1003,.back1004,.back1005,.back1006,.back1016";
var cutups = ".back100,.back101,.back102,.back103,.back104,.back105,.back106,.back107,.back108,.back109,.back110,.back111,.back112,.back113,.back114,.back115,.back116,.back117,.back118,.back119,.back11911,.back120,.back121,.back122,.back123,.back124,.back126,.back127,.back128,.back12911,.back130,.back131,.back13111,.back13122,.back132,.back133,.back134,.back135,.back136,.back137,.back138,.back139,.back140,.back141,.back142,.back147,.back14711,.back14722,.back148,.back14811,.back14822,.back149,.back1011";
var leibniz = ".back200,.back201,.back202,.back203,.back204,.back205,.back206,.back207,.back208,.back209,.back210,.back211,.back212,.back213,.back214,.back215,.back216,.back219,.back220,.back221,.back222,.back223,.back224,.back225,.back226,.back227,.back228,.back229,.back230,.back231,.back232,.back233,.back234,.back235,.back1017,.back1019";
var towerofbabel = ".back43,.back44,.back1008,.back45";
var computers = ".back129,.back143,.back144,.back146,.back150,.back151,.back152,.back153,.back154,.back155,.back156,.back157,.back158,.back159,.back170,.back171,.back172,.back173,.back174,.back175,.back176,.back177,.back178,.back179,.back180,.back181,.back182,.back183,.back184,.back185,.back1032";
var permutation = ".back14833,.back161,.back162,.back163,.back164,.back250,.back251,.back252,.back253,.back254,.back255,.back256,.back257,.back258,.back259,.back260,.back261,.back262,.back263,.back264,.back265,.back266,.back267,.back1020,.back1034";
var volvelles_c = ".cube1029,.cube1030,.cube1,.cube2,.cube3,.cube4,.cube5,.cube6,.cube7,.cube8,.cube9,.cube10,.cube11,.cube12,.cube13,.cube1000,.cube57,.cube400,.cube401,.cube402,.cube403,.cube404,.cube405,.cube406,.cube407,.cube408,.cube409,.cube410,.cube300,.cube301,.cube302,.cube303,.cube304,.cube305,.cube306,.cube307,.cube308,.cube309,.cube310,.cube311,.cube312,.cube313,.cube314,.cube315,.cube316,.cube317,.cube318,.cube319,.cube320,.cube321,.cube322,.cube323,.cube1021,.cube1022,.cube1023,.cube1024,.cube1025,.cube1026,.cube1028,.cube190"
var stammworter_c = ".cube14,.cube15,.cube16,.cube17,.cube18,.cube19,.cube20,.cube21,.cube22,.cube23,.cube24,.cube25,.cube26,.cube27,.cube28,.cube29,.cube30,.cube31,.cube1007"
var kabbalah_c = ".cube32,.cube33,.cube34,.cube35,.cube36,.cube37,.cube38,.cube39,.cube40,.cube41,.cube42"
var materiality_c = ".cube46,.cube4611,.cube4622,.cube4633,.cube4644,.cube4655,.cube47,.cube48,.cube49,.cube12011,.cube411,.cube412,.cube413,.cube414,.cube415,.cube416,.cube417,.cube418,.cube419,.cube1009,.cube1010,.cube1015,.cube1031,.cube1033"
var hands_c = ".cube53,.cube54,.cube55,.cube5511,.cube5522,.cube56,.cube5611,.cube5622,.cube5633,.cube5644,.cube58,.cube1001,.cube1002,.cube1012,.cube1013,.cube1014,.cube1027";
var thirtyyearswar_c = ".cube59,.cube60,.cube61,.cube62,.cube63,.cube64,.cube65,.cube66,.cube67,.cube68,.cube1003,.cube1004,.cube1005,.cube1006,.cube1016";
var cutups_c = ".cube100,.cube101,.cube102,.cube103,.cube104,.cube105,.cube106,.cube107,.cube108,.cube109,.cube110,.cube111,.cube112,.cube113,.cube114,.cube115,.cube116,.cube117,.cube118,.cube119,.cube11911,.cube120,.cube121,.cube122,.cube123,.cube124,.cube126,.cube127,.cube128,.cube12911,.cube130,.cube131,.cube13111,.cube13122,.cube132,.cube133,.cube134,.cube135,.cube136,.cube137,.cube138,.cube139,.cube140,.cube141,.cube142,.cube147,.cube14711,.cube14722,.cube148,.cube14811,.cube14822,.cube149,.cube1011";
var leibniz_c = ".cube200,.cube201,.cube202,.cube203,.cube204,.cube205,.cube206,.cube207,.cube208,.cube209,.cube210,.cube211,.cube212,.cube213,.cube214,.cube215,.cube216,.cube219,.cube220,.cube221,.cube222,.cube223,.cube224,.cube225,.cube226,.cube227,.cube228,.cube229,.cube230,.cube231,.cube232,.cube233,.cube234,.cube235,.cube1017,.cube1019";
var towerofbabel_c = ".cube43,.cube44,.cube1008,.cube45";
var computers_c = ".cube129,.cube143,.cube144,.cube146,.cube150,.cube151,.cube152,.cube153,.cube154,.cube155,.cube156,.cube157,.cube158,.cube159,.cube170,.cube171,.cube172,.cube173,.cube174,.cube175,.cube176,.cube177,.cube178,.cube179,.cube180,.cube181,.cube182,.cube183,.cube184,.cube185,.cube1032";
var permutation_c = ".cube14833,.cube161,.cube162,.cube163,.cube164,.cube250,.cube251,.cube252,.cube253,.cube254,.cube255,.cube256,.cube257,.cube258,.cube259,.cube260,.cube261,.cube262,.cube263,.cube264,.cube265,.cube266,.cube267,.cube1020,.cube1034";
var lb = $("#labelbox,#labelbox-shadow");

   $(volvelles+volvelles_c).mouseover(function () {
		$(volvelles).addClass('selected');
        $("#labelbox").css("color","#A6A600");
        $(lb).text("combinatory volvelles").removeClass("displaynone");
      }).mouseout(function () {
        $(volvelles).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(stammworter+stammworter_c).mouseover(function () {
        $(stammworter).addClass('selected');
        $("#labelbox").css("color","#679B00").text("German stem-word theory of language");
        $(lb).text("German stem-word theory of language").removeClass("displaynone");
      }).mouseout(function () {
        $(stammworter).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(kabbalah+kabbalah_c).mouseover(function () {
        $(kabbalah).addClass('selected');
        $("#labelbox").css("color","#679B00");
        $(lb).text("kabbalah").removeClass("displaynone");
      }).mouseout(function () {
        $(kabbalah).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(materiality+materiality_c).mouseover(function () {
        $(materiality).addClass('selected');
        $("#labelbox").css("color","#CD0074");
        $(lb).text("materiality of letters").removeClass("displaynone");
      }).mouseout(function () {
        $(materiality).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(hands+hands_c).mouseover(function () {
        $(hands).addClass('selected');
        $("#labelbox").css("color","#A6A600");
        $(lb).text("hands in books").removeClass("displaynone");
      }).mouseout(function () {
        $(hands).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(thirtyyearswar+thirtyyearswar_c).mouseover(function () {
        $(thirtyyearswar).addClass('selected');
        $("#labelbox").css("color","#A6A600");
        $(lb).text("Thirty Years War").removeClass("displaynone");
      }).mouseout(function () {
        $(thirtyyearswar).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(cutups+cutups_c).mouseover(function () {
        $(cutups).addClass('selected');
        $("#labelbox").css("color","#E6399B");
        $(lb).text("cut-ups").removeClass("displaynone");
      }).mouseout(function () {
        $(cutups).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(towerofbabel+towerofbabel_c).mouseover(function () {
        $(towerofbabel).addClass('selected');
        $("#labelbox").css("color","#E667AF");
        $(lb).text("tower of babel").removeClass("displaynone");
      }).mouseout(function () {
        $(towerofbabel).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(leibniz+leibniz_c).mouseover(function () {
        $(leibniz).addClass('selected');
        $("#labelbox").css("color","#679B00");
        $(lb).text("Leibniz's alphabet of human thoughts").removeClass("displaynone");
      }).mouseout(function () {
        $(leibniz).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(computers+computers_c).mouseover(function () {
        $(computers).addClass('selected');
        $("#labelbox").css("color","#A6A600");
        $(lb).text("computers").removeClass("displaynone");
      }).mouseout(function () {
        $(computers).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
   $(permutation+permutation_c).mouseover(function () {
        $(permutation).addClass('selected');
        $("#labelbox").css("color","#E6399B");
        $(lb).text("permutational poetry").removeClass("displaynone");
      }).mouseout(function () {
        $(permutation).removeClass('selected');
        $(lb).text("").addClass("displaynone");
      });
})

	function yourText(id) {
	   $(".back"+id+"").css("display","none");
       $(".page-inner-shadow").clone().insertBefore(".page-inner-shadow").removeClass("page-inner-shadow").load("textwithdots.php?o="+id+"");
	   $(".page-inner").clone().insertBefore(".page-inner").removeClass("page-inner").load("textwithdots.php?o="+id+"");
	}
	function tr(id) {
	   $('.present-topright').hide().removeClass("present-topright");
	   $(".cube"+id+"").clone().css("height","300px").css("width","400px").css("top","22px").css("left","602px").insertAfter(".topright-shadow").addClass('present-topright');
       $('#brh,#tlv').hide();
	   $('#trv').load("toprightvert.php?o="+id+"").show("fast");
	   $('#trh').load("toprighthori.php?o="+id+"").show("fast");
	}
	function tl(id){
	   $('.present-topleft').hide().removeClass("present-topleft");
       $(".cube"+id+"").clone().css("height","300px").css("width","400px").css("top","22px").css("left","182px").insertAfter(".topleft-shadow").addClass("present-topleft");
	   $('#blh,#trv').hide();
	   $('#tlv').load("topleftvert.php?o="+id+"").show("fast");
	   $('#tlh').load("toplefthori.php?o="+id+"").show("fast");
	}
	function br(id) {
	   $('.present-bottomright').hide().removeClass("present-bottomright");
	   $(".cube"+id+"").clone().css("height","300px").css("width","400px").css("top","342px").css("left","602px").insertAfter(".bottomright-shadow").addClass("present-bottomright");
       $('#trh,#blv').hide();
	   $('#brv').load("bottomrightvert.php?o="+id+"").show("fast");
	   $('#brh').load("bottomrighthori.php?o="+id+"").show("fast");
	}
	function bl(id) {
	   $('.present-bottomleft').hide().removeClass("present-bottomleft");
	   $(".cube"+id+"").clone().css("height","300px").css("width","400px").css("top","342px").css("left","182px").insertAfter(".bottomleft-shadow").addClass("present-bottomleft");
       $('#tlh,#brv').hide();
	   $('#blv').load("bottomleftvert.php?o="+id+"").show("fast");
	   $('#blh').load("bottomlefthori.php?o="+id+"").show("fast");
	}
	function loadContentToprightvert(id) {   	   
       tr(id);
	   $('.present-topright').show("slide", { direction: "left" }, 1000);
	   $("#tr").load("text.php?o="+id+"").show("slide", { direction: "left" }, 1000);
	   yourText(id);
	}
	function loadContentToprighthori(id) {
       tr(id);
	   $(".present-topright").show("slide", { direction: "down" }, 1000);
	   $("#tr").load("text.php?o="+id+"").show("slide", { direction: "down" }, 1000);
	   yourText(id);
	}
	function loadContentBottomleftvert(id) {
	   bl(id);
	   $(".present-bottomleft").show("slide", { direction: "right" }, 1000);
	   $("#bl").load("text.php?o="+id+"").show("slide", { direction: "right" }, 1000);
	   yourText(id);
	}
	function loadContentBottomlefthori(id) {  
	   bl(id);
	   $(".present-bottomleft").show("slide", { direction: "up" }, 1000);
	   $("#bl").load("text.php?o="+id+"").show("slide", { direction: "up" }, 1000);
	   yourText(id);
	}
	function loadContentTopleftvert(id) {
	   tl(id);
	   $(".present-topleft").show("slide", { direction: "right" }, 1000);
	   $("#tl").load("text.php?o="+id+"").show("slide", { direction: "right" }, 1000);
	   yourText(id);
	}
	function loadContentToplefthori(id) {
	   tl(id);
	   $(".present-topleft").show("slide", { direction: "down" }, 1000);
	   $("#tl").load("text.php?o="+id+"").show("slide", { direction: "down" }, 1000);
	   yourText(id);
	}
	function loadContentBottomrightvert(id) {
	   br(id);
	   $(".present-bottomright").show("slide", { direction: "left" }, 1000);
	   $("#br").load("text.php?o="+id+"").show("slide", { direction: "left" }, 1000);
	   yourText(id);
	}
	function loadContentBottomrighthori(id) {	
	   br(id);
	   $(".present-bottomright").show("slide", { direction: "up" },1000);
	   $("#br").load("text.php?o="+id+"").show("slide", { direction: "up" }, 1000);
	   yourText(id);
	}
	function hideAll(id) {
	   tl(id);
	   $(".present-topleft").show("slide", { direction: "right" }, 1000);
	   $("#tl").load("text.php?o="+id+"").show("slide", { direction: "right" }, 1000);
	   $("#tr,.present-topright,#br,.present-bottomright,#bl,.present-bottomleft,#trv,#trh,#blv,#blh,#tlv,#tlh,#brv,#brh").hide();	  
	   yourText(id);
	}
