/* javascript file for the San Juan Preservation Trust */

function showBio(name_elem){
	top.location = 'peoplebio.php#' + name_elem.innerHTML.toString().replace(/<[^>]+>/g,"");
	return false;
}

function bioLinks() {
    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') == 'bio') {
            anchor.setAttribute('href', anchor.getAttribute('href') + '#' + anchor.innerHTML);
        }
    }
}
window.onload = bioLinks;

function sanJuanMap(){
	var imageWidth = 660; var imageHeight = 544;
   	var posLeft = Math.floor( (screen.width - imageWidth) / 2);
    var posTop = Math.floor( (screen.height - imageHeight) / 2);

	newWindow = window.open("","newWindow","resizable=1,width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title></title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src="/i/photo/map_zoom.jpg" width='+imageWidth+' height='+imageHeight+'>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	return false;
}

function crowValleyDiag(){
	var imageWidth = 700; var imageHeight = 440;
   	var posLeft = Math.floor( (screen.width - imageWidth) / 2);
    var posTop = Math.floor( (screen.height - imageHeight) / 2);
	newWindow = window.open("/i/photo/crowvalley_diagram_large.jpg","DiagWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.focus();
	return false;
}

function conservationStoryPic(i) {
	var imageWidth = 450; var imageHeight = 450;
   	var left = Math.floor( (screen.width - imageWidth) / 2);
    var top = Math.floor( (screen.height - imageHeight) / 2);
	newWindow = window.open("","newWindow","resizable=1,width="+imageWidth+",height="+imageHeight+",left="+left+",top="+top);
	newWindow.document.open();
	newWindow.document.write('<html><title></title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src="/i/photo/story/large/'+i+'.jpg" width='+imageWidth+' height='+imageHeight+'>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	return false;
}

function showMap(i, imageWidth, imageHeight,t) {
   	var left = Math.floor( (screen.width - imageWidth) / 2);
    var top = Math.floor( (screen.height - 580) / 2);
	newWindow = window.open("","newWindow","resizable=yes,scrollbars=yes,width="+ (imageWidth+20) +",height="+580+",left="+left+",top="+top);
	newWindow.document.open();
	newWindow.document.write('<html><title>"'+t+'"</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src="'+i+'" width='+imageWidth+' height='+imageHeight+'>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	return false;
}

function showImage(i, imageWidth, imageHeight,t) {
   	var left = Math.floor( (screen.width - imageWidth) / 2);
    var top = Math.floor( (screen.height - imageHeight) / 2);
	newWindow = window.open("","newWindow","resizable=yes,scrollbars=no,width="+ (imageWidth) +",height="+imageHeight+",left="+left+",top="+top);
	newWindow.document.open();
	newWindow.document.write('<html><title>"'+t+'"</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src="'+i+'" width='+imageWidth+' height='+imageHeight+'>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	return false;
}