<!--

var isNav;
var agt=navigator.userAgent.toLowerCase()
// *** BROWSER VERSION ***
major = parseInt(navigator.appVersion)
minor = parseFloat(navigator.appVersion)
var isNav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1))) && (this.major >= 4)

var currentForm="";

// s=submit, b=button, f=form
function changeButton(b,f,theMessage)
{
	b.value=theMessage;
}

function openWindow(file,window) {
	//if the code has passed more than 2 parameters, then include the form values
	if (openWindow.arguments.length > 2){
		//test the third argument to see if it is the form, otherwise use forms[0]
		if (document.forms[openWindow.arguments[2]]){
			formName="document.forms['" + openWindow.arguments[2] + "'].";
			startPoint=3;
		}
		else{
			formName = "document.forms[0].";
			startPoint=2;
		}

		//loop over remaining arguments
		
		for (i=startPoint; i< openWindow.arguments.length; i++){
			//get the field
			field = eval(formName + "elements['" + openWindow.arguments[i] + "']");
			
			//get the value of the field
			if (field.type=="select" || field.type=="select-one"){
				passValue=field[field.selectedIndex].value;
			}
			else{
				passValue=field.value;
			}
			
			//append the field name and value to the file being called
			if (file.indexOf("?") < 0){
				file = file + "?" + openWindow.arguments[i] + "=" + escape(passValue);
			}
			else{
				file = file + "&" + openWindow.arguments[i] + "=" + escape(passValue);
			}
		}
	}

	
	msgWindow=open(file,window,'scrollbars=yes,resizable=no,width=640,height=400');
	if (msgWindow.opener == null) msgWindow.opener = self;
}



function updateHiddenText(h,v){
	if (v.type=="select" || v.type=="select-one"){
		h.value=v[v.selectedIndex].text;
	}
	else{
		h.value=v.value;
	}
}


