function NewWindow(mypage, myname, w, h, scroll) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,location=yes,status=yes,toolbar=yes,menubar=yes'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function NewWindow_No_loc(mypage, myname, w, h, scroll) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable,location=no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}



function openwin_flexible(url, popWidth, popHeight, popLocation, popScroll, popStatus,resizable) {
	var winName =  "popup";
	// popStatus is a new parameter; it is optional so that old calls will not cause an error
	var statusBar = popScroll; 
	var winLeft = screen.width - popWidth - 100;
	win=window.open(url, winName, 'width=' + popWidth + ',height=' + popHeight + ',screenX=25,screenY=' + winLeft + ',left=' + winLeft + ',top=100,menubar,toolbar,location=' + popLocation + ',scrollbars=' + popScroll + ',resizable='+  resizable +',status=' + statusBar + '');
	if (win.opener == null) win.opener = self;
	win.focus();
}

// js for css dropdown menus (fixes IE css bug)
over = function() {
        var sfEls = document.getElementById("nav").getElementsByTagName("LI");
        for (var i=0; i<sfEls.length; i++) {
                sfEls[i].onmouseover=function() {
                        this.className+=" over";
                }
                sfEls[i].onmouseout=function() {
                        this.className=this.className.replace(new RegExp(" over\\b"), "");
                }
        }
        var sfEls = document.getElementById("flyout").getElementsByTagName("LI");
        for (var i=0; i<sfEls.length; i++) {
                sfEls[i].onmouseover=function() {
                        this.className+=" over";
                }
                sfEls[i].onmouseout=function() {
                        this.className=this.className.replace(new RegExp(" over\\b"), "");
                }
        }
}
if (window.attachEvent) window.attachEvent("onload", over);




/* Toggle which div is visible - turn the current one on and the old one off  */

/* get a reference to the object */
function getRef(id) {
        return (document.getElementById ? document.getElementById(id) : document.all[id]);
}	

/* Define this on the page in question!

var defaultDiv = "oneDiv";  // change this to the name of the initial div shown on the page

*/
var oldDivObj;
var firstRun = true;

function changeDiv(divName){

    var newDivObj = getRef(divName);
    
    if(firstRun){ // first time run - don't switch off oldDiv
        oldDivObj = getRef(defaultDiv);
        oldDivObj.style.display = "none";
        newDivObj.style.display = "block";
        oldDivObj.style.visibility = "hidden";
        newDivObj.style.visibility = "visible";
        firstRun = false;
    } else {
        oldDivObj.style.display = "none";
        newDivObj.style.display = "block";
        oldDivObj.style.visibility = "hidden";
        newDivObj.style.visibility = "visible";
    }
    
    oldDivObj = newDivObj; // store the value of the last shown div		
}
