﻿// JavaScript Document

function toggle_visibility(id) 
		{
		   var e = document.getElementById(id);
		   if(e.style.display == 'block')
			  e.style.display = 'none';
		   else
			  e.style.display = 'block';
		}
		
function showalldivs() 
		{
		   if(div.style.display == 'none')
			  div.style.display = 'block';
		   else
			  div.style.display = 'block';
		}
		
function hidealldivs() 
		{
		   if(div.style.display == 'none')
			  div.style.display = 'block';
		   else
			  div.style.display = 'block';
		}
		
		
		
function Show(What, CheckURL) 
{
   setElementStyle("span", "display", "block");
   
   var a, i;

   if (CheckURL) {
      i = document.URL.indexOf("#");
      if(i != -1) {
         Show(document.URL.substring(i+1,document.URL.length));
         return;
      }
   }
   if (!document.getElementsByTagName) 
      return;
   a = document.body.getElementsByTagName("div");
   if (a.length == 0) 
      return;
   if (typeof a[0].style != 'object') 
      return;
   if (typeof a[0].style.display == 'undefined') 
      return;
   for (i = 0; i < a.length; i++) {
      if (a[i].className != "section") 
         continue;
      if (a[i].id != What) 
         a[i].style.display = "none";
      else 
         a[i].style.display = "block";
  }
  return true;
}


function Hide(What) 
{
   setElementStyle("span", "display", "block");
   
   var a, i;

   if (!document.getElementsByTagName) 
      return;
   a = document.body.getElementsByTagName("div");
   if (a.length == 0) 
      return;
   if (typeof a[0].style != 'object') 
      return;
   if (typeof a[0].style.display == 'undefined') 
      return;
   for (i = 0; i < a.length; i++) {
      if (a[i].className != "section") 
         continue;
      if (a[i].id != What) 
         a[i].style.display = "none";
      else 
         a[i].style.display = "block";
  }
  return true;
}


function createStyleRule(selector, declaration) {
	if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) return;
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_iewin = (is_ie && (agt.indexOf("win") != -1));
	var is_iemac = (is_ie && (agt.indexOf("mac") != -1));
	if (is_iemac) return; // script doesn't work properly in IE/Mac
	var head = document.getElementsByTagName("head")[0]; 
	var style = (typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style");
	if (!is_iewin) {
		var styleRule = document.createTextNode(selector + " {" + declaration + "}");
		style.appendChild(styleRule); // bugs in IE/Win
	}
	style.setAttribute("type", "text/css");
	style.setAttribute("media", "screen"); 
	head.appendChild(style);
	if (is_iewin && document.styleSheets && document.styleSheets.length > 0) {
		var lastStyle = document.styleSheets[document.styleSheets.length - 1];
		if (typeof lastStyle.addRule == "object") { // bugs in IE/Mac and Safari
			lastStyle.addRule(selector, declaration);
		}
	}
}
