/*


*/
//GLOBAL VARIABLE DEFINITION Block
var childItem = new Object();

// Check for new browser which supports DOM

function DOMbrowser(){
	var browser = (((navigator.appName == "Netscape") &&	(parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))
	if (browser) {
		return true;
	}else{
		window.status = "Your current browser does not support the W3C DOM specification required to display this functionality";
		return false;
	}
}//DOMbrowser

	function showLocation(selectBox){
		var region = selectBox.options[selectBox.selectedIndex].value
		var url = new String('show_location.html?region=' + region);
		//var name = new String(region + Math.random().toString().substring(2, 6));
		//window.open(url, name , 'resizable=yes, scrollbars=no, height=440, width=500');
		var locationsWindow = window.open(url, "locationsWindow", 'resizable=yes, scrollbars=no, height=480, width=500');
		selectBox.selectedIndex = 0;
		locationsWindow.focus();
	}//showLocation

	function showQuestion(){
		var questionWindow = window.open('services_schools_qst.html', 'Questionnaire', 'resizable=yes, scrollbars=no, height=440, width=440');
		questionWindow.focus();
	}
	
// Fly-out menu code block

function showSubMenu(item){
	if (DOMbrowser() == true){
	        //showMenu(item); // rem for no multilevel display
	        //flipItem(item);
	        childItem = document.getElementById('sm_' + item.id.substr(3, item.id.length));
	        childItem.style.position="absolute";
// sticks menu out on bottom (vv)
	        childItem.style.pixelLeft = item.getBoundingClientRect().left + 21;
	        if ((item.getBoundingClientRect().bottom + childItem.offsetHeight > window.document.body.clientHeight) && (window.document.body.clientHeight - childItem.offsetHeight > window.document.body.scrollTop)) {
	            childItem.style.pixelTop = window.document.body.clientHeight - childItem.offsetHeight + window.document.body.scrollTop;
	        }else{//if
	            childItem.style.pixelTop = item.getBoundingClientRect().bottom - 3 + window.document.body.scrollTop;
	        }//else
	        childItem.style.zIndex = item.style.zIndex + 100;
	       showItem();
	}//if
// sticks menu out on the right (>>)
/*
	        childItem.style.pixelLeft = item.getBoundingClientRect().right + 4;
	        if ((item.getBoundingClientRect().top + childItem.offsetHeight > window.document.body.clientHeight) && (window.document.body.clientHeight - childItem.offsetHeight > window.document.body.scrollTop)) {
	            childItem.style.pixelTop = window.document.body.clientHeight - childItem.offsetHeight + window.document.body.scrollTop;
	        }else{//if
	            childItem.style.pixelTop = item.getBoundingClientRect().top + window.document.body.scrollTop;
	        }//else
*/
}//showSubMenu

function showMenu(item){
	if (DOMbrowser() == true){
	    showParentItem(item);
	    var mm = getParentItems(item.id);
	    if (mm[0]){
	        childItem = document.getElementById(mm[0]);
	        //window.setTimeout(showItem, 200);
	        showItem();
	    }//if
	}//if
}//showMenu

function hideSubMenu(item){
	if (DOMbrowser() == true){
	    hideMenu(item);
	    //flipItem(item);
	    childItem = document.getElementById('sm_' + item.id.substr(3, item.id.length));
	    //window.setTimeout(hideItem, 200);
	    hideItem();
	}//if
}//hideSubMenu

function hideMenu(item){
	if (DOMbrowser() == true){
	    hideParentItem(item);
	}//if
}//hideMenu

function showItem(){
    childItem.style.display = '';
}//showItem

function hideItem(){
    childItem.style.display = 'none';
}//hideItem

function hideParentItem(item){
    var mm = getParentItems(item.id);
    if (mm[0]){
        for (p= 0; p < mm.length ; p++){ //>
            childItem = document.getElementById(mm[p]);
            //window.setTimeout(hideItem, 200);
            hideItem();
        }//for
    }//if
}//hideParentItem

function showParentItem(item){
/* rem for no multilevel display
    var mm = getParentItems(item.id);
    if (mm[0]){
        for (p= 0; p < mm.length ; p++){ //>
            childItem = document.getElementById(mm[p]);
            //window.setTimeout(showItem, 200);
            showItem();
        }//for
    }//if
*/
}//showParentItem

function getParentItems(itemID){
    var resultString = itemID.split('_');
    var mm = new Array();
    var sm = 'sm';
    for (i=2; i< resultString.length; i++){
        for (j=i; j < resultString.length; j++){//>
            sm = (sm + "_" + resultString[j]);
        }//for
        mm[i-2] = sm;
        sm = 'sm';
    }//for
    return mm;
}//getParentItems

function flipItem(item){
    if (item.className.substr(0,3) == 'nav'){
        item.className = 'exp' + item.className.substr(3,item.className.length);
    }else{//if
        item.className = 'nav' + item.className.substr(3,item.className.length);
    }//else
}//flipItem

function flipImage(image){
    var imageSrc = image.src.split('images/');
    if (imageSrc[1].substr(0,3) == 'nav'){
        imageSrc[1] = 'exp' + imageSrc[1].substr(3,imageSrc[1].length);
    }else{//if
        imageSrc[1] = 'nav' + imageSrc[1].substr(3,imageSrc[1].length);
    }//else
    image.src = imageSrc[0] + "images/" + imageSrc[1];
}//flipImage