/*google analytics*/
function loadScript(url){ document.write('<script src="', url, '" type="text/javascript"></script>');}
loadScript("http://www.google-analytics.com/urchin.js");

var fWin = null;

function openFeedback()
{
	var url = '/wps/media/objects/4879/4996309/feedback/wlfeedback.html';
	if (!fWin || fWin.closed)
	{
		fWin = window.open(url,'Feedback', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=520,height=400');
	}
	else
	{
		fWin.location = url;
		fWin.focus();
	}
}

/*-------- FAQs ------------*/
// This function is used to check whether a list/menu item is in the collapsed or expanded mode.
function faqsMenuSwitch(question, answer)
{
	var questionElement = document.getElementById(question); // The question clicked.
	var answerStyle =document.getElementById(answer).style; // The style of the answer for the question clicked.
	
	if (answerStyle.display == 'none') // If the list/menu item clicked is currently in collapsed mode...
	{
		expandFAQsMenu(questionElement, answerStyle); // ...then expand it.
	}
	else
	{
		collapseFAQsMenu(questionElement, answerStyle); // Otherwise, collapse it.
	}
}
	
var collapseText = 'Click to hide the answer';
var expandText = 'Click to display the answer';

// This function expands the list/menu item clicked and changes the '+' sign to the '-' sign. It also changes the title text of the '-' sign.
function expandFAQsMenu(questionElement, answerStyle)
{
	questionElement.title = collapseText;
	answerStyle.display = 'block';
}

// This function collapses the list/menu item clicked and changes the '-' sign to the '+' sign. It also changes the title text of the '+' sign.
function collapseFAQsMenu(questionElement, answerStyle)
{
	questionElement.title = expandText;
	answerStyle.display = 'none';
}

/*---------- Glossary ---------*/
function openGloss()
{
	var glossaryPath = 'http://media.pearsoncmg.com/bc/bc_moyes_animalphys_2/glossary/index.html';
	var glossWin = window.open(glossaryPath, 'glossary', 'location=no,menubar=no,resizable=no,status=no,toolbar=no,width=600,height=550');
	if (glossWin.opener == null)
	{
		glossWin.opener = window;
	}
	glossWin.focus();	
}

/*--------- Flashcards ----------*/
function openFlash()
{
	var flashPath = 'http://media.pearsoncmg.com/bc/bc_moyes_animalphys_2/flashcards/index.html';
	var flashWin = window.open(flashPath, 'flashcards', 'location=no,menubar=no,resizable=no,status=no,toolbar=no,width=670,height=525');
	if (flashWin.opener == null)
	{
		flashWin.opener = window;
	}
	flashWin.focus();
}

/*-------- Site Reqs ---------*/
var minWidth=1024;
var minHeight=768;

function writeMinScreenRes()
{
	document.write(minWidth + ' x ' + minHeight + ' screen resolution');
}

function writeScreenResMsg()
{
	if (screen.width < minWidth || screen.height < minHeight)
	{
		document.write("This site requires a minimum screen resolution of <span class='greenFont'>" + minWidth + " x " + minHeight + "<\/span> pixels. Your current resolution is <span class='greenFont'>" + screen.width + " x "+ screen.height + "<\/span> pixels.<ul><li>Macintosh users adjust the screen resolution in the <em>Monitors Control Panel<\/em>.<\/li><li>Windows users, go to <em>Settings &#62; Control Panel &#62; Display &#62; Settings<\/em>.<\/li><\/ul>");
	}
	else
	{
		document.write("This site requires a minimum screen resolution of <span class='greenFont'>" + minWidth + " x " + minHeight + "<\/span> pixels. Your current resolution is <span class='greenFont'>" + screen.width + " x " + screen.height + "<\/span> pixels and meets requirements.");
	}
}

/*-------- Instructor Resources ---------*/
function writeIRLink(irType, chapNum, fileName)
{
	/* irType can be one of the following:
		'aa' = All Art
		'lr' = Lecture Resources
		'tb' = Test Bank
	*/
	
	var msFilePath = 'http://media.pearsoncmg.com/bc/bc_moyes_animalphys_2/ir/';
	if (irType == 'aa' || irType == 'lr')
	{
		msFilePath += 'mm/' + chapNum + '/' + fileName.toLowerCase();
	}
	else
	{
		msFilePath += 'tb/' + chapNum + '/' + fileName.toLowerCase();
	}
	
	var irWindow = window.open(msFilePath, 'irWin', 'location=no');
	if (irWindow.opener == null)
	{
		irWindow.opener = window;
	}
	irWindow.focus();
}
