var descripLen = 170;
var titleLen = 40;
var authLen = 30;
	
if(parseInt($("#bookContainer.items .book").size()) >= 3){
	$(".items .book:gt(" + (parseInt($("#bookContainer.items .book").size())-2) + ")").clone().prependTo(".items");
		$(".items").attr("style", "left:-82px;_left:-105px;");
		/*$(".items").css("_left","-105px");*/
}
else{
	$(".items").attr("style","left:125px;");
}
//alert("Hello World");
var urlVars = getUrlVars();
var animInProgress = false;


if(urlVars['uid'] != null){
	customPopUp($("#user_validation"));
}

var shufflePaneWidth = 840; //$("#flowpanes").css("width"); //
var first_position = parseInt($(".items").css("left"));



function getUrlVars()
{
	var vars = [], hash;
	var hashes = parent.location.href.slice(parent.location.href.indexOf('?') + 1).split('&');
 
	for(var i = 0; i < hashes.length; i++)
	{
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}
 
	return vars;
}
	
function customPopUp(popObj){

	//var popObj = $("#user_validation");
	
	//Get the screen height and width  
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();

	//Set height and width to mask to fill up the whole screen
	$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
	
	
	//transition effect
	$('#mask').fadeTo(500, 0.5, function () {
		
		//Get the window height and width  
		var winH = $(window).height();
		var winW = $(window).width();

		//Set the popup window to center  
		$(popObj).css('top', winH / 5 - 120);
		$(popObj).css('left', winW / 2 - ($(popObj).width() / 2 - 39));

		//transition effect
		$(popObj).show();   
		
		$(popObj).removeClass("windowClosed");
		$(popObj).addClass("windowOpen");
		
	});
}
	

function openPopUp(popObj){
	//alert(popObj);
	if (popObj == 'welcomeContent') {
		document.getElementById('myflashBoxHiddenW').style.display='block';
	} else if (popObj == 'babiesToddlersAboutContent') {
		document.getElementById('myflashBoxHiddenBT').style.display='block';
	} else if (popObj == 'middleGradersAboutContent') {
		document.getElementById('myflashBoxHiddenMG').style.display='block';
	} else if (popObj == 'teenAboutContent') {
		document.getElementById('myflashBoxHiddenYA').style.display='block';
	}
	document.getElementById('myflashBox').style.visibility='hidden';
	customPopUp($("#"+popObj));
}

function closePopUp(popObj){
	document.getElementById(popObj).style.display='none';
	
	document.getElementById('myflashBoxHiddenW').style.display='none';
	document.getElementById('myflashBoxHiddenBT').style.display='none';
	document.getElementById('myflashBoxHiddenMG').style.display='none';
	document.getElementById('myflashBoxHiddenYA').style.display='none';
	document.getElementById('myflashBox').style.visibility='visible';

	$(popObj).removeClass("windowOpen");
	$(popObj).addClass("windowClosed");

	$("#mask").fadeOut(500);
}


function showWelcome(x) {
	//alert(x);
	document.getElementById('welcome1').style.display='none';
	document.getElementById('welcomeLink1').style.textDecoration='none';
	document.getElementById('welcome2').style.display='none';
	document.getElementById('welcomeLink2').style.textDecoration='none';
	document.getElementById('welcome3').style.display='none';
	document.getElementById('welcomeLink3').style.textDecoration='none';
	if (x=='3') {
		document.getElementById('welcome3').style.display='block';
		document.getElementById('welcomeLink3').style.textDecoration='underline';
	}else if (x=='2') {
		document.getElementById('welcome2').style.display='block';
		document.getElementById('welcomeLink2').style.textDecoration='underline';
	}else{
		document.getElementById('welcome1').style.display='block';
		document.getElementById('welcomeLink1').style.textDecoration='underline';
	}
}

