var mc_img = new Array();

function mc_swapImageOver(i)
{
	if (!document.images) return;
	if (!mc_img[i]) return;
	document.images[i].src = mc_img[i].over.src;
}

function mc_swapImageOut(i)
{
	if (!document.images) return;
	if (!mc_img[i]) return;
	document.images[i].src = mc_img[i].out.src;
}

/*******************************************************************/
function its_popupWindow(url,target,width,height,opts)
/*
	Returns: (nothing)

	Required parameters:
	·	url: address of page to load in popup window, usually: this.href
	·	target: the name to give to the new window (for reusing windows)

	Optional parameters:
	·	width: (integer) only used if height is also specified
	·	height: (integer)
	·	opts: (string) specify which elements to display in the window:
			l - location (or address) bar
			m - menu bar (useful for access to the file menu for printing)
			r - resizable (usually this should be specified)
			s - scroll bars (usually this should be specified)
			t - tool bar (back, forward, reload, stop, etc)
			x - status bar

			e.g. 'mrs' means display menu bar, allow window to be resized
			and display scrollbars if content is too big for window
********************************************************************/
{
	var p = null;
	if (width == null || height == null) {
		p = null
	}
	else if (opts == null) {
		p = "width="+width+",height="+height
	}
	else
	{
		p = "width="+width+",height="+height

		opts = opts.toString().toLowerCase();

		if (opts.indexOf("l") >= 0) p += ",location=1"
		if (opts.indexOf("m") >= 0) p += ",menubar=1"
		if (opts.indexOf("r") >= 0) p += ",resizable=1"
		if (opts.indexOf("s") >= 0) p += ",scrollbars=1"
		if (opts.indexOf("t") >= 0) p += ",toolbar=1"
		if (opts.indexOf("x") >= 0) p += ",statusbar=1"
	}

	var x = window.open(url,target,p)
	if (x.focus) x.focus();
}
/*******************************************************************/


/*******************************************************************/
function submitSearch()
/*******************************************************************/
{
	document.all.searchForm.submit();
}
/*******************************************************************/

/*******************************************************************/
function openAuthorWindow(l)
/*******************************************************************/
{
	its_popupWindow(l.href,'author_bio',500,250,'mrs')
}
/*******************************************************************/

/*******************************************************************/
function openMailingListWindow(l)
/*******************************************************************/
{
	its_popupWindow(l.href,'mailing_list',500,350,'mrs')
}
/*******************************************************************/

/*******************************************************************/
function openMoreReviews(l)
/*******************************************************************/
{
	its_popupWindow(l.href,'reviews',500,350,'mrs')
}
/*******************************************************************/

/*******************************************************************/
function openComponentDetails(l)
/*******************************************************************/
{

	its_popupWindow(l.href,'reviews',700,400,'mrs')
}
/*******************************************************************/

/*******************************************************************/
function openInOpener(l)
/*******************************************************************/
{
	if (window.opener) {
		window.opener.location = l.href;
		top.close();
	} else {
		window.open(l.href,'opener');
	}
}
/*******************************************************************/

/*******************************************************************/
function hidePopout()
/*******************************************************************/
{
	if (document.getElementById) {
		document.getElementById("popout").style.display = "none";
	} else if (document.all) {
		eval("document.all.popout").style.display = "none";
	} else {
		alert("Sorry, your browser does not support closing this window.")
	}
}
/*******************************************************************/

/*******************************************************************/
function formatISBNs()
{
	var isbn, isbnNum;
/*******************************************************************/
	var spans = document.getElementsByTagName("span");
	for (var x=0; x < spans.length; x++)
	{
		if (spans[x].className == "isbn")
		{
			isbn = spans[x];
			isbnNum = isbn.innerHTML;
			if (isbnNum.length == 10)
			{
				isbn.innerHTML =
					'<span class="isbn-spaced">' + isbnNum.substring(0,1) + '</span>' +
					'<span class="isbn-spaced">' + isbnNum.substring(1,4) + '</span>' +
					'<span class="isbn-spaced">' + isbnNum.substring(4,9) + '</span>' +
					isbnNum.substring(9,10);

			}
			else if (isbnNum.length == 13)
			{
				isbn.innerHTML =
					'<span class="isbn-spaced">' + isbnNum.substring(0,3) + '</span>' +
					'<span class="isbn-spaced">' + isbnNum.substring(3,7) + '</span>' +
					'<span class="isbn-spaced">' + isbnNum.substring(7,12) + '</span>' +
					isbnNum.substring(12,13);
			}
			else
			{
				isbn.style.color = "#990000";
			}
		}
	}

}
/*******************************************************************/

/*******************************************************************/
function window__onload()
/*******************************************************************/
{
	formatISBNs();

	menu1[menu1.length]='<a href="'+'/catalogue/default.asp">Catalogue Home</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/younglearners/littlebridge.asp">&nbsp; Little Bridge 1 &amp; 2</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/younglearners/young-learners-go.asp">&nbsp; Young Learners Go!</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/younglearners/my-pals-are-here.asp">&nbsp; My Pals Are Here</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/younglearners/ready-to-read.asp">&nbsp; Ready To Read</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/general/just-right.asp">&nbsp; The Just Right Course</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/business/for-business.asp">&nbsp; English for Business Life</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/exams/lcci.asp">&nbsp; Achieve LCCI English for Business</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/exams/bulats.asp">&nbsp; Achieve BULATS</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/exams/ielts.asp">&nbsp; Achieve IELTS</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/grammar/real-english.asp">&nbsp; Real English Grammar</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/readers/readers.asp">&nbsp; Fast Track Classics</a>'
	menu1[menu1.length]='<a href="'+'/catalogue/skills/just-skills.asp">&nbsp; Just Skills</a>'

	mc_img["header_home"] = new Object();
	mc_img["header_home"].over = new Image();
	mc_img["header_home"].over.src = "/images/site/button_home_mouseDown.gif";
	mc_img["header_home"].out = new Image();
	mc_img["header_home"].out.src = "/images/site/button_home.gif";

	mc_img["header_brands"] = new Object();
	mc_img["header_brands"].over = new Image();
	mc_img["header_brands"].over.src = "/images/site/button_brands_mouseDown.gif";
	mc_img["header_brands"].out = new Image();
	mc_img["header_brands"].out.src = "/images/site/button_brands.gif";

	mc_img["header_aboutus"] = new Object();
	mc_img["header_aboutus"].over = new Image();
	mc_img["header_aboutus"].over.src = "/images/site/button_aboutus_mouseDown.gif";
	mc_img["header_aboutus"].out = new Image();
	mc_img["header_aboutus"].out.src = "/images/site/button_aboutus.gif";

}
/*******************************************************************/
window.onload = window__onload;



/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()


var menuwidth='210px' //default menu width
var menubgcolor='#aaaaaa'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

