


function fixatags()
	{
		// Fixes links for testing on local system
		if(location.hostname != "localhost") return;
		var linkobjs = document.getElementsByTagName("a");
		var thislink;
		var thispath;
		for(i = 0; i<linkobjs.length; i++)
		{
			if(linkobjs[i]!="") {
				thispath = linkobjs[i].pathname;
				if(linkobjs[i].hostname == "localhost" && thispath!=null)
				{
					if(thispath.indexOf(approot)<0)
					{
						if(thispath.indexOf("/")!=0) thispath = "/"+thispath;
						linkobjs[i].pathname = "/" + approot + thispath;
					}
	
				}
			}
			else
			{
			}
		
		}	
	}

function fixlinks()
	{
		// Fixes links for testing on local system
		if(location.hostname != "localhost") return;
		var linkobjs = document.getElementsByTagName("link");
		var thislink;
		var thispath;
		for(i = 0; i<linkobjs.length; i++)
		{
			if(linkobjs[i]!="") {
				thispath = linkobjs[i].href;
				if(thispath!=null && thispath.indexOf(approot)<0)
				{
					if(thispath.indexOf("http://localhost/")==0)
					{
						linkobjs[i].href = "http://localhost/" + approot + thispath.substr(16);
					}
					else {
						if(thispath.indexOf("https://localhost/")==0)
							{
								linkobjs[i].href = "https://localhost/" + approot + thispath.substr(17);
							}
						else {
							if(thispath.indexOf("/")==0) linkobjs[i].href = "/" + approot + thispath;
						}
					}
				}
				
			}
			else
			{
			}
		
		}	
	}




	function fiximages()
	{
		// Fixes links for testing on local system
		if(location.hostname != "localhost") return;
		var linkobjs = document.getElementsByTagName("IMG");
		var thislink;
		var thispath;
		var processed;

		for(i = 0; i<linkobjs.length; i++)
		{
			if(linkobjs[i]!="") {
				thispath = linkobjs[i].src;
				processed = false;
				if(thispath.indexOf(approot)<0 && thispath.indexOf("http://localhost")>=0)
				{
					thispath = "http://localhost/" + approot + thispath.substr(16);
					linkobjs[i].src = thispath;
					processed = true;
				}
				if(thispath.indexOf(approot)<0 && thispath.indexOf("https://localhost")>=0)
				{
					thispath = "https://localhost/" + approot + thispath.substr(17);
					linkobjs[i].src = thispath;
					processed = true;
				}

			}

		}	
	}
