function toggleDiv(divName) {
	thisDiv = document.getElementById(divName);
	if (thisDiv) {
		if (thisDiv.style.display == "none") {
			thisDiv.style.display = "block";
		} else {
			thisDiv.style.display = "none";
		}
	} else {
		alert("Error: Could not locate div with id: " +
				divName);
	}
}

function hideLayer(whichLayer) {
	if (document.getElementById) 
	{
		// standards 
		document.getElementById(whichLayer).style.display = "none";
	}
	else if (document.all) 
	{
		// old msie 
		document.all[whichlayer].style.display = "none";
	}
	else if (document.layers) 
	{
		// nn4
		document.layers[whichLayer].display = "none";
	}
}

function showLayer(whichLayer) {
	if (document.getElementById) 
	{
		// standards
		document.getElementById(whichLayer).style.display = "block";
	}
	else if (document.all) 
	{
		// old msie
		document.all[whichlayer].style.display = "block";
	}
	else if (document.layers) 
	{
		// nn4
		document.layers[whichLayer].display = "block";
	}
}

function aboutClick(which,how) {
	if (how == "hide") 
	{
		hideLayer(which);
	}
	else if (how == "show") 
	{
		showLayer(which);
	}
}

function about(which) {
	if(document.getElementById(which).style.display == "block" ||
			document.all[which].style.display == "block" ||
			document.layers[which].display == "block") {
		hideLayer(which);
	} else {
		showLayer(which);
	}
		
}
		
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

/* set to 1 to have the function output the result -return true if converted
 * set to 0 to have the function not output anything -returns the value
 */
var _OUTPUT=1;
function formatPhone(num)
{ 
  var _return=false;
  /*
   * 7181238748 to 1(718)123-8748
   */ 

  if(num.length != 10)
  { 
    /* 
     * if user did not enter 10 digit phone number then simply print whatever user entered 
     */ 
	_return=_OUTPUT?num:false;
  } 
  else
  { 
			/* formating phone number here */ 
		_return="1(";
			var ini = num.substring(0,3);
		_return+=ini+")";
			var st = num.substring(3,6);
		_return+=st+"-";
			var end = num.substring(6,10);
		_return+=end;
  }
  return _return; 
} 