﻿// JScript File - BioLondon.org.uk (D de Alwis - White Loop Ltd. dec 2007)

//<![CDATA[
/* -- a fix for image flickering in IE6 --  */
try {
    document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
//]]>

function dosize() {
    
    var iWidth = 830;
    var iHeight = 780;
    if ((document.body.clientWidth <= iWidth) || (document.body.clientHeight <= iHeight)) {
        //alert("size: " + document.body.clientWidth + "x" + document.body.clientHeight);
        
        self.resizeTo(iWidth,iHeight);
        return true;
    }
}

 function openwindow(thewidth, theheight, url) {
     var windower
     var winTop = (screen.height / 2) - (theheight /2);
     var winLeft = (screen.width / 2) - (thewidth / 2);
     var windowFeatures = "";
     windowFeatures = windowFeatures + "width=" + thewidth + ",";
     windowFeatures = windowFeatures + "height=" + theheight + ",";
     windowFeatures = windowFeatures + "resizable=no,scrollbars=no,"
     windowFeatures = windowFeatures + "left=" + winLeft + ",";
     windowFeatures = windowFeatures + "top=" + winTop;
     windower = window.open(url, "map", windowFeatures);
     windower.focus();
}
/* <a class="adbut" href="http://kentlyons-development.co.uk/biolondonmap/map.html" onclick="openwindow(760,538,'http://kentlyons-development.co.uk/biolondonmap/map.html'); return false;" title="Launch BioLondon map">Launch Map</a> */


//function to allow standards compliant external links (as target="_blank" attribute is deprecated in XHTML Strict DTD)
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"; 
	 } 
}

externalLinks(); /* use rel="external" in the <a href> to call it */

function swap(targetId,buttonId) {
  
  if (document.getElementById) {
        target = document.getElementById(targetId);
        buttonName = document.getElementById(buttonId);
        
        if (target.style.display == "none") {
            target.style.display = "";
        } else {                
            target.style.display = "none";
        }
            
        if (target.style.display == "none") {
            //buttonName.innerHtml = "[+]";
            buttonName.src = "../img/more.gif";
            buttonName.alt = "[ + ]";
        } else {
            //buttonName.innerHtml = "[-]";
            buttonName.src = "../img/less.gif";
            buttonName.alt = "[ - ]";
        }
  }
}