
// JavaScript Document

//*********************************************
// Function to change page when new page selected
//***
function linkto()
{
	hideDiv(page_selection_button.options.value);
}


//*********************************************
// Function that Shows an HTML element
//*********************************************
function showDiv(divID)
{
		
		//new Effect.ScrollTo('scroll_to');
		hideAllSections(); // Hide all
	var div = document.getElementById(divID);
	div.style.display = ""; //display div
}

//*********************************************
// Function that Hides an HTML element
//*********************************************
function hideDiv(divID)
{
	var div = document.getElementById(divID);
	div.style.display = "none"; // hide
}
//*****************************************************************************
// Function that Hides all the section Div elements in the select menu Value
//*****************************************************************************
function hideAllSections() {
	
	var myDivs = Array('section1','section2', 'section3', 'section4','section5', 'section6', 'section7','section8', 'section9','sectionG','contact_section') // Add each div ID to this array
	for(var i in myDivs) {
		if(document.getElementById(myDivs[i])) {
			document.getElementById(myDivs[i]).style.display = 'none';
			
		}
	}
}
// Function that shows all the section Div elements in the select menu Value
//*****************************************************************************
function ShowAllSections() {
	var myDivs = Array('section1','section2', 'section3', 'section4','section5', 'section6', 'section7','section8', 'section9', 'sectionG','contact_section') // Add each div ID to this array
	for(var i in myDivs) {
		if(document.getElementById(myDivs[i])) {
			document.getElementById(myDivs[i]).style.display = '';
			
		}
	}
}
// Function that Hides all the section Div elements in the select menu Value
//*****************************************************************************
function ShowAllPage() {
	ShowAllSections();
	ShowAllScreens();
}

//*********************************************
// Main function that calls others to toggle divs
//*********************************************
function toggle(showID)
{
	hideAllSections(); // Hide all
	showDiv(showID); // Show the one we asked for

}

//*****************************************************************************
// function to hide screen sections on content pages
//*****************************************************************************
function HideAllScreens(sectionnum) {
	var myScreens = Array('screen1','screen2', 'screen3', 'screen4','screen5', 'screen6', 'screen7','screen8', 'screen9','screen10') // Add each div screen ID to this array
	for(var i in myScreens) {
		if(document.getElementById(sectionnum + myScreens[i])) {
			document.getElementById(sectionnum + myScreens[i]).style.display = 'none';
			
		}
	}
}
// function to show screen sections on content pages
//*****************************************************************************
function ShowAllScreens() {
	var myScreens = Array('sec1screen1','sec1screen2', 'sec1screen3', 'sec1screen4','sec1screen5', 'sec1screen6', 'sec1screen7','sec1screen8', 'sec1screen9','sec1screen10','sec2screen2', 'sec2screen3', 'sec2screen4','sec2screen5', 'sec2screen6', 'sec2screen7','sec2screen8', 'sec2screen9','sec2screen10','sec3screen2', 'sec3screen3', 'sec3screen4','sec3screen5', 'sec3screen6', 'sec3screen7','sec3screen8', 'sec3screen9','sec3screen10','sec4screen2', 'sec4screen3', 'sec4screen4','sec4screen5', 'sec4screen6', 'sec4screen7','sec4screen8', 'sec4screen9','sec4screen10','sec5screen2', 'sec5screen3', 'sec5screen4','sec5screen5', 'sec5screen6', 'sec5screen7','sec5screen8', 'sec5screen9','sec5screen10','sec6screen2', 'sec6screen3', 'sec6screen4','sec6screen5', 'sec6screen6', 'sec6screen7','sec6screen8', 'sec6screen9','sec6screen10','sec7screen2', 'sec7screen3', 'sec7screen4','sec7screen5', 'sec7screen6', 'sec7screen7','sec7screen8', 'sec7screen9','sec7screen10','sec8screen2', 'sec8screen3', 'sec8screen4','sec8screen5', 'sec8screen6', 'sec8screen7','sec8screen8', 'sec8screen9','sec8screen10','sec9screen2', 'sec9screen3', 'sec9screen4','sec9screen5', 'sec9screen6', 'sec9screen7','sec9screen8', 'sec9screen9','sec9screen10','sec2screen1','sec3screen1','sec4screen1','sec5screen1','sec6screen1','sec7screen1','sec8screen1','sec9screen1') // Add each div screen ID to this array
	for(var i in myScreens) {
		if(document.getElementById(myScreens[i])) {
			document.getElementById(myScreens[i]).style.display = '';
			
		}
	}
}
//*****************************************************************************
// function to hide all but the first screen sections on content pages
//*****************************************************************************
function HideMostScreens(sectionnum) {
	var mostScreens = Array('screen2', 'screen3', 'screen4','screen5', 'screen6', 'screen7','screen8', 'screen9','screen10') // Add each div screen ID to this array
	for(var i in mostScreens) {
		if(document.getElementById(sectionnum + mostScreens[i])) {
			document.getElementById(sectionnum + mostScreens[i]).style.display = 'none';
			
		}
	}
}
//*********************************************
// Function that Shows a screen section, and hides the others
//*********************************************
function ShowScreens(sectionnum,divID)
{
	HideAllScreens(sectionnum); // Hide all
	var div = document.getElementById(sectionnum + divID);
	div.style.display = ""; //display div
}


