// JavaScript Document
function toggleImage(img) {
			var src1 = img.getAttribute("SRC1"),
			src2 = img.getAttribute("SRC2")
			with (img) src = new RegExp(src1).test(src) ?
			src.replace(src1,src2) : src.replace(src2,src1)
		}

		function MM_openBrWindow(theURL,winName,features) { //v2.0
		  window.open(theURL,winName,features);
		}
		
		// this function highlights the box on the left of segment headers with the appropriate color
		function highlight(hiliteBox, state) {
			if (state=="on"){
				document.getElementById(hiliteBox).style.backgroundColor = "#D44343";
			}else{
				document.getElementById(hiliteBox).style.backgroundColor = "#E4E5D7";
			}
			return false;
		}
		
		// Right navigation menu reveal function
		if (document.getElementById) {
			document.write('<style type="text/css">\n')
			document.write('.rightnav_submenu{display: none;}\n')
			document.write('</style>\n')
		}
		
		function SwitchMenu(obj){
			if(document.getElementById){
			var el = document.getElementById(obj);
			var ar = document.getElementById("masterdiv").getElementsByTagName("span");
				if(el.style.display != "block"){
					for (var i=0; i<ar.length; i++){
						if (ar[i].className = "rightnav_submenu")
						ar[i].style.display = "none";
					}
					el.style.display = "block";
				}else{
					el.style.display = "none";
				}
			}
		}
		
		// Right navigation menu2 reveal function
		
		if (document.getElementById) {
			document.write('<style type="text/css">\n')
			document.write('.rightnav_submenu2{display: none;}\n')
			document.write('</Style>\n')
		}
		
		function SwitchMenu(obj){
			if(document.getElementById){
				var el = document.getElementById(obj);
				var ar = document.getElementById("masterdiv2").getElementsByTagName("span");
				if(el.style.display != "block"){
					for (var i=0; i<ar.length; i++){
						if (ar[i].className = "rightnav_submenu2")
						ar[i].style.display = "none";
					}
					el.style.display = "block";
				}else{
					el.style.display = "none";
				}
			}
		}
		
		// Alex Kirsch ->developer
		// Digital MediaVision
		// December 12, 2002
		
		function toggleSearch(imageName) {// Purpose: Toggle between searching options
			var btnSRC = document.images[imageName].src; // Grab the SRC reference
			btnSRC = btnSRC.split('/'); // Convert the sting to an array to isolate btn SRC
			var btnLength = btnSRC.length; 
			var btn = btnSRC[btnLength - 1]; // Identify the btn gif src that is being clicked 
			var on = 'checkbox_on.gif';
			var off = 'checkbox_off.gif';
			HWYLTS = ['author', 'isbn', 'title', 'searchAll']; // How would you like to search? Option Array
			
			switch (imageName){
			
				// If ALL TITLES btn is selected
				// ALL TITLES btn is SELECTED by DEFAULT
				case 'allTitles':
				if (btn == on) {// toggles off ALL TITLES btn
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				document.images['bkCompanion'].src = 'images/forms/checkbox_on.gif';
				}else{
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
				document.images['bkCompanion'].src = 'images/forms/checkbox_off.gif';
				}
				break;
				
				// if BOOK COMPANION btn is selected
				case 'bkCompanion':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
				document.images['allTitles'].src = 'images/forms/checkbox_off.gif';
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				document.images['allTitles'].src = 'images/forms/checkbox_on.gif';
				}
				break;
				
				// if CURRENT DISCIPLINE btn is selected
				// CURRENT DISCIPLIE is SELECTED by DEFAULT
				case 'currentDiscipline':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
				document.images['allDisciplines'].src = 'images/forms/checkbox_off.gif';
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				document.images['allDisciplines'].src = 'images/forms/checkbox_on.gif';
				}
				break;
				
				// if ALL DISCIPLINES btn is selected
				case 'allDisciplines':
				if (btn == on) {
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				document.images['currentDiscipline'].src = 'images/forms/checkbox_on.gif';
				}else{
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
				document.images['currentDiscipline'].src = 'images/forms/checkbox_off.gif';
				}
				break;
				
				// if SEARCH ALL btn is selected
				// SEARCH ALL is SELECTED by DEFAULT
				case 'searchAll':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
					// Turn off all the other btns except the one selected
					for (i=0; i < HWYLTS.length ; i++) {
						if (HWYLTS[i] != imageName) {
						document.images[HWYLTS[i]].src = 'images/forms/checkbox_off.gif';
						}
					}
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				}
				break;
				
				// if AUTHOR btn is selected
				case 'author':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
					// Turn off all the other btns except the one selected
					for (i=0; i < HWYLTS.length ; i++) {
						if (HWYLTS[i] != imageName) {
						document.images[HWYLTS[i]].src = 'images/forms/checkbox_off.gif';
						}
					}
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				}
				break;
				
				// if TITLE btn is selected
				case 'title':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
					// Turn off all the other btns except the one selected
					for (i=0; i < HWYLTS.length ; i++) {
						if (HWYLTS[i] != imageName) {
						document.images[HWYLTS[i]].src = 'images/forms/checkbox_off.gif';
						}
					}
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				}
				break;
				
				// if ISBN btn is selected
				case 'isbn':
				if (btn == off) {
				document.images[imageName].src = 'images/forms/checkbox_on.gif';
					// Turn off all the other btns except the one selected
					for (i=0; i < HWYLTS.length ; i++) {
						if (HWYLTS[i] != imageName) {
						document.images[HWYLTS[i]].src = 'images/forms/checkbox_off.gif';
						}
					}
				}else{
				document.images[imageName].src = 'images/forms/checkbox_off.gif';
				}
				break;
			}
		
		}
		
		function gotomail_URL() {
			var subscription_option = document.myform.subscription_option.options[document.myform.subscription_option.selectedIndex].value;
			var email_address =   document.myform.email_address.value;
			if( email_address == ''){
				alert ("Please enter an email address");
				return false;
			}
			var server_name = "<TMPL_VAR NAME=server_name>";
			var action = "<TMPL_VAR NAME=action>";
			var before_question_mark = "http://"+server_name+action;
			var after_question_mark = "fid=M53&discipline_number=<TMPL_VAR NAME=discipline_number>&subscription_option="+subscription_option+"&email_address="+email_address;
			var theURL = before_question_mark+"?"+after_question_mark;
			var features = 'menubar=yes,scrollbars=yes,resizable=yes,width=620,height=500';
			bud = window.open(theURL,"popit3",features);
			bud.focus();
			}
		
		
				function setval() {

						var chosen_value = event.srcElement.value;
						
						document.product.value = chosen_value;
					}
					
					
					function navigate() {
						if (document.product.value==0) {
						location ="Instructor.htm";
						}
						else {
							location = "student.htm";
						}
					}
					
					function navigateprod(num) {
						
						if (num==0) {
						location ="Instructor.htm";
						}
						if(num==1) {
							location = "student.htm";
						}
						if(num==2) {
							alert("PLEASE CHOOSE AN OPTION");
						}
					}
					
					
					function navigatecomp(num) {
						
						if (num==0) {
						location ="http://www.brookscole.com/cgi-wadsworth/course_products_wp.pl?fid=M20bI&discipline_number=22&subject_code=&product_isbn_issn=0495015997";
						}
						else {
							location = "http://www.brookscole.com/cgi-wadsworth/course_products_wp.pl?fid=M20b&discipline_number=22&subject_code=&product_isbn_issn=053440653X";
						}
					}
					
					
					function setcopyrightval(){
					 document.mainForm.viewproduct.value = event.srcElement.value;
					}
					
					
					function copyright(){
					 if(document.mainForm.viewproduct.value==1){
						 location ="prolistcopyright.htm";
						 }
					 if(document.mainForm.viewproduct.value==0){
						 location ="productCompanionList.htm";
						 }						 
					}
					
					function topicchange(){
						
						document.mainForm.topic.value=event.srcElement.value;
					}
					
					function topicmove(){
						alert("LIST THE PRODUCTS CORRESPONDING TO THE SELECTED TOPIC");
						if(document.mainForm.topic.value==1){
						 location ="productList.htm##ResourcesM";						
						}
						if(document.mainForm.topic.value==2){
						 location ="productList.htm#ResourcesBP";												
						}
						if(document.mainForm.topic.value==3){
						 location ="productList.htm#Resources";												
						}
						if(document.mainForm.topic.value==0) {
						 alert("PLEASE CHOOSE AN OPTION");
						}
						
					}
					
					function sortingval(){
						
						document.mainForm.sortby.value=event.srcElement.value;
					}
					
					function sorting(){
						if(document.mainForm.sortby.value==1){
						 alert("LIST THE PRODUCTS BY TITLE" );
						 location ="productList.htm";						
						}
						if(document.mainForm.sortby.value==2){
						 alert("LIST THE PRODUCTS ON THE BASIS OF COPYRIGHT YEAR");
						 location ="productCopyRight.htm";												
						}
						if(document.mainForm.sortby.value==0) {
						 alert("LIST THE PRODUCTS BY AUTHOR NAME" );
						 location = "#";
						}
						
					}
					
					
					
					function courseAlert() {
						alert("LIST THE PRODUCTS CORRESPONDING TO SELECTED COURSE");
					}
					
		
						function rcopyrightval(value){
								if(value==0){
									alert("List The Products on the Show New Text basis");
								}else{
									alert("List The Products on the Companion Sites basis"); 
															  
								}
							}
					
					
						function sortingval(){
								document.mainForm.sortby.value=event.srcElement.value;
							}
					
					
						function sorting(){
								if(document.mainForm.sortby.value==1){
								 alert("List The Products by Title" );
								}
								if(document.mainForm.sortby.value==2){
								 alert("List The Products on the  Basis of copyright year");
								}
								if(document.mainForm.sortby.value==0) {
								 alert("List The Products By Author Name" );
								 location = "#";
								}
							}					
					
					
					function abtProdSel(){
						document.mainForm.abtProdSelvalue.value = event.srcElement.value;
					}
					
