// JavaScript Document//this is a modified version of nav.js used only for the wordpress blog. It sits in same place (root folder) as nav.js but is called by the header file (header.php) in the wordpress install in the blog/ directory.//these variables are used to find out what page we are onvar filename = location.href.substring(location.href.lastIndexOf('/')+1); //get full name of current pagevar pathname = location.href.substring(0,location.href.lastIndexOf('/'));var dirname = pathname.substring(pathname.lastIndexOf('/')+1);//alert (dirname);if(filename){ //if there is no filename, it must be a directoryvar pagename = "blogpage"; //it's a page in the blog, doesn't matter what it's called}else { pagename='blog';} //if there is no filename, it must be a directory//alert(pagename);if (document.images) {    aboutnav       = new Image();    aboutnav.src   = "../about_nav.png" ;    abouthover     = new Image() ;    abouthover.src = "../about_hover.png" ;	aboutcurrent   = new Image();	aboutcurrent.src = "../about_current.png";		blognav       = new Image();    blognav.src   = "../blog_nav.png" ;    bloghover     = new Image() ;    bloghover.src = "../blog_hover.png" ;	blogcurrent   = new Image();	blogcurrent.src = "../blog_current.png";		projectsnav       = new Image();    projectsnav.src   = "../projects_nav.png" ;    projectshover     = new Image() ;    projectshover.src = "../projects_hover.png" ;	projectscurrent   = new Image();	projectscurrent.src = "../projects_current.png";		squaretanglenav       = new Image();    squaretanglenav.src   = "../index_nav.png" ;    squaretanglehover     = new Image() ;    squaretanglehover.src = "../index_hover.png" ;	squaretanglecurrent   = new Image();	squaretanglecurrent.src = "../index_current.png";}function setImage() { //this sets the appropriate "current" page image in the nav, it is called from an onLoad in the <body> tag of each page	if(document.getElementById(pagename))		{			document.getElementById(pagename).src="../"+pagename+"_current.png";		}//the id of the img needs to be the same as the pagename, eg, if the page is "about.html" then <img id="about"> must be in the loadNav function below. If there is no such img id it will fail the if test, so sub pages work, eg, asx_e_dancer.html will show the nav bar with no "current" image, which is what we want.}function swapImage(id, imgname, swapname) { //rollover function - provide the id of the img tag, the filename of the regular image (imgname) and the filename of the swap-in image (swapimage) in the loadNav function below.	if(id!=pagename)//if id = pagename, there should be no rollover 	{	document.getElementById(id).src=swapname;	}}function makeLink(name, linkid) { //function to work out if the image should be a link - name and linkname are provided in loadNav function below	if(name!=pagename) //if name=pagename it is the current page, so no need for link	{		if(name!='blog') //blog is a directory name, so needs special treatment		{		document.getElementById(linkid).setAttribute('href', '../'+name+'.html'); //set the href to be "name.html", name is provided in loadNav function below		}		else {document.getElementById(linkid).setAttribute('href', '../blog/');} //special treatment for blog because it is a directory not a filename	}}function loadNav() { //loadNav writes html to construct the nav bar and provide names for the above functions - single quotes are escaped with a backslash. This function is called on each individual html page.document.write('<div class="nav"> <div class="navlink"><a onMouseOver="makeLink(\'blog\',\'bloglink\');swapImage(\'blog\',\'../blog_nav.png\',\'../blog_hover.png\')" onMouseOut="swapImage(\'blog\',\'../blog_hover.png\',\'../blog_nav.png\')" id="bloglink"><img src="../blog_nav.png" alt="blog" id="blog" width="55" height="17" border="0" /></a> | <a onMouseOver="makeLink(\'about\',\'aboutlink\');swapImage(\'about\',\'../about_nav.png\',\'../about_hover.png\')" onMouseOut="swapImage(\'about\',\'../about_hover.png\',\'../about_nav.png\')" id="aboutlink"><img src="../about_nav.png" alt="about" id="about" width="69" height="17" border="0" /></a> | <a onMouseOver="makeLink(\'projects\',\'projectslink\');swapImage(\'projects\',\'../projects_nav.png\',\'../projects_hover.png\')" onMouseOut="swapImage(\'projects\',\'../projects_hover.png\',\'../projects_nav.png\')" id="projectslink"><img src="../projects_nav.png" alt="projects" id="projects" width="113" height="17" border="0" /></a></div><div class="navhometext"><a onMouseOver="makeLink(\'index\',\'indexlink\');swapImage(\'index\',\'../index_nav.png\',\'../index_hover.png\')" onMouseOut="swapImage(\'index\',\'../index_hover.png\',\'../index_nav.png\')" id="indexlink"><img src="../index_nav.png" alt="squaretangle" id="index" width="173" height="17" border="0" /></a></div></div>')}