/* toggle between style sheets - web vs print */

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}



/* switch between pages */

	function elemOn(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "block";
		if(elem_id == 'p6') { dipityOn('dipity'); }

	}
	function elemOff(elem_id){
		if(document.getElementById(elem_id))
			document.getElementById(elem_id).style.display = "none";
	}
	function dipityOn(dipity_id) {
		if(document.getElementById(dipity_id))
			var dipFrame = document.getElementById('dipity_frame');
			document.getElementById(dipity_id).style.visibility = "visible";
			dipFrame.src = 'http://www.dipity.com/GelfMagazine/Hyperlocal/embed_map';
	}

	
	function hideAll(){
		for( var i = 1; i <= 6; i++ )
			elemOff( 'p'+i );
	}
	function showAll(){
		for( var i = 1; i <= 6; i++ )
			elemOn( 'p'+i );
	}
	function showOne(elem_id){
		hideAll( );
		scroll(0,0);
		elemOn( elem_id );
	}
	function showTwo(elem_id1, elem_id2) {
		hideAll( );
		scroll(0,0);
		elemOn( elem_id1 );
		elemOn( elem_id2 );
	}
	
// Popups

function popup(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

// Hide email addresses

<!--
  function emailHide( name ) {
    var domain = "gmail.com";
    var where = "&#64;";
    var address = name + where + domain;
    document.write("<" + "a" + " " + "href=" + "mail" + "to:" + address + ">" + address + "<\/a>");
  }
//-->

<!--
  function emailHide2( name,fullname ) {
    var domain = "gmail.com";
    var where = "&#64;";
    var address = name + where + domain;
    document.write("<" + "a" + " " + "href=" + "mail" + "to:" + address + ">" + fullname + "<\/a>");
  }
//-->

// toggle layers in nav

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}