// javascript to run when items are clicked in Wizard.

var wizCSSrules={
	'.filter_content .filter_value input' : function(e) {
		e.onkeyup=function(e) {
			// if user presses Enter, start the search...
			try {
				if (e.which==13) wiz_Search();
			}
			catch (e) { }
		}
	},
	'.wizard_box ul li' : function(e) {
			e.onclick=function() {
				var curClass;
				curClass=this.className;
				if (!curClass.match(/(univ_name|none)/)) {
				// toggle selection of program on/off...

					if (curClass.match(/selected/)) {
						if (curClass.match(/alt_/)) this.className="alt";
						else this.className="";
					}
					else {
						if (curClass.match(/alt/)) this.className="alt_selected";
						else this.className="selected";
					}
				}
				else if (curClass.match(/univ_name/)) {
				// select/unselect all the programs under this university...
					
					var column,univ_id,numProgs,numSel;

					if (this.id.match(/(\w)u(\d+)_(\d+)/)) {
						column=RegExp.$1;
						univ_id=RegExp.$2;
						numProgs=RegExp.$3;
					}
					numSel=0;

					// determine if all are selected or not...
					for (p=0;p<numProgs;p++) {
						o=document.getElementById(column+univ_id+"_"+p);
						if ((o)&&(o.className.match(/selected/))) numSel++;
					}
					// then loop through and turn them all on or off...
					for (p=0;p<numProgs;p++) {
						o=document.getElementById(column+univ_id+"_"+p);
						if (o) {
							//alert(o.className);
							if ((o.className.match(/selected/))&&(numSel==numProgs)) {
								if (o.className=="alt_selected") o.className="alt";
								else o.className="";
							}
							else if (numSel<numProgs) o.className=(o.className.match(/alt/))?"alt_selected":"selected";
						}
					}

					//for (

				}
			}
		}

};
Behavior.register(wizCSSrules);
