checkParent();

function checkParent()
{
    if (top==window)
    {
        location.href = "index.html";
    }
}

function safeto(link,subject,addr,tld,site)
{
  document.write('<a href=\"mai'+'lto:'
    +addr+ '&#64;' + site + '&#46;' + tld + '?subject=' + subject +
	'\">' + link + '</a>');
}

function safetoBody(link,subject,addr,tld,site,body)
{
  var dinny="Dinnymcintyre@aol.com"
  document.write('<a href=\"mai'+'lto:'
    +addr+ '&#64;' + site + '&#46;' + tld + '?subject=' + subject 
	+ '&amp;body=' + body + '\">' + link + '</a>');
}

function safetoBody(link,subject,addr,tld,site,body)
{
  document.write('<a href=\"mai'+'lto:'
    +addr+ '&#64;' + site + '&#46;' + tld + '?subject=' + subject 
	+ '&amp;body=' + body + '\">' + link + '</a>');
}
function toCommittee(link, subject,body)
{
  document.write('<a href=\"mai'+'lto:jimTerryJr@aol.com'
                 + '?subject=' + subject 
                 + '&amp;cc=Dinnymcintyre@aol.com'
                 + '&amp;cc=massbikeplan@thecollaborative.com'
                 + '&amp;cc=SWalker@mapc.org'
                 + '&amp;body=' + body + '\">' + link + '</a>');
}

function mapBorder(obj, friend)
{
	if (obj)
	{
		obj.border=4;
		obj.style.borderColor="yellow";
		if (friend) {
			labelBorder(document.getElementById(friend),null);
		}
	}
}
function labelBorder(obj, friend)
{
	if (obj)
	{
		obj.border=2;
		obj.style.borderColor="blue";
		if (friend) {
			mapBorder(document.getElementById(friend),null);
		}
	}
}
function noBorder(obj, friend)
{
	if (obj)
	{
		obj.border=0;
		if (friend) {
			noBorder(document.getElementById(friend),null);
		}
	}
}

function moveStuff()
{
	// reread since supposedly cached
    var height = window.frames["hiddenf"].document.body.scrollHeight;

    if (height < 400)
    {
        height = 400;
    }
    document.getElementById("content").height = height;

    iframeDoc = window.frames.content.document;
    iframeDoc.open();
    iframeDoc.write(window.frames.hiddenf.document.body.innerHTML);
    iframeDoc.close();
}

function loadDone()
{
    moveStuff();
}

function magicpopup(image,nWidth,nHeight,sTitle)
{
	nColor="#FFFFFF";
	var adj=10;
	nMargin=0;
	var w = screen.width;
	var h = screen.height;
	var agent=navigator.userAgent.toLowerCase();
	if(agent.indexOf("opera") != -1){
		w = document.body.clientWidth;
	h = document.body.clientHeight;
	}
	var byFactor=1;
	if(w<740){
		var lift=0.90;
	}
	if(w>=740 & w<835){
		var lift=0.91;
	}
	if(w>=835){
		var lift=0.93;
	}
	if (nWidth>w){	
		byFactor = w / nWidth;
		nWidth = w;
		nHeight = nHeight * byFactor;
	}
	if (nHeight>h-adj){
		byFactor = h / nHeight;
		nWidth = (nWidth * byFactor);
		nHeight = h; 
	}

	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;
 
	if (nHeight>scrHeight){
		nHeight=nHeight*lift;
		nWidth=nWidth*lift;
	}
	var posLeft=0;
	var posTop=0;
	if (nMargin < 0){nMargin=0}
	nMargin*=2;
	var nTemp = parseInt(nHeight) + nMargin;
	if (nTemp < scrHeight) {
		scrHeight = nTemp;
	} 
	nTemp = parseInt(nWidth) + nMargin;
	if (nTemp < scrWidth) {
		scrWidth = nTemp;
	}
	if (scrHeight<100){scrHeight=100;}
	if (scrWidth<100){scrWidth=100;}
	posTop =  ((h-(scrHeight/lift)-adj)/2);
	posLeft = ((w-(scrWidth)-adj)/2);
	if (nHeight > (h*lift)-adj || nWidth > w-adj){
		nHeight=nHeight-adj;
		nWidth=nWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	newWindow = window.open("","","width="+scrWidth+", height="+scrHeight+",left="+posLeft+",top="+posTop);
	if(newWindow!=null){
		newWindow.document.open();
		newWindow.document.write('<html><title>'+sTitle+'</title>'); 
		newWindow.document.write('<meta http-equiv="imagetoolbar" content="false">');
		newWindow.document.write('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+nColor+' onBlur="self.close()" onClick="self.close()">'); 
		newWindow.document.write('<table width='+nWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
		newWindow.document.write('<img src="'+image+'" width='+nWidth+' height='+nHeight+' alt="Click to close window" >');
		newWindow.document.write('</td></tr></table></body></html>');
		newWindow.document.close();
		newWindow.focus();
	}

	return false;
}
function setContent(src)
{
	parent.content.location = src;
}

function showObj(objId){ var objStyle = getObjStyle(objId); if (objStyle){
    objStyle.visibility = 'visible'; objStyle.display = 'block';}}

function hideObj(objId){ var objStyle = getObjStyle(objId); if (objStyle){ 
    objStyle.visibility = 'hidden'; objStyle.display = 'none';} }

function isVisible(objId)
{
    var objStyle = getObjStyle(objId);
    return ((objStyle != null) ? objStyle.visibility == 'visible' : false);
}

function getObj(objId)
{
    if (document.getElementById) {return document.getElementById(objId);} // DOM3 = IE5, NS6
    else if (document.layers) {return document.objId;} // Netscape 4
    else {return document.all.objId;}// IE 4
}

function getObjStyle(objId) {var obj = getObj(objId); return (obj==null) ? null : obj.style; }

function slideshow()
{
    var div ="Gslideshow";
    var isIE = navigator.appName == 'Microsoft Internet Explorer';
    var html;
    if (isIE){
        html=' <object type="application/x-shockwave-flash" width="267" height="200"' +
            'bgcolor="#ffffff" wmode="transparent" ' +
            'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"' +

            ' pluginspage="http://www.macromedia.com/go/getflashplayer" ' +
            ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  ' +
            ' data="/flash/jpgrotator.swf?file=/show/wildlife.xml">' +
            ' <param name="movie" value="/flash/jpgrotator.swf?file=/show/wildlife.xml" />' +
            ' <param name="bgcolor" value="#ffffff" wmode="transparent"/>' +
            '</object>';
    }
    else
    {
        html = ' <object type="application/x-shockwave-flash" width="267" height="200"' +
            ' bgcolor="#ffffff" wmode="transparent" ' +
            ' data="/flash/jpgrotator.swf?file=/show/wildlife.xml">' +
            ' <param name="movie" value="/flash/jpgrotator.swf?file=/show/wildlife.xml" /> ' +
            ' <param name="bgcolor" value="#ffffff" wmode="transparent"/> ' +
            '</object> ';
    }

    getObj(div).innerHTML=html;

}

