var catlink="",cattitle="",categorydd="",booklist="",tchbooklist="",bookinfo="",thebook="",title="",isbn="",booktag="",loc="",curloc="",wwwcurloc="",folderloc="",wwwfolderloc="",mobile="",teacher="",thestr="",strinfo="",s="",cattitlediv="",cattitledivstr="",pass="",user="",url="",sitecount=0;
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18588265-2']);
_gaq.push(['_trackPageview']);
(function() {
  var ga=document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src=('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s=document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function shownav(){
categorydd=document.getElementById("categorydd");
if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest()}
else{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}
url="http://www.g-wlearning.com/Scripts/navigation.xml";
var strUrl=window.location.href;
strUrl=strUrl.substring(0,22);
if (strUrl=="http://g-wlearning.com"){url="http://g-wlearning.com/Scripts/navigation.xml";}
xmlhttp.open("GET",url,false);
xmlhttp.send("");
xmlDoc=xmlhttp.responseXML;
category=xmlDoc.getElementsByTagName("category");
 for(var k=0;k<category.length;k++){
	catlink=category.item(k).attributes.getNamedItem("link").value;
	cattitle=category.item(k).attributes.getNamedItem("cattitle").value;
	user=category.item(k).attributes.getNamedItem("user").value;
	categorydd.options[categorydd.options.length] = new Option(cattitle, "http://www.g-wlearning.com/"+catlink+"/index.htm");
	loc=window.location.href;
	wwwcurloc="http://g-wlearning.com/"+catlink+"/index.htm";
	curloc="http://www.g-wlearning.com/"+catlink+"/index.htm";
	wwwfolderloc="http://g-wlearning.com/"+catlink+"/";
	folderloc="http://www.g-wlearning.com/"+catlink+"/";
	var CADloc=curloc.toLowerCase();
	var CADfolderloc=folderloc.toLowerCase();
	if (loc==curloc||loc==wwwcurloc||loc==folderloc||loc==wwwfolderloc||loc==CADloc||loc==CADfolderloc){
		cattitlediv=document.getElementById("cattitle");
		booklist=document.getElementById("booklist");
		booklist.innerHTML="";
		thestr="";
      	if (category[k].childNodes.length){
			booktag=category[k].getElementsByTagName('book');
			for (i=0;i<booktag.length;i++){
          		thebook=category[k].getElementsByTagName('book')[i];
          		title=thebook.getElementsByTagName('title')[0].childNodes[0].nodeValue;
          		isbn=thebook.getElementsByTagName('isbn')[0].childNodes[0].nodeValue;
          		teacher=thebook.getElementsByTagName('teacher')[0].childNodes[0].nodeValue;
          		mobile=thebook.getElementsByTagName('mobile')[0].childNodes[0].nodeValue;
				if (isbn!='marketingdynamics'){
					if (isbn!='9781605253305'&&isbn!='9781605251639'&&isbn!='9781605255651'){
						thestr=thestr+"<div class='book'>\n<img alt='"+title+"' src='http://www.g-wlearning.com/images/"+isbn+".png' /><br />"+title+"\n<div class='booklinks'><a href='"+
						   folderloc+isbn+"/student/index.htm'>student</a>";sitecount+=1;
						if (mobile=="true"){
							var mobisbn=isbn.substring(isbn.length-4,isbn.length);
							thestr=thestr+" | <a href='http://m.g-wlearning.com/"+mobisbn+"/index.htm'>mobile</a>\n";sitecount+=1;
						}
						if (teacher=="true"){
							thestr=thestr+" | <a href='"+folderloc+isbn+"/'>teacher</a></div>\n</div>\n";sitecount+=1;
						}else{thestr=thestr+"</div>\n</div>\n";}
					}else{
						thestr=thestr+"<div class='book'><img alt='"+title+"' src='http://www.g-wlearning.com/images/"+isbn+".png' /><br />"+title+"\n<div class='booklinks'>"+
						"<a href='http://www.g-wlearning.com/CAD/"+isbn+"/index.htm'>student</a></div></div>";sitecount+=1;}
				}
				else{
					thestr=thestr+"<div class='book'><img alt='"+title+"' src='http://www.g-wlearning.com/images/9781590705865.png' /><br />"+title+"\n<div class='booklinks'>"+
					"<a href='http://www.g-wlearning.com/marketingdynamics/student/index.htm'>student</a> | "+
					"<a href='http://www.g-wlearning.com/marketingdynamics/'>teacher</a></div></div>";sitecount+=2;
				}
			}if (sitecount>1){s="s";}else{s="";}
			 cattitledivstr="<img src='http://www.g-wlearning.com/images/sectionR.png' alt='' style='width:5px;height:50px' /><div class='category'>"+cattitle+"</div>Companion Website"+s;
			 cattitlediv.innerHTML=cattitledivstr;
      	}
		booklist.innerHTML=thestr;
	}else{ try{
		cattitlediv=document.getElementById("cattitle");
		tchbooklist=document.getElementById("tchbooklist");
		bookinfo=document.getElementById("bookinfo");
		tchbooklist.innerHTML="";
		bookinfo.innerHTML="";
      	if (category[k].childNodes.length){
			booktag=category[k].getElementsByTagName('book');
			for (j=0;j<booktag.length;j++){
          		thebook=category[k].getElementsByTagName('book')[j];
          		title=thebook.getElementsByTagName('title')[0].childNodes[0].nodeValue;
          		isbn=thebook.getElementsByTagName('isbn')[0].childNodes[0].nodeValue;
          		teacher=thebook.getElementsByTagName('teacher')[0].childNodes[0].nodeValue;
          		pass=thebook.getElementsByTagName('pass')[0].childNodes[0].nodeValue;
				if (loc==(folderloc+isbn+"/")||loc==(folderloc+isbn+'/index.htm')||loc==(folderloc+isbn+'/index.php')||loc==(wwwfolderloc+isbn+"/")||loc==(wwwfolderloc+isbn+'/index.htm')||loc==(wwwfolderloc+isbn+'/index.php')||loc=="http://www.g-wlearning.com/"+isbn+"/"){
					thestr="";strinfo="";
					cattitledivstr="<img src='http://www.g-wlearning.com/images/sectionR.png' alt='' style='width:5px;height:50px' /><div class='category'>"+cattitle+"</div>Companion Website";
			 		cattitlediv.innerHTML=cattitledivstr;
					if (isbn!='9781605253305'&&isbn!='9781605251639'&&isbn!='9781605255651'){
						if (isbn=='marketingdynamics'){thestr=thestr+"<div class='tchbook'><img alt='"+title+"' src='http://www.g-wlearning.com/images/9781590705865.jpg' /></div>"}
						else{thestr=thestr+"<div class='tchbook'>\n<img alt='"+title+"' src='http://www.g-wlearning.com/images/"+isbn+".jpg' />\n</div>\n";}
						if (teacher=="true"){
							strinfo=strinfo+"<h2>"+title+"</h2><h3>Teacher Companion Website</h3><br /><div class='left'>To log in, please enter the user name &quot;"+user+
							"&quot; and the password when prompted.  The password is the last word located on "+pass+".<br /><br /><br /><br /></div>"+
							"<a href='teacher/index.htm'><img src='http://www.g-wlearning.com/images/teacher_login.jpg' alt='Teacher Login' title='Teacher Login' /></a>";
						}else{strinfo=strinfo+"<h2>"+title+"</h2><h3>Student Companion Website</h3><br />"}
					}else{
						thestr=thestr+"<div class='tchbook'><img name='myimg' alt='"+title+"' src='../../images/"+isbn+".jpg' />\n</div>";
						strinfo=strinfo+"\n<h2>"+title+"</h2><br /><div class='left'>"+pass+"</div>";}
				}
			}
		}
		bookinfo.innerHTML=strinfo;
		tchbooklist.innerHTML=thestr;
		} catch(err){}
	}
  }
}
