// Custom JavaScript File

// Collapsible Header Function
function min_hdr() {
// Collapsible Header Area
/* In the theme 'Lifetree', the header area is 370px high!
       -You may collapse or expand the header area by clicking
	the switch link in the upper left page corner. */
// Read current Cookie value
x = readCookie('nia_hdr');

if (x == "Closed") {
createCookie("nia_hdr","Open",365);
// Previous status is Closed; Open the 'header' div to 370px
// Move 'logo' div down from top of page
e=document.getElementById("logo");
e.style.top = '135px';
// Open the 'header' div to 370px and add background image
f=document.getElementById("header");
f.style.backgroundColor='#d1731b';
f.style.backgroundImage="url('../wp-content/themes/lifetree/images/header-bg.jpg')";
f.style.height = '370px';
// Place updated switch link at the top left corner of page
h=document.getElementById("switch");
h.innerHTML="<a href='javascript:void(0)' onMouseOver='wipe();return true;' onClick='min_hdr();'><img src='../wp-content/themes/lifetree/custom/images/switch.gif' border='0' alt='switch-Open' title='switch-Open' /></a>";
}
else if (x == "Open")
{
createCookie("nia_hdr","Closed",365);
// Previous status is Open; Header will be closed to 100px height
// Move 'logo' div up from 135px to 10px from top
e=document.getElementById("logo");
e.style.top = '10px';
// Close the 'header' div to 100px and remove image from header div
f=document.getElementById("header");
f.style.backgroundColor='#d1731b';
f.style.backgroundImage='none';
f.style.height = '100px';
// Place updated switch link at the top left corner of page
h=document.getElementById("switch");
h.innerHTML="<a href='javascript:void(0)' onMouseOver='wipe();return true;' onClick='min_hdr();'><img src='../wp-content/themes/lifetree/custom/images/switch.gif' border='0' alt='switch-Closed' title='switch-Closed' /></a>";
}
// End of min_hdr
}

function hdr_status() {

x = readCookie('nia_hdr');
if (x) {
/* [do something with x]*/
// x is the current status going into this function

if (x == "Open") {

f=document.getElementById("header");
f.style.backgroundColor='#d1731b';
f.style.backgroundImage="url('../wp-content/themes/lifetree/images/header-bg.jpg')";
f.style.height = '370px';
// Move 'logo' div down from 10px to 135px
e=document.getElementById("logo");
e.style.top = '135px';
h=document.getElementById("switch");
h.innerHTML="<a href='javascript:void(0)' onMouseOver='wipe();return true;' onClick='min_hdr();'><img src='../wp-content/themes/lifetree/custom/images/switch.gif' border='0' alt='switch-Open' title='switch-Open' /></a>";

}
else
{
/* Do nothing; Page opens in closed mode always
	and hdr_status will open 'header' if cookie 'nia_hdr'=Open */




}

}
else
{

// Cookie doesn't exist!
f=document.getElementById("header");
// Double-check 'header' height
var T = f.style.height;
// Set nia_hdr cookie with appropriate status as per 'header' height
if (T == '370px') { createCookie("nia_hdr","Open",365); }
else
{ createCookie("nia_hdr","Closed",365); }


}
}

//erase status bar or give it a desired message here (between quotes)
function wipe(option) {window.status= " ";}

