// JavaScript Document

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function KW_updateItems(d,o,fn) { //
	var i,s,l=MM_findObj(d),b,z=o.options[o.selectedIndex].value;
	var optioncount = 1;
        var level = document.getElementById("campusid");
	l.length=0;
	l.options[0]=new Option('Select one \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u2193','');
	b=(z!='nill')?eval('items_'+z):0;
	b.sort()
	for(i=0;i<b.length;i++){
			s=b[i].split("|");
			if (s[0] == 'Undecided') {
				
			}
			else {
				l.options[optioncount]=new Option(s[1],s[0]);
				optioncount++;
			}
	}
  l.selectedIndex=0;
  if (!fn) return;eval(fn)
}

function SetCampus(campusId) {
	var c = document.forms.contact.campusid;
	for(var i=0;i<c.options.length;i++) {
		if(c.options[i].value == campusId) { 
			c.options[i].selected = true; 
			KW_updateItems('program',c);
		}
	}
}

function ClearValue(o) {
	if(!o.cleared) {
		o.value = '';
		o.cleared = true;
	}
}

animatedcollapse.addDiv('step2', 'fade=1,height=auto')
animatedcollapse.init()

sfFocus = function() {
	var sfEls = document.getElementsByTagName("INPUT");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfFocus);

