
function set_input_bg_img(id, style) {
    //alert('set_input_bg_img: '+id+'\n\nval:'+document.getElementById(id).value);
    if(document.getElementById(id).value==""){
        document.getElementById(id).style.background=style;
    }
    return true;
}
function hide_input_bg_img(id) {
    document.getElementById(id).style.backgroundImage="";
    document.getElementById(id).onfocus="";
    return true;
}

function set_input_text(id, txt) {
    //alert('set_input_bg_img: '+id+'\n\nval:'+document.getElementById(id).value);
    if(document.getElementById(id).value=="" || document.getElementById(id).value == txt){
        document.getElementById(id).value=txt;
    }
    return true;
}
function hide_input_text(id, match) {
    //alert(document.getElementById(id).value + '\n\n' + match)
    if(document.getElementById(id).value==match){
        document.getElementById(id).value="";
        document.getElementById(id).onfocus="";
        if(match=='password'){
            textToPassword(id);
        }
    }
    return true;
}

function textToPassword( id ){
    elem = document.getElementById(id);
    var eData={v:elem.value, t:elem.type, s:elem.size, n:elem.name}, newElem, newType=(eData.t=='password'?'text':'password');

    try{
        newElem=document.createElement("<input type='"+newType+"' name='"+eData.n+"' value='"+eData.v+"' size='"+eData.s+"' id='"+id+"'>");
    } catch(e) {
        newElem=document.createElement('input');
        newElem.name=eData.n;
        newElem.name=eData.n;
        newElem.type=newType;
        newElem.size=eData.s;
        newElem.value=eData.v;
        newElem.id=id;
    }

    elem.parentNode.replaceChild(newElem, elem);
   // alert(newElem.id)
    setTimeout("document.getElementById('"+id+"').focus();", 10);
    return newElem.type;
}


function PeriodChanged(f){
	val = f.options[f.selectedIndex].value;
	salary = document.getElementById('salary');
	salary.options.length = 0;
	
	if(document.getElementById('salary2')){
    	salary2 = document.getElementById('salary2');
    	salary2.options.length=0;
	} else {
	    salary2 = false;
	}
    var o = document.createElement('option');
	o.value = 0;
	o.text = 'All';
	b = o.cloneNode(true);
	try {
	    salary.add(o, null); // standards compliant; doesn't work in IE
	} catch(ex) {
		salary.add(o); // IE only
	}
    if(salary2){
    	try {
    	    salary2.add(b, null); // standards compliant; doesn't work in IE
    	} catch(ex) {
    		salary2.add(b); // IE only
    	}
	}

    switch(val){
		case 'A': //annual;
            sal = ann_sal; break;
		case 'D':  	// days
		    sal = day_sal; break;
		case 'H':   // hours
			sal = hour_sal; break;
    }

    for(var i=0;i<sal.length-1;i++){

		var o = document.createElement('option');
        
        t = sal[i];
		o.value='p'+i;
		o.text = t;
		
        try {
			salary.add(o, null); // standards compliant; doesn't work in IE
		}catch(ex) {
			salary.add(o); // IE only
		}
        if(salary2){
		    b = o.cloneNode(true);
			try {
				salary2.add(b, null); // standards compliant; doesn't work in IE
			}catch(ex) {
				salary2.add(b); // IE only
			}
		}
    }
	

	if(val!='0'){
		salary.selectedIndex=1;
		if(salary2)salary2.selectedIndex=salary2.options.length-1;
	}
};/**/

