/* scripts for The Peterborough and Kawartha Chapter of the Council of Canadians */

/* ====<script for site navigation: image map in conjunction with CSS>==== */
/* ===<For more information about the code used here, see http://wik.inkdeep.com/articles/2005/12/20/imagemap-rollovers-with-area-shape-poly>=== */  

function readMap () {
	var map, i;
    // get map area tags 
    map=document.getElementsByTagName('area');
    for(i=0;i<map.length;i++)
    {
    // add onmouseover and onmouseout event functions 
    map[i].onmouseover=function(){shift(this);};
    map[i].onmouseout=function(){shift(this);};
    }
}
function shift (o) {
    var mapbg, id;
    // set the id  variable to the 'id' of the area on the map where the mouse is positioned 
    id = o.id;
    // the master object where the image map is used in this case a transparent gif with the id 'navimg' 
    mapbg = document.getElementById('navimg');
    /* if the className and the id match, reset the class to the default state else shift the background image to the correct position by using the new class value */
    if(id == mapbg.className){
    mapbg.className='navbase'; 
    }else{
    mapbg.className=id;
    }
}
window.onload=function(){
     readMap();
}

/* ====</script for site navigation: image map in conjunction with CSS>==== */

