// ============= SHOW KIDS FUNCTIONALITY =============

// JavaScript Document
// Global variables
var isCSS, isW3C, isIE4, isNN4;
// initialize upon load to let all browsers establish content objects
function initCommon() {
    if (document.images) {
        isCSS = (document.body && document.body.style) ? true : false;
        isW3C = (isCSS && document.getElementById) ? true : false;
        isIE4 = (isCSS && document.all) ? true : false;
        isNN4 = (document.layers) ? true : false;
        isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false;
    }
}
// set event handler to initialize API
window.onload = initCommon;

// Seek nested NN4 layer from string name
function seekLayer(doc, name) {
    var theObj;
    for (var i = 0; i < doc.layers.length; i++) {
        if (doc.layers[i].name == name) {
            theObj = doc.layers[i];
            break;
        }
        // dive into nested layers if necessary
        if (doc.layers[i].document.layers.length > 0) {
            theObj = seekLayer(document.layers[i].document, name);
        }
    }
    return theObj;
}

// Convert object name string or object reference
// into a valid element object reference
function getRawObject(obj) {
    var theObj;
    if (typeof obj == "string") {
        if (isW3C) {
            theObj = document.getElementById(obj);
        } else if (isIE4) {
            theObj = document.all(obj);
        } else if (isNN4) {
            theObj = seekLayer(document, obj);
        }
    } else {
        // pass through object reference
        theObj = obj;
    }
    return theObj;
}

// Convert object name string or object reference
// into a valid style (or NN4 layer) reference
function getObject(obj) {
    var theObj = getRawObject(obj);
    if (theObj && isCSS) {
        theObj = theObj.style;
    }
    return theObj;
}

// Set the visibility of an object to visible
function show(obj) {
    var theObj = getObject(obj);
    if (theObj) {
        theObj.display = "block";
    }
}

// Set the visibility of an object to hidden
function hide(obj) {
    var theObj = getObject(obj);
    if (theObj) {
        theObj.display = "none";
    }
}

function showkids() {
	if(document.getElementById('kids-selected').value=='0') {
		hide('kids-none');
		hide('kids-one');
		hide('kids-two');
		hide('kids-three');
		hide('kids-four');
		hide('kids-five');
	} else if(document.getElementById('kids-selected').value=='1') {
		show('kids-none');
		show('kids-one');
		hide('kids-two');
		hide('kids-three');
		hide('kids-four');
		hide('kids-five');
	} else if(document.getElementById('kids-selected').value=='2') {
		show('kids-none');
		show('kids-one');
		show('kids-two');
		hide('kids-three');
		hide('kids-four');
		hide('kids-five');
	} else if(document.getElementById('kids-selected').value=='3') {
		show('kids-none');
		show('kids-one');
		show('kids-two');
		show('kids-three');
		hide('kids-four');
		hide('kids-five');
	} else if(document.getElementById('kids-selected').value=='4') {
		show('kids-none');
		show('kids-one');
		show('kids-two');
		show('kids-three');
		show('kids-four');
		hide('kids-five');
	} else if(document.getElementById('kids-selected').value=='5') {
		show('kids-none');
		show('kids-one');
		show('kids-two');
		show('kids-three');
		show('kids-four');
		show('kids-five');
	}
}

function showkids1() {
	if(document.getElementById('kids-selected1').value=='0') {
		hide('kids-none1');
		hide('kids-one1');
		hide('kids-two1');
		hide('kids-three1');
		hide('kids-four1');
		hide('kids-five1');
	} else if(document.getElementById('kids-selected1').value=='1') {
		show('kids-none1');
		show('kids-one1');
		hide('kids-two1');
		hide('kids-three1');
		hide('kids-four1');
		hide('kids-five1');
	} else if(document.getElementById('kids-selected1').value=='2') {
		show('kids-none1');
		show('kids-one1');
		show('kids-two1');
		hide('kids-three1');
		hide('kids-four1');
		hide('kids-five1');
	} else if(document.getElementById('kids-selected1').value=='3') {
		show('kids-none1');
		show('kids-one1');
		show('kids-two1');
		show('kids-three1');
		hide('kids-four1');
		hide('kids-five1');
	} else if(document.getElementById('kids-selected1').value=='4') {
		show('kids-none1');
		show('kids-one1');
		show('kids-two1');
		show('kids-three1');
		show('kids-four1');
		hide('kids-five1');
	} else if(document.getElementById('kids-selected1').value=='5') {
		show('kids-none1');
		show('kids-one1');
		show('kids-two1');
		show('kids-three1');
		show('kids-four1');
		show('kids-five1');
	}
}

// ============= PROCESSING WINDOW FUNCTIONALITY =============
	function change(){
		document.getElementById("processing").className='hidediv';
		document.getElementById("loadedcontent").className='showdiv';
		// document.getElementById("imageheight").style.height = "1px";
	}
	
	function change_back(){
		document.getElementById("loadedcontent").className='showdiv';
		document.getElementById("processing").className='hidediv';
	}
	
// ============= HIDDEN TAB FUNCTIONALITY =============
	function expand(){
		document.getElementById("clicktoshow").className='hidediv';
		document.getElementById("clicktohide").className='showdiv';
		document.getElementById("contenttoshow").className='showdiv';
		// document.getElementById("imageheight").style.height = "1px";
	}
	
	function collapse(){
		document.getElementById("clicktoshow").className='showdiv';
		document.getElementById("clicktohide").className='hidediv';
		document.getElementById("contenttoshow").className='hidediv';
	}

// ============= OPEN MAP WINDOW =============    
    function openMap(URL) {
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=489,height=424,left = 390,top = 277.5');");
    }


// ============= TABS FUNCTIONALITY =============
function updButton(obj)
{
	var cls = obj.className;
	
	if(cls!='tab_selected')
	{
		if(cls=='tab')
		{
			cls = 'tab_highlight';
		}
		else
		{
			cls = 'tab';
		}
	}
	
	obj.className = cls;
}

function selectUpd(obj)
{
	for (var x = 1; x <= 4; x++)
	{
		document.getElementById("updButton"+x).className = 'tab';
		document.getElementById("updContent"+x).style.display = 'none';
	}
	
	obj.className='tab_selected';
	var tmp = obj.id;
	var num = tmp.substr(tmp.length-1);
	document.getElementById("updContent"+num).style.display = 'block';
}


function hidetabs(){
	document.getElementById("updContent2").className='tab_content hidediv';
	document.getElementById("updContent3").className='tab_content hidediv';
	document.getElementById("updContent4").className='tab_content hidediv';
}