// JavaScript Document

<!--  Wiley TE V2.0    -->
<!--  JAVA SCRIPT    -->
<!--  		-->
<!--        -->
function addCart(isbn10) {
	var popup = "alwaysRaised=1,width=770,height=550,resizable=1,menubar=0,scrollbars=1";
	if (ENV=="DEV")
		window.location.href = "http://dev.johnwiley.com.au/sc/cart.jsp?isbn10="+isbn10+"&returl="+escape(document.location.toString());
	else if (ENV=="QA")
		window.location.href = "http://qa.johnwiley.com.au/sc/cart.jsp?isbn10="+isbn10+"&returl="+escape(document.location.toString());
	else
		window.location.href = "https://www.johnwiley.com.au/sc/cart.jsp?isbn10="+isbn10+"&returl="+escape(document.location.toString());
//	newwin.document.writeln("Shopping Cart is coming soon ...")
//	newwin.focus();
}

function viewCart() {
	var popup = "width=770,height=550,resizable=1,scrollbars=1";
	if (ENV=="DEV")
		window.location.href = "http://dev.johnwiley.com.au/sc/cart.jsp?returl="+escape(document.location.toString());
	else if (ENV=="QA")
		window.location.href = "http://qa.johnwiley.com.au/sc/cart.jsp?returl="+escape(document.location.toString());
	else
		window.location.href = "https://www.johnwiley.com.au/sc/cart.jsp?returl="+escape(document.location.toString());
//	newwin.document.writeln("Shopping Cart is coming soon ...")
}

function editDetail(lcd,isbn) {
	if (ENV=="DEV")
		window.open("http://webcat-dev.johnwiley.com.au/content_manage.php?type=HE&isbn=" + lcd+isbn, "_WEBCAT");
	else if (ENV=="QA")
		window.open("http://webcat-qa.johnwiley.com.au/content_manage.php?type=HE&isbn=" + lcd+isbn, "_WEBCAT");
	else 
		window.open("http://webcat.johnwiley.com.au/content_manage.php?type=HE&isbn=" + lcd+isbn, "_WEBCAT");
}

function show_Detail(isbn13,wcd) {
	window.open("/highered/engine.jsp?page=titleinfo&all$isbn13="+isbn13);
}

function str_add_bar(Str,f,n) {
	if (Str!="" && f !="") {
			return Str + " | " + n;
	} else if (Str=="" && f!="") {
		return n;
	}
	return Str;
}

function return_SelectValue(mySelect) {
	for (i=0;i<mySelect.length;i++) {
		if (mySelect.options[i].selected)
			return mySelect.options[i].value
	}
	return "";
}
	
function change_select(mySelect, value) {
	selected=0;
	for (i=0;i<mySelect.length;i++) {
		if (mySelect.options[i].value == value) {
			mySelect.options[i].selected = true;
			selected = i;
		}
	}
	mySelect.selectedIndex = selected;
}

function generate_page_numbers(total,rec,currpage) {
	page = 1;
	for (i=1; i<=total; i+=rec) {
		if (page==currpage)
			document.write(page + " ");
		else
			document.write("<a href='javascript:select_page(" + page +")'>" + page + "</a> ");
			
		page++;
	}
}
function generate_prepage(pageno, total,rec) {
	if (pageno>1)
		document.write("<a href='javascript:select_page(" + (pageno-1) +")'>PREV</a> ");
}
function generate_nextpage(pageno, total,rec) {
	if (pageno < (total/rec))
		document.write("<a href='javascript:select_page(" + (pageno+1) +")'>NEXT</a> ");
}

function generate_page_from(pageno, rec) {
	document.write((pageno-1) * rec +1);
}

function generate_page_to(pageno, rec, total) {
	end = pageno * rec ;
	if (end > total)
		end = total
	document.write( end );
}