// JScript File

function showStart(cntrl){
     var cPanel = document.getElementById(cntrl);
     cPanel.style.display = 'block';
}

function hideStart(cntrl){
     var cPanel = document.getElementById(cntrl);
     cPanel.style.display = 'none';
}
		
function showHide(cntrl, hidCntrl, test){
    var cTest = document.getElementById(cntrl);
    var cPanel = document.getElementById(hidCntrl);
    
    if (cTest.options[cTest.selectedIndex].value == test){
        cPanel.style.display = 'block';
    } else {
        cPanel.style.display = 'none';
    }
}	

function showHideMultiple(cntrl, hidCntrl, test){
    var cTest = document.getElementById(cntrl);
    var cPanel = document.getElementById(hidCntrl);
    var optionFound = false;
    
    for (var i = 0; i < cTest.options.length; i++) { 
		if (cTest.options[i].selected && cTest.options[i].value == test) {
		    optionFound = true;
		    break;
		}
	}
    
    if (optionFound){
        cPanel.style.display = 'block';
    } else {
        cPanel.style.display = 'none';
    }
}

function showHideMultipleMulti(cntrl, hidCntrl, test1, test2){
    var cTest = document.getElementById(cntrl);
    var cPanel = document.getElementById(hidCntrl);
    var optionFound = false;
    
    for (var i = 0; i < cTest.options.length; i++) { 
		if (cTest.options[i].selected && cTest.options[i].value == test1) optionFound = true;
		if (cTest.options[i].selected && cTest.options[i].value == test2) optionFound = true;
	}
    
    if (optionFound){
        cPanel.style.display = 'block';
    } else {
        cPanel.style.display = 'none';
    }
}

function checkOther(cntrl, tbxCntrl, otherValue){
    var success = true;
    var foundOther = false;
    
    var list = document.getElementById(cntrl);
    var tbx = document.getElementById(tbxCntrl);
    
    for (var i = 0; i < list.length; i++) { 
		if (list.options[i].value == otherValue && list.options[i].selected) {
				foundOther = true;
		}
	}
	
	if (foundOther && tbx.value == '') {
	    success = false;
	}
   
    return success;
}

function popup(loc, width, height, scrolling) {
	if(!width){width=400}
	if(!height){height=300}
	if(!scrolling){scrolling=0}

	var cTop = (screen.availHeight/2) - (height/2);
    var cLeft = (screen.availWidth/2) - (width/2);
   	var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no';
	var myOptions = 'scrollbars='+scrolling+',width='+width+'px,height='+height+'px,top='+cTop+',left='+cLeft+',resizable=no';
	var myFeatures = myBars + "," + myOptions;
	window.open(loc, '', myFeatures);
}

function validateSearch(myForm) {
	if(myForm.zoom_query.value == "") {
		alert("Please enter a search phrase");
		return false;
	} else {
		return true;
	}
}

function printYear(){
	var today = new Date();
	document.write(today.getFullYear());
}

function selectMenu(){
    var menuUL = document.getElementById("subMenu");
    if (menuUL != null) {
        var menuItems = menuUL.getElementsByTagName("A");
        for (var i = 0; i < menuItems.length; i++) { 
			if (menuItems[i].href == window.location.href) {
			    menuItems[i].className = "active_item";
			}
		}
    }
}

function flashWrite(flashfile,x,y,flashvar) {
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ x +"' height='"+ y +"'>");
	document.write("<param name='movie' value='"+ flashfile +"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='flashvars' value='"+ flashvar +"' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='"+ flashfile +"' wmode='transparent' ");
	document.write("flashvars='"+ flashvar +"'  ");
	document.write("quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ x +"' height='"+ y +"'></embed>");
	document.write("</object>");
}