//**********************************************************
//******   Function for switching between simple and full homepage
///*********************************************************

function togglehomepage()
{
	if (document.getElementById("simplehomepage").style.display == 'none') {
	
		document.getElementById("fullhomepage").style.display = 'none';
		document.getElementById("simplehomepage").style.display = 'block';
		document.getElementById("searchbar").style.display = 'none';
		
		document.getElementById("topNav_simplehomepagebar").style.display='none';
		document.getElementById("topNav_fullhomepagebar").style.display='block';
		
		//document.getElementById("topNav_fullhomepagebar").style.top = '148px';
		document.getElementById("topNav_fullhomepagebar").style.position = 'static';
		document.getElementById("topNav_fullhomepagebar").style.backgroundColor = 'white';
				
		document.getElementById('topNav_simplehomepagebarshadow').style.display='none';
		
	} else {
		document.getElementById("simplehomepage").style.display = 'none';
		document.getElementById("fullhomepage").style.display = 'block';
		document.getElementById("searchbar").style.display = 'block';
		
		document.getElementById("topNav_simplehomepagebar").style.display='block';
		document.getElementById("topNav_fullhomepagebar").style.display='none';
		
		document.getElementById("topNav_simplehomepagebar").style.backgroundColor = 'transparent';
		//document.getElementById("topNav_simplehomepagebar").style.top = "180px";
		document.getElementById("topNav_simplehomepagebar").style.position = "absolute";
		
		document.getElementById('topNav_simplehomepagebarshadow').style.display='block';
	}
	
}	

function togglefullhomepage()
{
	
}


//**********************************************************
//******	BEGIN COLLAPSING MENUS			****************
//**********************************************************
// This is a custom code for the creation of menu groups that expand and contract vertically when clicked.

var ArrayOfExpandableMenus = new Array ();