function init()
{
  if (isNav)
    {
      document.captureEvents(Event.KEYPRESS);
      document.onkeypress=processEvent;
    }
}
function processEvent(event)
{
    var theKey;
    theKey = event.which;
    if (theKey == 13 && currentForm.length!=0)
	{
		document.forms[currentForm].submit();
		//alert("Current Form: " + currentForm);
	}
    return theKey;
}
//LocationType and ParentLocation are optional, they default to City and Country 
function loadLocation(theFrame, theForm, theField, State_cd, County_cd, LocationType, home){
	
	tempLoc=LocationType+"";
	tempLoc=tempLoc.toLowerCase();
	
	parentLoc="";
	//alert("tempLoc1:"+tempLoc);

	if (parentLoc=="undefined") parentLoc="";
	
	if (tempLoc=="undefined" || tempLoc=="" || tempLoc=="county"){
			tempLoc="County";
			parentLoc="State";
	}
	else if (tempLoc=="county"){
			parentLoc="City";
	}
	//alert("parentLoc:"+parentLoc);
	//alert("State_cd:"+State_cd);
	//alert("County_cd:"+County_cd);
	//alert("theForm.name:"+theForm.name);
	//alert("theField.name:"+theField.name);

	//setup a list of parent and child frames
	if (State_cd != ""){
		theFrames="frames['" + theFrame.name + "']";
		curFrame=theFrame;
		while (curFrame.parent != top){
			curFrame = curFrame.parent;
			theFrames = "frames['" + curFrame.name + "']." + theFrames
		}
		
		newHref = home + '/Reloads/index.cfm?action=loadlocation&LocationType=' + tempLoc + '&State_cd=' + State_cd + '&County_cd=' + County_cd + '&formname=' + theForm.name + '&fieldName=' + theField.name + '&frames=' + theFrames;
	
		top.frames['Reload'].location.href = newHref;
		theField.text="Loading...";
		theField.selectedIndex=0;
		theField.length=1;
	}
	else{
		theField.length=2;
		theField[1].text="(Please select a " + parentLoc + ")";
		theField.selectedIndex=1;
		theField.length=10;
	}
}
function switchPage(firstRec){
	document.forms[0].NEWQUERY.value=0;
	document.forms[0].STARTROW.value=firstRec;
	document.forms[0].submit();
}
function changeOrder(orderBy){
	document.forms[0].action = document.forms[0].action + "?OrderBy=" + orderBy;
	document.forms[0].submit();
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
function changeAction(f,val)
{
	f.Action.value=val;
	f.submit();
	return 1;
}
function CaseAction(f,val)
{
	if (val=="R")
	{
	f.Case_Action_R.value="checked";
	f.Case_Action_W.value="";
	}
	else
	{
	f.Case_Action_W.value='checked';
	f.Case_Action_R.value="";
	}
	return 1;
}
function cGradeStaff(fm,gr,a,b,c,d,e,f,aa,ab,ac,ad,ae,af)
{
	fm.grade.value = gr;
	fm.Begin_Authorized.value = a;
	fm.Begin_On_board.value = b;
	fm.Begin_Vacancies.value = c;
	fm.End_Authorized.value = d;
	fm.End_On_board.value = e;
	fm.End_Vacancies.value = f;
	fm.Recruit_Goal.value = aa;
	fm.Offers.value = ab;
	fm.Hires.value = ac;
	fm.Losses.value = ad;
	fm.Quits.value = ae;
	fm.Quits_For_Pay.value = af;
	return 1;
}
function cGradeOptions(fm,gr,ps,si,o1,o2,o3,o4,o5,o6,o7)
{
	fm.grade.value = gr;
	fm.Private_Sector.value = ps;
	if (si==0) 
	{fm.StepInterval.value = '';}
	else
	{fm.StepInterval.value = si;}
	fm.Option_number1.value = o1;
	fm.Option_number2.value = o2;
	fm.Option_number3.value = o3;
	fm.Option_number4.value = o4;
	fm.Option_number5.value = o5;
	fm.Option_number6.value = o6;
	fm.Option_number7.value = o7;
	return 1;
}
function clearRowST(f,grade)
{
	if(grade == 1) {
		f.step_Interval_1.value="";f.step1_rate_1.value="";f.step2_rate_1.value="";f.step3_rate_1.value="";
		f.step4_rate_1.value="";f.step5_rate_1.value="";f.step6_rate_1.value="";f.step7_rate_1.value="";
		f.step8_rate_1.value="";f.step9_rate_1.value="";f.step10_rate_1.value="";
	}
	if(grade == 2) {
		f.step_Interval_2.value="";f.step1_rate_2.value="";f.step2_rate_2.value="";f.step3_rate_2.value="";
		f.step4_rate_2.value="";f.step5_rate_2.value="";f.step6_rate_2.value="";f.step7_rate_2.value="";
		f.step8_rate_2.value="";f.step9_rate_2.value="";f.step10_rate_2.value="";
	}
	if(grade == 3) {
		f.step_Interval_3.value="";f.step1_rate_3.value="";f.step2_rate_3.value="";f.step3_rate_3.value="";
		f.step4_rate_3.value="";f.step5_rate_3.value="";f.step6_rate_3.value="";f.step7_rate_3.value="";
		f.step8_rate_3.value="";f.step9_rate_3.value="";f.step10_rate_3.value="";
	}
	if(grade == 4) {
		f.step_Interval_4.value="";f.step1_rate_4.value="";f.step2_rate_4.value="";f.step3_rate_4.value="";
		f.step4_rate_4.value="";f.step5_rate_4.value="";f.step6_rate_4.value="";f.step7_rate_4.value="";
		f.step8_rate_4.value="";f.step9_rate_4.value="";f.step10_rate_4.value="";
	}
	if(grade == 5) {
		f.step_Interval_5.value="";f.step1_rate_5.value="";f.step2_rate_5.value="";f.step3_rate_5.value="";
		f.step4_rate_5.value="";f.step5_rate_5.value="";f.step6_rate_5.value="";f.step7_rate_5.value="";
		f.step8_rate_5.value="";f.step9_rate_5.value="";f.step10_rate_5.value="";
	}
	if(grade == 6) {
		f.step_Interval_6.value="";f.step1_rate_6.value="";f.step2_rate_6.value="";f.step3_rate_6.value="";
		f.step4_rate_6.value="";f.step5_rate_6.value="";f.step6_rate_6.value="";f.step7_rate_6.value="";
		f.step8_rate_6.value="";f.step9_rate_6.value="";f.step10_rate_6.value="";
	}
	if(grade == 7) {
		f.step_Interval_7.value="";f.step1_rate_7.value="";f.step2_rate_7.value="";f.step3_rate_7.value="";
		f.step4_rate_7.value="";f.step5_rate_7.value="";f.step6_rate_7.value="";f.step7_rate_7.value="";
		f.step8_rate_7.value="";f.step9_rate_7.value="";f.step10_rate_7.value="";
	}
	if(grade == 8) {
		f.step_Interval_8.value="";f.step1_rate_8.value="";f.step2_rate_8.value="";f.step3_rate_8.value="";
		f.step4_rate_8.value="";f.step5_rate_8.value="";f.step6_rate_8.value="";f.step7_rate_8.value="";
		f.step8_rate_8.value="";f.step9_rate_8.value="";f.step10_rate_8.value="";
	}
	if(grade == 9) {
		f.step_Interval_9.value="";f.step1_rate_9.value="";f.step2_rate_9.value="";f.step3_rate_9.value="";
		f.step4_rate_9.value="";f.step5_rate_9.value="";f.step6_rate_9.value="";f.step7_rate_9.value="";
		f.step8_rate_9.value="";f.step9_rate_9.value="";f.step10_rate_9.value="";
	}
	if(grade == 10) {
		f.step_Interval_10.value="";f.step1_rate_10.value="";f.step2_rate_10.value="";f.step3_rate_10.value="";
		f.step4_rate_10.value="";f.step5_rate_10.value="";f.step6_rate_10.value="";f.step7_rate_10.value="";
		f.step8_rate_10.value="";f.step9_rate_10.value="";f.step10_rate_10.value="";
	}
	if(grade == 11) {
		f.step_Interval_11.value="";f.step1_rate_11.value="";f.step2_rate_11.value="";f.step3_rate_11.value="";
		f.step4_rate_11.value="";f.step5_rate_11.value="";f.step6_rate_11.value="";f.step7_rate_11.value="";
		f.step8_rate_11.value="";f.step9_rate_11.value="";f.step10_rate_11.value="";
	}
	if(grade == 12) {
		f.step_Interval_12.value="";f.step1_rate_12.value="";f.step2_rate_12.value="";f.step3_rate_12.value="";
		f.step4_rate_12.value="";f.step5_rate_12.value="";f.step6_rate_12.value="";f.step7_rate_12.value="";
		f.step8_rate_12.value="";f.step9_rate_12.value="";f.step10_rate_12.value="";
	}
	if(grade == 13) {
		f.step_Interval_13.value="";f.step1_rate_13.value="";f.step2_rate_13.value="";f.step3_rate_13.value="";
		f.step4_rate_13.value="";f.step5_rate_13.value="";f.step6_rate_13.value="";f.step7_rate_13.value="";
		f.step8_rate_13.value="";f.step9_rate_13.value="";f.step10_rate_13.value="";
	}
	if(grade == 14) {
		f.step_Interval_14.value="";f.step1_rate_14.value="";f.step2_rate_14.value="";f.step3_rate_14.value="";
		f.step4_rate_14.value="";f.step5_rate_14.value="";f.step6_rate_14.value="";f.step7_rate_14.value="";
		f.step8_rate_14.value="";f.step9_rate_14.value="";f.step10_rate_14.value="";
	}
	if(grade == 15) {
		f.step_Interval_15.value="";f.step1_rate_15.value="";f.step2_rate_15.value="";f.step3_rate_15.value="";
		f.step4_rate_15.value="";f.step5_rate_15.value="";f.step6_rate_15.value="";f.step7_rate_15.value="";
		f.step8_rate_15.value="";f.step9_rate_15.value="";f.step10_rate_15.value="";
	}
	return 1;
}
function calculateRowST(f,grade)
{
	return 1;
}
function setCursorToEnd(elem) 
{
	if (elem) 
	{
		if (elem.type && (elem.type == "text" || elem.type == "textarea")) 
		{
			var rng = elem.createTextRange();
			rng.move("textedit");
			rng.select();
		}
	}
}	
//-->

/*
<!--- 
$Log: common.js,v $
*/

