jQuery(document).ready(function(){
if(location.href.match("#") != "null"){
var hashSection = location.href;
var index = hashSection.indexOf("#");
hashSection = hashSection.substring(index,hashSection.length);
var moves = "";
if(hashSection == "#cell0page0"){
moves = 0;}
else if(hashSection == "#cell1page0"){
moves = 1}
if(moves != ""){
for(i = 0; i < moves; i++){
slidepage0("right");}}}
jQuery(".portalpage0").animate({opacity:"1"},"slow").fadeIn();

function slidepage0(direction){
var peeker = jQuery("div[@id^=yespage0]");

var classLength = jQuery(peeker).attr("class").length;

if(direction == "left"){
if(parseInt(peeker.attr("class").substring(9,classLength)) == (0)){
jQuery(peeker).attr("id","nopage0");
jQuery(".cellpage01").attr("id","yespage0");
jQuery(".leftpage0").animate({opacity: "1"}, "fast");
jQuery(".leftpage0").css("cursor","pointer");
jQuery(".tubepage0").animate({left: "+=968"},2000, function(){
jQuery(this).css("display","none");})
.animate({left: "-=2904"},"fast", function(){jQuery(this).css("display","block");}).animate({left: "+=968"},2000);}

else{
var classLength = jQuery(peeker).attr("class").length;

var nextLeft = ".cell" + "page0" + (parseInt(jQuery(peeker).attr("class").substring(9,classLength)) - 1);
jQuery(peeker).attr("id","nopage0");
jQuery(nextLeft).attr("id","yespage0");
if((parseInt(jQuery(nextLeft).attr("class").substring(9,classLength))) == 0){
jQuery(".leftpage0").animate({opacity: "0"}, "fast");
jQuery(".leftpage0").css("cursor","auto");}
jQuery(".tubepage0").animate({left: "+=968"},2000);}}

if(direction == "right"){
var peeker = jQuery("div[@id^=yespage0]");
var classLength = jQuery(peeker).attr("class").length;

if(parseInt(peeker.attr("class").substring(9,classLength)) == 1){
jQuery(peeker).attr("id","nopage0");
jQuery(".cellpage00").attr("id","yespage0");
jQuery(".leftpage0").animate({opacity: "0"}, "fast");
jQuery(".leftpage0").css("cursor","auto");
jQuery(".tubepage0").animate({left: "-=968"},2000, function(){jQuery(this).css("display","none");})
.animate({left: "+=2904"},"fast", function(){jQuery(this).css("display","block");}).animate({left: "-=968"},2000);}

else{
var classLength = jQuery(peeker).attr("class").length;

var nextRight = ".cell" + "page0" + (parseInt(jQuery(peeker).attr("class").substring(9,classLength)) + 1);
jQuery(peeker).attr("id","nopage0");
jQuery(nextRight).attr("id","yespage0");
jQuery(".leftpage0").animate({opacity: "1"}, "fast");
jQuery(".leftpage0").css("cursor","pointer");
jQuery(".tubepage0").animate({left: "-=968"},2000);}
}}

jQuery(".leftpage0").click(function(){
slidepage0("left");});
jQuery(".rightpage0").click(function(){
slidepage0("right");});
});
