function getCurrentPageLink()
{
if (!document.getElementsByTagName) return; 
navElements=document.getElementsByTagName("div");
  for( var i = 0; i < navElements.length; i++ )
    if (navElements(i).className == 'mainbody')
	{
      navAnchors=navElements(i).getElementsByTagName("a");
      for( var i = 0; i < navAnchors.length; i++ )
	  {
      
	   if(!navAnchors(i).title)
	   navAnchors(i).title='Select to open linked page'
	   
	   if(!navAnchors(i).tabIndex)
	   navAnchors(i).tabIndex= 5+i

	    if (navAnchors(i).href == document.location.href)
		 {
          navAnchors(i).className = 'currentlink';
		  navAnchors(i).title= 'You are here...'
		 }
		}
	}
}

function addLinkInfo() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if(!anchor.title)
	   anchor.title='Select to open linked page'
   if(!anchor.tabIndex)
	   anchor.tabIndex= i
 } 
}

function PageTitle() {
document.write (document.title)
}

function checkurl()
{ 
   var myurl = "http://www.excellentsite.org"; 
   if(document.referrer.substring(0,28) == myurl) 
    {  document.location.href=document.referrer;  } 
  else 
    {  document.location.href=myurl;  } 
} 

function check_spam(addy) {
var spam_src= new Array('buy@phentermine.com','texas holdem','texas','viagra','phentermine','adipex','online casino games','cialis');
for (var i=0; i<spam_src.length; i++) { 
if (addy==spam_src[i])
return true;}
}

// New window functions

function externalLinks() { 
 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") == "external") 
     anchor.target = "_blank"; 
 } 
} 

// window.onload = externalLinks;
// Not used, this site does not open new windows

function disableTargetBlank() { 
 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("target") == "_blank") 
     anchor.target = ""; 
 } 
}

function change2external() { 
 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") == "select") 
     anchor.target = "_blank"; 
 } 
}

function change2same() { 
 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") == "select") 
     anchor.target = "_self"; 
 } 
}

// Pop-up functions

function callImage(href,title,w,h) {
window.open('imageshow.htm?source='+ href + '&alt=' + title,'Image','scrollbars=yes,status=no,width=' + w + ',height=' + h +',left=10,top=10,resizable=yes,dependent=yes,copyhistory=yes,toolbar=yes'); 
}

function callWindow(page,title,w,h) {
window.open(page, title,'scrollbars=yes,status=no,width=' + w + ',height=' + h +',left=10,top=10,resizable=yes,dependent=yes,copyhistory=yes,toolbar=yes');
}

function openURL(href) {
window.open(href,'_top');
}

/* Text Only Script */

/* Compiled by Carlos Simoes from Cb2 Web Design for Webmates and WebsAwards
Suggested use:
<a href="#top" onClick="linearize(); disableInlineStyles; disableStyle(); return false; " title="Text Version">Text Version</a>
You can select functions to be used. For instance, do not use removeImages() if you still want the images to be displayed.
You can also add the following link-specific functions: disableTargetBlank(); addLinkInfo();
Based on NILS Accessibility Toolbar, available at:
http://www.nils.org.au/web_access.htm
Keep this notice here!
*/

function linearize(){
var H=[],Y={TABLE:1,TR:1,TD:1,TH:1,CAPTION:1,DIV:1},d=[],p; function R(N){var a,x,i,t; if(t=N.tagName){ t=t.toUpperCase(); for (i=0;a=H[i];++i)if(N.getAttribute(a))N.removeAttribute(a); for(i=0;x=N.childNodes[i];++i)R(x); if (Y[t])d.push(N); } } R(document.documentElement); for (i=0;N=d[i];++i) { p=N.parentNode; while(N.firstChild)p.insertBefore(N.firstChild,N); p.removeChild(N); } }

function disableStyle() {
if (!document.getElementsByTagName) return;var anchors = document.getElementsByTagName("link");for (var i=0; i<anchors.length; i++) {var anchor = anchors[i];if (anchor.getAttribute("rel") == "stylesheet") anchor.disabled = "true";}}

function disableInlineStyles() {
var H=["style"],Y={},d=[],p;function R(N){var a,x,i,t;if(t=N.tagName){t=t.toUpperCase();for(i=0;a=H[i];++i)if(N.getAttribute(a))N.removeAttribute(a);for(i=0;x=N.childNodes[i];++i)R(x);if(Y[t])d.push(N);}}R(document.documentElement);for(i=0;N=d[i];++i){p=N.parentNode;while(N.firstChild)p.insertBefore(N.firstChild,N);p.removeChild(N);}}

function removeImages() {
if(document.images.length>0){(function(){function to(c){var a,k;a=new Array;for(k=0;k<c.length;++k)a[k]=c[k];return a;}var im,img,xt;im=to(document.images);for(var i=0;i<im.length;++i){img=im[i];e=document.createElement('span');void(e.style.background='#f5deb3');void(e.style.color='navy');if(img.attributes.alt.specified!=true){xt=document.createTextNode('NoAlt!')}else{xt=document.createTextNode(img.alt+' ')}e.appendChild(xt);img.parentNode.replaceChild(e,img)}})();}else{history.go()} }

function removeCSS() {
for(i=0;i<document.styleSheets.length;i++) {
	void(document.styleSheets.item(i).disabled=true);
}
el = document.getElementsByTagName('*');
for ( i=0; i<el.length; i++) {
	void(el[i].style.cssText = '');
}
}

/* Styles handling */

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
