
window.onload = extLinks;preload();

function describe(text) {
	window.status = text;
return true;
}

function ClearStatus() {
window.status = " ";
return true;
}

function preload() {
tb1 = new Image();
tb1.src = "BookmarkB.gif";
tb2 = new Image();
tb2.src = "ContactB.gif";
tb3 = new Image();
tb3.src = "FindB.gif";
tb4 = new Image();
tb4.src = "HomeB.gif";
tb5 = new Image();
tb5.src = "LinksB.gif";
tb6 = new Image();
tb6.src = "SearchB.gif";
tb7 = new Image();
tb7.src = "StudFAQB.gif";
tb8 = new Image();
tb8.src = "TellB.gif";
tb9 = new Image();
tb9.src = "TutFAQB.gif";
tb10 = new Image();
tb10.src = "TutGuideB.gif";
tb11 = new Image();
tb11.src = "HowB.gif";
}

function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }



function reset() {
document.TownForm.link.value="x"
document.TownForm2.link.value="x"
}

function resetX() {
document.forms['TownForm'].link.value="x"
document.forms['TownForm'].value="x"
}


function BookMarkUs(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}



function NavigateTown() {
page = document.TownForm.link.selectedIndex;
pageval = document.TownForm.link.options[page].value;
if (pageval == "x") return;
window.location = pageval +  ".html";
}

function NavigateTown2() {
page = document.TownForm2.link.selectedIndex;
pageval = document.TownForm2.link.options[page].value;
if (pageval == "x") return;
window.location = pageval +  ".html";
}

function NavigateTownX() {
page = document.forms['TownForm'].link.selectedIndex;
pageval = document.forms['TownForm'].link.options[page].value;
if (pageval == "x") return;
window.location = pageval +  ".html";
}


function NavigateSubject() {
page = document.SubjectForm.link.selectedIndex;
pageval = document.SubjectForm.link.options[page].value;
if (pageval == "x") return;
window.location = pageval +  "Tutors.html";
}

function NavigateSubject2() {
page = document.forms['SubjectForm2'].link.selectedIndex;
pageval = document.forms['SubjectForm2'].link.options[page].value;
if (pageval == "x") return;
top.location.href = pageval +  ".html";
}

function NavigateCounty() {
page = document.CountyForm.link.selectedIndex;
pageval = document.CountyForm.link.options[page].value;
if (pageval == "x") return;
window.location = pageval +  ".html";
}


function extLinks() {
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "nofollow") 
     anchor.target = "_blank"; 
	 if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "blank") 
     anchor.target = "_blank";
if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "top") 
     anchor.target = "_top"; 
 }
} 

var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX-600) + "px";
d.style.top = (cY+20) + "px";
}

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}

function FocusNSel()
{
document.getElementById("LinktxtArea").focus();
document.getElementById("LinktxtArea").select();
y = 'Please copy and paste into your HTML code. Thank you for linking to HomeTutorsDirectory.co.uk';	// Text to output on page
var cost = document.getElementById("LinkTextOutput");
cost.firstChild.nodeValue = y;
}
