var lastLayer = null;     
var lastImg = null;
var initInd = 0;

    
	// returns ordinal of the first "Parent" layer
     function getIndex(el) {
         ind = null;
         for (i=0; i<document.layers.length; i++) {
             whichEl = document.layers[i];
             if (whichEl.id == el) {
                 ind = i;
                 break;
             }
         }
         return ind;
     }
	
		
	// NN4 fix to arrange layers end to end
	function arrange(leftoff,topoff) { 
         nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
         for (i=firstInd+initInd; i<document.layers.length; i++) {
             initInd = 1;
             whichEl = document.layers[i];
             if (whichEl.visibility != "hide") {
                 whichEl.pageX = leftoff;
                 whichEl.pageY = nextY;
                 nextY += whichEl.document.height;
             }
         }  
     }

     function initIt(){
         if (!is_OK) return;
         if (NS4) {
             for (i=0; i<document.layers.length; i++) {
                 whichEl = document.layers[i];
                 if (whichEl.id.toUpperCase().indexOf("C") != -1) whichEl.visibility = "hide";
             }
             arrange(leftoff,0);
         }
         if(IE4 || DOM) {
             if(IE4 && !DOM) {
			 	divColl = document.all.tags("DIV");
				for (i=0; i<divColl.length; i++) {
	                 whichEl = divColl(i);
	                 if (whichEl.className.toUpperCase() == "CHILD") whichEl.style.display = "none";	
				}
			}
			if(DOM) {
				divColl = document.getElementsByTagName("DIV"); 
	             for (i=0; i<divColl.length; i++) {
	                 whichEl = divColl[i];
	                 if (whichEl.className.toUpperCase() == "CHILD") 
					 	whichEl.style.display = "none";
             	}
			 }
		}
     }

     function expandIt(el) {
         if (!is_OK) return;
         if (IE4) {
             whichEl = eval("C" + el);
             if (whichEl.style.display == "none" || whichEl.style.display == "") { //show it
                 whichEl.style.display = "block";
                 
                 if (lastLayer != null) {
					lastLayer.style.display = "none";
					}
				lastLayer = whichEl;

                } 
             else {
                 whichEl.style.display = "none";
                 lastLayer = null;
             }
        }
         if(NS4) {
             whichEl = eval("document.C" + el);
             whichIm = eval("document.P" + el + ".document.images['imEx']");
             if (whichEl.visibility == "hide") {
                 whichEl.visibility = "show";
                 
                 if (lastLayer != null) {
					lastLayer.visibility = "hide";

					}
				lastLayer = whichEl;
             }
             else {
                 whichEl.visibility = "hide";
                 lastLayer = null;
             }
             arrange(leftoff,0);
         }
		 if(DOM && !IE4){
		 	whichEl = "C" + el;
                                
             if (document.getElementById(whichEl).style.display == "none" || document.getElementById(whichEl).style.display == "") { //show it
				  document.getElementById(whichEl).style.display = "block";
                 
                 if (lastLayer != null) {
					document.getElementById(lastLayer).style.display = "none";
					}
				lastLayer = whichEl;
                } 
             else {
                 document.getElementById(whichEl).style.display = "none";
                 lastLayer = null;
             }
		 }
     }


/* resize.js 0.3 970811
 * by gary smith
 * js component for "reloading page onResize"
 */

if(!window.saveInnerWidth) {
  window.onresize = resize;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}

function resize() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}