function initMenu(menuname){
	ArrayOfExpandableMenus.push(menuname);
	if (menuname != readCookie('currentexpandedmenu')){
	    document.getElementById(menuname + 'Container').style.display = 'none';
	}
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function expandmenu(menuname)
{
	var currentexpandedMenu = readCookie('currentexpandedmenu');

	if (menuname != currentexpandedMenu) {
				
		i = ArrayOfExpandableMenus.length-1;
		
		for (i; i >= 0; i--)
		{
			document.getElementById(ArrayOfExpandableMenus[i] + 'Container').style.display = 'none';
		} 			
		if (typeof(menuname) != "undefined"){			
			if ((typeof(document.getElementById(menuname + 'Container')) != "undefined") || 
				(!isnull(document.getElementById(menuname + 'Container'))) ) {
				document.getElementById(menuname + 'Container').style.display = 'block';
			}
		}
		currentexpandedMenu = menuname;

		var date = new Date();
		date.setTime(date.getTime()+(24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	
		document.cookie = "currentexpandedmenu="+menuname +expires+"; path=/";
	} 
	else {
		i = ArrayOfExpandableMenus.length-1;
		for (i; i >= 0; i--)
		{
			document.getElementById(ArrayOfExpandableMenus[i] + 'Container').style.display = 'none';
		}
		currentexpandedMenu = "";
		var date = new Date();
		date.setTime(date.getTime()+(-1*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	
		document.cookie = "currentexpandedmenu="+expires+"; path=/";
	}
	
}
//**********************************************************
//******	END COLLAPSING MENUS			****************
//**********************************************************






//**********************************************************
//******	BEGIN CONTENT SLIDESHOW 		****************
/* *********************************************************
* Advanced Gallery script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var tickspeed=50000 //ticker speed in miliseconds (2000=2 seconds)
var displaymode="manual" //displaymode ("auto" or "manual"). No need to modify as form at the bottom will control it, unless you wish to remove form.

if (document.getElementById){
	document.write('<style type="text/css">\n')
	document.write('.gallerycontent{display:none;}\n')
	document.write('</style>\n')
}

var selectedDiv=0;
var totalDivs=0;
var partscollect=new Array();

function slideshowgetElementbyClass(classname){
	partscollect=new Array();
	var inc=0;
	var alltags=document.all? document.all.tags("DIV") : document.getElementsByTagName("*");
	for (i=0; i<alltags.length; i++){
		if (alltags[i].className==classname)
	partscollect[inc++]=alltags[i];
	}
}

function contractall(){
	var inc=0
	while (partscollect[inc]){
		partscollect[inc].style.display="none"
		inc++
	}
}
function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object 
   for (var i in obj) {
      // if a parent (2nd parameter) was passed in, then use that to 
      // build the message. Message includes i (the object's property name) 
      // then the object's property value on a new line 
      if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
      // Display the message. If the user clicks "OK", then continue. If they 
      // click "CANCEL" then quit this level of recursion 
      if (!confirm(msg)) { return; }
      // If this property (i) is an object, then recursively process the object 
      if (typeof obj[i] == "object") { 
         if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
      }
   }
}

function expandone(){
	var selectedDivObj=partscollect[selectedDiv]
	contractall()
	//dumpProps(document)
	//selectedDivObj.style.display="block"
	if (document.gallerycontrol)
		temp.options[selectedDiv].selected=true
	selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
	if (displaymode=="auto")
	autocontrolvar=setTimeout("expandone()",tickspeed)
}

//function expandnext()
//{
//	selectedDiv +=1;
//	expandone();
//}

function populatemenu(){
	temp=document.gallerycontrol.menu
	for (m=temp.options.length-1;m>0;m--)
		temp.options[m]=null
	for (i=0;i<totalDivs;i++){
		var thesubject=partscollect[i].getAttribute("subject")
		thesubject=(thesubject=="" || thesubject==null)? "HTML Content "+(i+1) : thesubject
		temp.options[i]=new Option(thesubject,"")
	}
	temp.options[0].selected=true
}

function manualcontrol(menuobj){
	if (displaymode=="manual"){
		selectedDiv=menuobj
		expandone()
	}
}

function preparemode(themode){
	displaymode=themode
	if (typeof autocontrolvar!="undefined")
		clearTimeout(autocontrolvar)
	if (themode=="auto"){
		//document.gallerycontrol.menu.disabled=true
		autocontrolvar=setTimeout("expandone()",tickspeed)
	}
	//else
		//document.gallerycontrol.menu.disabled=false
}


function startgallery(){
//alert('gallery started');
	if (document.getElementById("controldiv")) //if it exists
		document.getElementById("controldiv").style.display="block"
	//	alert('attempting to call slideshowgetElementbyClass');
	slideshowgetElementbyClass("gallerycontent");
//	alert ('totaldivs: ' + totalDivs);
	totalDivs=partscollect.length
	if (document.gallerycontrol){
		populatemenu()
		if (document.gallerycontrol.mode){
			for (i=0; i<document.gallerycontrol.mode.length; i++){
				if (document.gallerycontrol.mode[i].checked)
					displaymode=document.gallerycontrol.mode[i].value
			}
		}
	}
	if (displaymode=="auto" && document.gallerycontrol)
		document.gallerycontrol.menu.disabled=true
	expandone()
}

//**********************************************************
//******	END CONTENT SLIDESHOW 		********************
//**********************************************************


//**********************************************************
//******	BEGIN DROP IN CONTENT		   *****************
/***********************************************************
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use */

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){
	if (!dom&&!ie&&!ns4)
		return
	crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	crossobj.top=scroll_top-250+calunits
	crossobj.visibility=(dom||ie)? "visible" : "show"
	dropstart=setInterval("dropin()",50)
}	
	

function dropin(){
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	if (parseInt(crossobj.top)<100+scroll_top)
		crossobj.top=parseInt(crossobj.top)+40+calunits
	else{
		clearInterval(dropstart)
		bouncestart=setInterval("bouncein()",50)
	}
}

function bouncein(){
	crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
	if (bouncelimit<0)
		bouncelimit+=8
	bouncelimit=bouncelimit*-1
	if (bouncelimit==0){
	clearInterval(bouncestart)
	}
}

function dismissbox(){
	if (window.bouncestart) clearInterval(bouncestart)
		crossobj.visibility="hidden"
}

function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = ""
	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;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}

function dropornot(){
	if (get_cookie("droppedin")==""){
		window.onload=initbox
		document.cookie="droppedin=yes"
	}
}


//**********************************************************
//******	END DROP IN CONTENT 			****************
//**********************************************************


function jsPrint(){
if (window.print)
	window.print();
else {
	alert('Sorry your browser does not support printing using Javascript.  Please use the Print button on your browser to print this page. ');
}
}

