// bookmark page
bookmarkurl=window.location.href;
bookmarktitle=document.title;

function bookmarksite(){
if (window.sidebar) // firefox
	window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',bookmarkurl);
	elem.setAttribute('title',bookmarktitle);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(bookmarkurl, bookmarktitle);
}

// basic show hide for adv search
function showHide(el) {
	if (document.getElementById(el)){
		if (document.getElementById(el).style.display=="block"){
			document.getElementById(el).style.display="none"
		} else {
			document.getElementById(el).style.display="block"
		}
	}
}

//Links in divWithRelated need an arrow adding to them
//this is a bit of a faff for the content authors so use some JS to do it on the fly
function addMoreLinkGraphic(){
	var div=document.getElementById("divWithRelated");
	if(div){
		var links=div.getElementsByTagName("a");
		for (j=0;j<links.length;j++){
			//only add arrow if link isn't already an image based one
			if (links[j].innerHTML.toLowerCase().search("<img") < 0 ){
				links[j].innerHTML+=" <img src=\"/AyeWrite/images/template/orangearrow.png\" alt=\"\" />"
			}
		}
	}
	div=document.getElementById("landingPage");
	if(div){
		var links=div.getElementsByTagName("a");
		for (j=0;j<links.length;j++){
			//only add arrow if link isn't already an image based one
			if (links[j].innerHTML.toLowerCase().search("<img") < 0 
					&& links[j].innerHTML.toLowerCase().search("<h2") < 0 
					&& links[j].parentNode.tagName.toLowerCase() == "p"){
				links[j].innerHTML+=" <img src=\"/AyeWrite/images/template/orangearrow.png\" alt=\"\" />"
			}
		}

	}
	
	
}
if (window.attachEvent) {	
	window.attachEvent("onload", addMoreLinkGraphic);
} else if (window.addEventListener){
	window.addEventListener("load", addMoreLinkGraphic, false);  
} else if (document.addEventListener){ 
	document.addEventListener('load', addMoreLinkGraphic, false);
}