
/* Opens popup window  */
function opener(page)
{
  window.open(page, "popup", "location=no,menubar=no,resizable=no,width=550,height=580,scrollbars=yes");
}

/* Opens popup window */
function NewWindow(mypage, myname, w, h, scroll) 
{
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
  win = window.open(mypage, myname, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

/* Even 'column' script
Derived from a script by Alejandro Gervasio. 
Modified to work in FireFox by Stefan Mischook for Killersites.com
Modified by Erica Melton to work in WST
How it works: just apply the CSS class of 'column' to your pages' main columns.
Add "matchColumns();" to body onload.
*/
function matchColumns()
{ 
  var divs,contDivs,maxHeight,divHeight,d; 
	
  // get all <div> elements in the document 
  divs=document.getElementsByTagName('div'); 
  contDivs=[]; 

  // initialize maximum height value 
  maxHeight=0; 

  // iterate over all <div> elements in the document 
  for(var i=0;i<divs.length;i++){ 
    // make collection with <div> elements with class attribute 'container' 
    if(/\bcolumn\b/.test(divs[i].className))
	  { 
      d=divs[i]; 
      contDivs[contDivs.length]=d; 
		
      // determine height for <div> element 
      if(d.offsetHeight)
	    { divHeight=d.offsetHeight;}
      else if(d.style.pixelHeight)
	    { divHeight=d.style.pixelHeight;} 

      // calculate maximum height 
      maxHeight=Math.max(maxHeight,divHeight); 
      } 
    } 

    // assign maximum height value to all of container <div> elements 

    for(var i=0;i<contDivs.length;i++)
	{ contDivs[i].style.height=maxHeight + "px"; } 	
} 

/* AJAX FUNCTION */
function ajaxFunction(url,divid)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.getElementById(divid).innerHTML = xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }
  
function getSIFR()
{
  //<[CDATA[
  var stempelgaramond = {src: 'images/StempelGaramond.swf'};

  //sIFR.debugMode = true;
  // sIFR.domains = ['novemberborn.net'] // Don't check for domains in this demo selector: '#qm0 a'
  sIFR.activate(stempelgaramond);

	//,'font-size':'20px','width':'334px'
  
	sIFR.replace(stempelgaramond, {selector: 'h1'
		,css: {
	  '.sIFR-root': { 'color': '#000000', 'letter-spacing': 1.5, 'background-color':'#e6a664','font-size':'20px'}
	}
	,wmode:'transparent'
	,offsetLeft:-12
	,fixHover:true
	,selectable:false
	,forceWidth:true
	
	}
); //]]>
} //end sIFR function 

// Function called on comparison forms to manage the color and number checkboxes.
function doThis(id)
{
//check to see if its been clicked, if so, then turn it white, otherwise turn it yellow.
	if (window.document.getElementById(id).checked== false)
		{ 
			window.document.getElementById(id).bgColor='#fff';
		}
	else {
		window.document.getElementById(id).bgColor='#ffe28d';
	}
	

}

function checkForThree(FormName, CheckBox1, id)
{
    var intNumChecked = 0;
    var intNumElements = document.getElementById(FormName).elements.length;

    for (var intI = 0; intI < intNumElements; intI++)
    {
        if (document.getElementById(FormName).elements[intI].checked == true)
        {
            intNumChecked += 1;
        }
    }

    if(CheckBox1.checked == true)
    {
        if(intNumChecked > 3)
        {
            alert('Maximum of 3 Communities can be compared at one time.');
            CheckBox1.checked = false;
        }
				else {			
					window.document.getElementById(id).bgColor='#ffe28d';
				}
    }				


}

function startlist() {
if (document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
  node = navRoot.childNodes[i];
  if (node.nodeName=="LI") {
  node.onmouseover=function() {
  this.className+=" over";
    }
  node.onmouseout=function() {
  this.className=this.className.replace
      (" over", "");
   }
   }
  }
 }
}