// The "pictures/videos" ExtrasLinks should be hidden by default and only shown when extras are
// available (when "<div id="ShowExtrasLinks"></div>" is present).  If the target browser has disabled
// javascript, then the links should always show (preferable to NEVER showing).  But if this region
// is hidden by default, it can't be activated via script.  So we use script to hide it in the first
// place, but we put that code in the HEAD section so that it doesn't "blink" since javascript in
// the BODY is not executed until the page is completely loaded.  i.e.,
// By putting the "visibility: hidden" in script, it ensures that it wont hide when scripting is disabled.
document.write('<style type="text/css">#ExtrasLinks{visibility: hidden;}</style>');


function grey_void_links() {
	// grey-out the unused links in ExtrasLinks (actually the whole page!)
	// But this should really only apply to the "pictures/videos" ExtrasLinks.
	// I wish I knew how to restrict it to the one section.
    // CALLED BY window.onload IN SLIDESHOW.JS

	if (!document.getElementsByTagName) return; 
	// if (!document.ExtrasLinks) return; 
	var anchors = document.getElementsByTagName("a"); 
	// alert(anchors.length);
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		var myHREF=anchor.getAttribute("href");
		if (myHREF && (myHREF=="" || myHREF=="javascript:void(null)")) {
			 // alert ("bye");
			 anchor.style.href = "javascript:void(null)"; 
			 anchor.style.color = "#DDDDDD"; 
		}
	} 
} 


function disableAnchor(objId, disable) {
 // I dont think I'll use this, but here it is just in case.
 var obj = document.getElementById(objId);
 if(obj != null) {
  if(disable) {
   var href = obj.getAttribute("href");
   var onclick = obj.getAttribute("onclick");
   //First we store previous value in a new attribute
   if(href && href != "" && href != null) {
    obj.setAttribute('href_bak', href);
   }
   if(onclick != null) {
    obj.setAttribute('onclick_bak', onclick);
    obj.setAttribute('onclick', "void(0);");
   }
   obj.removeAttribute('href');
   //obj.style.color="gray";
  }
  else {
   var hrefBak = obj.getAttribute("href_bak");
   var onclickBak = obj.getAttribute("onclick_bak");
   if(onclickBak !=null ) {
    obj.setAttribute('onclick', onclickBak);
    obj.removeAttribute('onclick_bak');
   }
   if(hrefBak !=null ) {
    obj.setAttribute('href', hrefBak);
    obj.removeAttribute('href_bak');
    //obj.style.color="blue";
   }
  }
 }
}

