// - ###############################################################################
//    GLOBAL TEXT FOR PROMPTS, ALERTS, and CONFIRMS
// -

//uncomment appropriate line (true include ID, false do not include id)
//GLOBAL_TEXT_INCLUDE_ID = true;
GLOBAL_TEXT_INCLUDE_ID = false;

GLOBAL_TEXT = new Array();

GLOBAL_TEXT['GT006'] = "Page not found";
GLOBAL_TEXT['GT007'] = "Please enter the page number.";
GLOBAL_TEXT['GT008'] = "Are you sure you want to close this book?";
GLOBAL_TEXT['GT009'] = "This page cannot be printed.";
GLOBAL_TEXT['GT010'] = "This is no homework for this page.";

GLOBAL_TEXT['GT012'] = "This page does not have a associated resource on Education Place.";
GLOBAL_TEXT['GT013'] = "This is the first page.";
GLOBAL_TEXT['GT014'] = "This is the last page.";

GLOBAL_TEXT['GT021'] = "The page cannot be made larger.";
GLOBAL_TEXT['GT022'] = "The page cannot be made smaller.";

GLOBAL_TEXT['GT025'] = "Both pages cannot be displayed.";

GLOBAL_TEXT['GT050'] = "There is no Read Aloud audio for this page.";
GLOBAL_TEXT['GT051'] = "This is the first track.";
GLOBAL_TEXT['GT052'] = "This is the last track.";
GLOBAL_TEXT['GT053'] = "The track is already rewound.";
GLOBAL_TEXT['GT054'] = "There is no audio to read aloud on this page.";
GLOBAL_TEXT['GT055'] = "The audio is stopped.";

// -
//    GLOBAL CONSTANTS
// - ###############################################################################

// getGlobalText
// getGlobalText(globalTextID : string) : string

function getGlobalText(globalTextID) {

	var globalText = GLOBAL_TEXT[globalTextID];
	
	if (GLOBAL_TEXT_INCLUDE_ID) {
		globalText += ' [' + globalTextID + ']';
	}

	return globalText;
	
} // getGlobalText

COOKIE_EBOOK_REGISTERED = 'eSSBookRegistered';
COOKIE_EBOOK_STATE_NAME = 'eSSBookStateName';
COOKIE_EBOOK_STATE_ABBR = 'eSSBookStateAbbr';

function cookieVal(cookieName)
{
	thisCookie = document.cookie.split("; ")
	for (i=0; i<thisCookie.length; i++)
		{
		if (cookieName == thisCookie[i].split("=")[0])
			{
			return thisCookie[i].split("=")[1]
			}
		}
	return 0;
}

function setCookie(name, value)
{
	// set expiration 1 year in future
	var expireDate= new Date();
	expireDate.setFullYear(expireDate.getFullYear() + 1);
	var expString = "";
	if (expireDate != null) {
		if (expireDate.toGMTString) {
			expString = "; expires=" + expireDate.toGMTString();
		} else if (expireDate.toUTCString) {
			expString = "; expires=" + expireDate.toUTCString();
		}
	}
	// set path to root
	pathStr = "; path=/";

	// set domain to .eduplace.com if web-based
	if (window.location.hostname.indexOf('eduplace.com') != -1) {
		domainStr = "; domain=.eduplace.com";
	} else {
		domainStr = '';
	}

	// set cookie
	document.cookie = escape(name) + "=" + escape(value) + expString + pathStr + domainStr + "; ";
} 

function calltip(whereto,width,height)
{
//if (! height) {height = 650};

var height = screen.width-50;

if (navigator.userAgent.match(/Mac/))
	{if (! width) {width = 751};}
else
	{if (! width) {width = 768};}

var wheretostring = "(" + whereto + ")";
var left = (screen.width/2) - (width/2);
var top = (screen.height/2) - (height/2);

var left = 5;
var top = 5;

var boilerplate = " channelmode = no, directories = no, fullscreen = no, location = no, menubar = no, resizable = yes, scrollbars = yes, status = no, titlebar = no, toolbar = no";
var w = window.open(whereto,"popup",'width=' + width + ', height=' + height + ' top=' + top + ' left=' + left + boilerplate);

return w;
//window.open(whereto,"_blank",'width=' + width + ', height=' + height + ' top=' + top + ' left=' + left + boilerplate);
}

function LightButton(ImageObject)
{
if (ImageObject.src.indexOf("-disabled") < 0) 
	{
	document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + "-lit.gif";
	}
}

function UnlightButton(ImageObject)
{
if (ImageObject.src.indexOf("-disabled") < 0) 
	{
	document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + ".gif";
	}
}

function LightActiveButton(ImageObject) {
	if (ImageObject.src.indexOf("-disabled") < 0) {
		if (ImageObject.src.indexOf("-active") < 0) {
			document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + "-lit.gif";
		} else {
			document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + "-active-lit.gif";
		}
	}
}

function UnlightActiveButton(ImageObject) {
	if (ImageObject.src.indexOf("-disabled") < 0) {
		if (ImageObject.src.indexOf("-active") < 0) {
			document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + ".gif";
		} else {
			document[ImageObject.name].src = "../../common/graphics/nav/buttons/" + ImageObject.name + "-active.gif";
		}
	}
}

function DisableButton(ButtonName)
{
document[ButtonName].src = "../../common/graphics/nav/buttons/" + ButtonName + "-disabled.gif";
//alert("Disabled "+document[ButtonName].src);
}

function EnableButton(ButtonName)
{
document[ButtonName].src = "../../common/graphics/nav/buttons/" + ButtonName + ".gif";
//alert("Enabled "+document[ButtonName].src);
}

function ActivateButton(ButtonName)
{
document[ButtonName].src = "../../common/graphics/nav/buttons/" + ButtonName + "-active.gif";
//alert("Activated "+document[ButtonName].src);
}