//************remove all classes for each section*************//
function RemoveAllClasses(sectionnum) {
	var myTitles = Array('_title1','_title2', '_title3', '_title4','_title5', '_title6','_title7','_title8', '_title9', '_title10') // Add each div ID to this array
	for(var i in myTitles) {
		if(document.getElementById(sectionnum + myTitles[i])) {
			document.getElementById(sectionnum + myTitles[i]).className='';
			
		}
	}
}

//*********************************************
// Function that changes a title class to active
//*********************************************
function MakeActiveTitle(sectionnum,liID)
{
	
	RemoveAllClasses(sectionnum) 
	var title_class = document.getElementById(sectionnum + liID);
	title_class.className = "active";
}
//*********************************************
// Combo Function that takes three variables and shows the screens while changing the title class
//*********************************************
function ShowScreensCombo(sectionnum,screen_section,title_list)
{
	//new Effect.ScrollTo('scroll_to');
	ShowScreens(sectionnum,screen_section); /*update*/
	MakeActiveTitle(sectionnum,title_list);
	
}


//***********************************************
// Function that makes all button classes non-active
//***********************************************
function RemoveButtonClasses() {
	var myButtons = Array('awmAnchor-menu2-gr0', 'Button1','Button2', 'Button3', 'Button4','Button5', 'Button6','Button7','Button8', 'Button9','Button10','contactbutton') // Add each div ID to this array
	for(var i in myButtons) {
		if(document.getElementById(myButtons[i])) {
			document.getElementById(myButtons[i]).className='';
			
		}
	}
}

//*********************************************
// Function that changes a menu class to active
//*********************************************
function MakeActiveButton(buttonID)
{
	
	RemoveButtonClasses()
	var button_class = document.getElementById(buttonID);
	button_class.className = "active";
}

function MakeInactiveButton(buttonID)
{
	
	RemoveButtonClasses()
	var button_class = document.getElementById(buttonID);
	button_class.className = " ";
}
// Combo Function that takes two variables and shows the sections while changing the button class
//*********************************************
function ShowSectionsCombo(sectionnum,sectionid,buttonid)
{
	
		//new Effect.ScrollTo('scroll_to');
	HideMostScreens(sectionnum);
	ShowScreens(sectionnum,'screen1')
	MakeActiveTitle(sectionnum,'_title1')
	showDiv(sectionid);
	MakeActiveButton(buttonid);
	showthisDiv('share_section');

	
}

//  Function to show or hide the menu

//*********************************************
function Showmenu(buttonname)
	{;
		lightmenuButton(buttonname);
		awmShowGroup('menu2-gr0',0,3,0,0);

	
	}
	
	//  Function to hide the menu section
	function HideMenu()
	{
		
		
	MakeInactiveButton('awmAnchor-menu2-gr0');
	}

	//*********************************************
// Function that Shows an HTML element and doesn't hide anything else
//*********************************************
function showthisDiv(divID)
{
	
	var div = document.getElementById(divID);
	div.style.display = ""; //display div
}

	// Function that lights up a single button without unlighting other buttons
//*********************************************
function lightmenuButton(buttonID)
{
	
	
	var button_class = document.getElementById(buttonID);
	button_class.className = "active";
}
// Combo Function that shows the gallery (hides the sections) while changing the button class
//*********************************************
function ShowGalleryCombo(buttonid)
{
	//new Effect.ScrollTo('scroll_to');
	hideAllSections();
	
	showthisDiv('sectionG');
	MakeActiveButton(buttonid);
hideDiv('share_section');
	
}

/*this hides all sections, then shows the gallery*/
function GalleryStartup()
{
	
	hideAllSections();
	
	showthisDiv('sectionG');
	MakeActiveButton('Button1');
//new Effect.ScrollTo('scroll_to');
	
}
function LimitedStartup()
{
	
	
	MakeActiveButton('Button1');
	
}

var z_accordionItems = new Array();


function z_accordion_init() {
      // Grab the accordion items from the page
      var divs = document.getElementsByTagName( 'div' );
      for ( var i = 0; i < divs.length; i++ ) {
        if ( divs[i].className == 'z_accordionItem' ) z_accordionItems.push( divs[i] );
      }

      // Assign onclick events to the accordion item headings
      for ( var i = 0; i < z_accordionItems.length; i++ ) {
        var h2 = getFirstChildWithTagName( z_accordionItems[i], 'H2' );
        h2.onclick = toggleItem;
      }

     // Hide all accordion item bodies except the first
      for ( var i = 0; i < z_accordionItems.length; i++ ) {
        z_accordionItems[i].className = 'z_accordionItem hide';
      }
    }
    
    
function toggleItem() {
      var itemClass = this.parentNode.className;

      // Hide all items
      for ( var i = 0; i < z_accordionItems.length; i++ ) {
        z_accordionItems[i].className = 'z_accordionItem hide';
      }

      // Show this item if it was previously hidden
      if ( itemClass == 'z_accordionItem hide' ) {
        this.parentNode.className = 'z_accordionItem';

      }
    }
     function getFirstChildWithTagName( element, tagName ) {
      for ( var i = 0; i < element.childNodes.length; i++ ) {
        if ( element.childNodes[i].nodeName == tagName ) return element.childNodes[i];
      }
    }
	function showContactSection(buttonID) {
		showDiv('contact_section');
		MakeActiveButton(buttonID);
		hideDiv('share_section');
	}
	
	
