function CalculateBMI(){
    var pweight = document.pscreening.pweight.value;
    var pheight = document.pscreening.pheight.value / 100;
    var szam = MyRound(pweight / (pheight*pheight), 1);

    if((pheight>0) && (pweight>0)){
        document.getElementById("bmi").innerHTML = szam;
    }else{
        document.getElementById("bmi").innerHTML = "A BMI csak pozitiv számokból számolható.";
    }
    document.pscreening.bmi.value = MyRound(pweight / (pheight*pheight), 1);
}
function redirectScreeningPage(pagenum){
    if(document.pscreening.bno)        document.pscreening.bno.value = document.pscreening.bno1.value+document.pscreening.bno2.value+document.pscreening.bno3.value+document.pscreening.bno4.value+document.pscreening.bno5.value;
    //if(document.pscreening.birthdate)        document.pscreening.birthdate.value = document.pscreening.BirthYear.value+"-"+document.pscreening.BirthMonth.value+"-"+document.pscreening.BirthDay.value;
    document.pscreening.event.value = 400201;
    document.pscreening.pagenum.value = pagenum;
    document.pscreening.submit();
}
function ClosePatient(){
    var a = document.getElementById("closePatient");
    var b = document.getElementById("PatientClose");

    if(a.style.visibility == "hidden"){
        a.style.visibility = "visible";
        a.style.position = "static";
        b.value = 1;
    }else{
        a.style.visibility = "hidden";
        a.style.position = "absolute";
        b.value = 0;
    }
}

function CheckFileIsXLS(){
    var file_name = document.forms.importform.fileup.value;
    var mime = file_name.substr(file_name.lastIndexOf('.'));
    if (mime != '.xls'){
        alert("Kérem hogy '.xls' kiterjesztésű fájlt válasszon");
        document.forms.importform.fileup.focus();
    }else{
        document.forms.importform.submit();
    }
}
function ShowAnotherDisease(){
    if(document.getElementById("anotherdisease_td").style.visibility != "hidden"){
        document.getElementById("anotherdisease_td").style.visibility = "hidden";
        document.getElementById("anotherdisease_td").style.position = "absolute";
    }else{
        document.getElementById("anotherdisease_td").style.visibility = "visible";
        document.getElementById("anotherdisease_td").style.position = "static";
    }
}
function ShowMustExp(xx,yy){
    var a = document.getElementById("must_exp");
    if(a.style.visibility == "hidden"){
        a.style.visibility = "visible";
        //a.style.position = "static";
    }else{
        a.style.visibility = "hidden";
        a.style.position = "absolute";
    }
    a.style.top=xx;
    a.style.left=yy;
}
function ShowMustCalcDesc(xx,yy){
    var a = document.getElementById("must_calc_desc");
    if(a.style.visibility == "hidden"){
        a.style.visibility = "visible";
        //a.style.position = "static";
    }else{
        a.style.visibility = "hidden";
        a.style.position = "absolute";
    }
    a.style.top=xx;
    a.style.left=yy;
}
function MyRound(szam, szorzo){
    return Math.round(szam * szorzo)/szorzo;
}
function SendForm(nextback, pagenum){
    if(document.pscreening.bno)        document.pscreening.bno.value = document.pscreening.bno1.value+document.pscreening.bno2.value+document.pscreening.bno3.value+document.pscreening.bno4.value+document.pscreening.bno5.value;

    /*
    if(pagee == 4){
        if(IsAnyCheckedProduct()){
            document.pscreening.submit();
        }
        else    alert("Legalább egy termék kiválasztása kötelező!");
    }else if(pagee == 6){
        document.pscreening.stepLast.value = 1;
        document.pscreening.submit();
    }else{
        document.pscreening.submit();
    }
    */
    document.pscreening.event.value = nextback;
    if(pagenum) document.pscreening.pagenum.value = pagenum;
    document.pscreening.submit();

}
function Csipogj(){
    alert("csip - csip");
}
function AgeCalcForDatePicket(){
	if(document.getElementById("age") != null){
		if(document.pnotice != undefined)
			var birthdate = document.pnotice.birthdate.value;
		else
			var birthdate = document.pscreening.birthdate.value;
	    var oyear = birthdate.substr(0,4);
	    var omonth = birthdate.substr(5,2);
	    var oday = birthdate.substr(8,2);

		var today=new Date();
		var month = today.getMonth()+1;
		var day = today.getDate();
		if(navigator.appName == "Netscape")
			var year = (today.getYear() + 1900);
		else
			var year = today.getYear();

		var age = year-oyear;
		if(month < omonth){
		  age--;
		}else if(month == omonth){
		  if(oday > day){
		      age--;
		  }
		}
		if(age < 0) age = 0;
		document.getElementById("age").innerHTML = age+" év";
	}
}

function AgeCalc(today){
    if((document.pnotice.BirthYear.selectedIndex != 0) &&
    (document.pnotice.BirthMonth.selectedIndex != 0) &&
    (document.pnotice.BirthDay.selectedIndex != 0)){
        var birthdate = document.pnotice.BirthYear.value+"-"+document.pnotice.BirthMonth.value+"-"+document.pnotice.BirthDay.value;
        var year = today.substr(0,4);
        var month = today.substr(5,2);
        var day = today.substr(8,2);
        var age = year-document.pnotice.BirthYear.value;
        if(month < document.pnotice.BirthMonth.value){
            age--;
        }else if(month == document.pnotice.BirthMonth.value){
            if(document.pnotice.BirthDay.value > day){
                age--;
            }
        }
        if(age < 0) age = 0;
        document.getElementById("age").innerHTML = age+" év";
    }
}

function SendNoticeForm(nextback, pagenum){
    /*
    if(document.pnotice.leavedate) {
        document.pnotice.leavedate.value =
            document.pnotice.LeaveYear.value +"-"+
            document.pnotice.LeaveMonth.value +"-"+
            document.pnotice.LeaveDay.value +" "+
            document.pnotice.leave_time.value;
    }
    */
    //alert(document.getElementById("sondainsert_another").value);
    if(document.pnotice.tel1_a != null )    document.pnotice.tel1.value = document.pnotice.tel1_a.value+document.pnotice.tel1_b.value+document.pnotice.tel1_c.value;
    //if(document.pnotice.birthdate)         document.pnotice.birthdate.value = document.pnotice.BirthYear.value+"-"+document.pnotice.BirthMonth.value+"-"+document.pnotice.BirthDay.value;
    if(document.pnotice.leavedate)         document.pnotice.leavedate.value = document.pnotice.leave_date.value+" "+document.pnotice.leave_time.value;

    if(pagenum) document.pnotice.pagenum.value = pagenum;

    document.pnotice.event.value = nextback;
    document.pnotice.submit();
}
function ZipCheck(myEvent, form_name, myObj){
    if(myObj.value.length == 4 && !isNaN(myObj.value)){
        //document.pnotice.birthdate.value = document.pnotice.BirthYear.value+"-"+document.pnotice.BirthMonth.value+"-"+document.pnotice.BirthDay.value;
        var myForm  = eval("document."+form_name);
        myForm.event.value = myEvent;
        myForm.submit();
    }
}
function IfAnotherShowText(myObj){
    var a =  document.getElementById(myObj.name+"_another_td");
    if(myObj.options[myObj.selectedIndex].text.toLowerCase() == "egyéb"){
        a.innerHTML = '<input type="text" name="'+myObj.name+'_" value="" onKeyUp="setAnotherHidden(this);" style="width:84px;">';
    }else{
        a.innerHTML = "";
    }
}
function setAnotherHidden(myObj){
    var a = eval("document.forms.pnotice."+myObj.name+"another");
    a.value = myObj.value;
}
function ChangeClass(changeableObject, class_name){
    changeableObject.className = class_name;
}
var prenum = "";
function WeightChangePercent(){
    var weightChangePercentSpan = document.getElementById('weightChangePercent');
    var weightChangePercentInput = document.getElementById('weightChangePercentInput');
    var pweight = document.getElementById('pweight');
    prenum = document.pscreening.weightChange.value;
    var orig_weight = parseInt(parseInt(pweight.value)+parseInt(prenum));
    //alert(prenum+" - "+orig_weight);
    var percent = Math.round((prenum/orig_weight)*100);
    if(isNaN(percent)){
        weightChangePercentSpan.innerHTML = "0%";
        weightChangePercentInput.value = 0;
    }else{
        weightChangePercentSpan.innerHTML = percent+"%";
        weightChangePercentInput.value = percent;
    }
}
function EnablePlusMinus(){
       var pweight = document.getElementById('pweight');
    if(!isNaN(document.pscreening.weightChange.value)){
        if(document.pscreening.weightChange.value != ""){
            document.pscreening.plusminus.disabled = 0;
        }else{
            document.pscreening.plusminus.disabled = 1;
            document.pscreening.plusminus.selectedIndex  = 1;
        }
        prenum = document.pscreening.weightChange.value;
    }else{
        if(prenum != "")
            document.pscreening.weightChange.value = prenum;
        else
            document.pscreening.weightChange.value = "";
    }
}
function OnlyChar(focusedObject){
    var enabledChar = "abcdefghijklmnopqrstvz";
    enabledChar = enabledChar + enabledChar.toUpperCase();
    for(var i = focusedObject.value.length; i >= 0; i--){
        ret = enabledChar.indexOf(focusedObject.value.charAt(i));
        if(ret == -1)    focusedObject.value = focusedObject.value.substr(0, focusedObject.value.length-1);
    }
}
function OnlyNum(focusedObject){
    var enabledChar = "1234567890";
    for(var i = focusedObject.value.length; i >= 0; i--){
        ret = enabledChar.indexOf(focusedObject.value.charAt(i));
        if(ret == -1)    focusedObject.value = focusedObject.value.substr(0, focusedObject.value.length-1);
    }
}
function OnlyReal(focusedObject){
    var enabledChar = "1234567890.";
    for(var i = focusedObject.value.length; i >= 0; i--){
        ret = enabledChar.indexOf(focusedObject.value.charAt(i));
        if(ret == -1)    focusedObject.value = focusedObject.value.substr(0, focusedObject.value.length-1);
    }
}
function SetMaxLength(focusedObject, mlength){
    focusedObject.value = focusedObject.value.substr(0, mlength);
}
function SetMaxLengthAndFocusNext(focusedObject, mlength, nextInputName){
    focusedObject.value = focusedObject.value.substr(0, mlength);
    if(focusedObject.value.length == mlength)
        SetFocus(nextInputName);

}
function ClearAnotherDisease(){
    document.pscreening.anotherDEffect.value = "";
}
function TherapyConfirm(myEvent){
    if(confirm("Biztosan lezárja a terápiát?")){
        top.location.href=myEvent;
    }else{

    }
}
function myGetElementById_Plus(id_name){
    var all =   document.forms;
    var elements = new Array();
    var return_elem;
    var return_str = "";
    for (var e = 0; e < all.length; e++){
        var formok = all[e];
        for(var i = 0; i < formok.length; i++){
            return_str += formok[i].name+"/"+formok[i].id+" - ";
            if(formok[i].type == "radio"){

                if(formok[i].id == id_name){
                    return_elem = formok[i];
                }else if((formok[i].name == id_name)){
                    if(return_elem =="")
                        return_elem = formok[i];
                }
            }

            if(formok[i].id == id_name){
                return_elem = formok[i];
            }else if((formok[i].name == id_name)){
                return_elem = formok[i];
            }

        }
        return_str += "\n\n";
    }
   return return_elem;
}
function myGetElementById(form_name, id_name){
    var all =   document.forms;
    var elements = new Array();
    var formok = "";
    var elemek = "";
    var return_elem;

    for (var e = 0; e < all.length; e++){
        formok += all[e].name+" - ";
        if(all[e].name == form_name){
            var form_elemek = all[e].elements;
            for(var i = 0; i < form_elemek.length; i++){
                if(form_elemek[i].name == id_name){
                    return_elem = form_elemek[i];
                }
                if((i % 9 == 0) && (i != 0))
                    elemek += form_elemek[i].name+"\n";
                else
                    elemek += form_elemek[i].name+" - ";
            }
        }
    }
   return return_elem;
}
function disabledKiseroBno(){
    var bno1 = myGetElementById("pnotice", 'kisero_bno1');
    var bno2 = myGetElementById("pnotice", 'kisero_bno2');
    var bno3 = myGetElementById("pnotice", 'kisero_bno3');
    var bno4 = myGetElementById("pnotice", 'kisero_bno4');
    var bno5 = myGetElementById("pnotice", 'kisero_bno5');
    bno1.disabled = "disabled";
    bno2.disabled = "disabled";
    bno3.disabled = "disabled";
    bno4.disabled = "disabled";
    bno5.disabled = "disabled";

}
function BnoCheck(myEvent, name_plus, form_name){
    var bno1 = myGetElementById(form_name, name_plus+'bno1');
    var bno2 = myGetElementById(form_name, name_plus+'bno2');
    var bno3 = myGetElementById(form_name, name_plus+'bno3');
    var bno4 = myGetElementById(form_name, name_plus+'bno4');
    var bno5 = myGetElementById(form_name, name_plus+'bno5');

    if(name_plus == "def_"){
        var actual_bno = bno1.options[bno1.selectedIndex].value + bno2.options[bno2.selectedIndex].text + bno3.options[bno3.selectedIndex].text+bno4.options[bno4.selectedIndex].text+bno5.options[bno5.selectedIndex].text;
        var def_bno = document.getElementById('def_bno_id');
        if(actual_bno != def_bno.value){
            disabledKiseroBno();
            var bno = myGetElementById(form_name, 'def_bno');
            bno.value = '';
            var bno = document.getElementById('bno_notice_default');
            bno.innerHTML = '<i>A kísérő betegség BNO kódja.</i>';
            var bno = myGetElementById(form_name, 'kisero_bno');
            bno.value = '';
            var bno = document.getElementById('bno_notice_kisero');
            bno.innerHTML = '<i>A kísérő betegség BNO kódja.</i>';
        }
    }

    if(    (bno1.selectedIndex!=0) &&    (bno2.selectedIndex!=0) &&    (bno3.selectedIndex!=0) &&    (bno4.selectedIndex!=0) &&    (bno5.selectedIndex!=0)){
        var bno = myGetElementById(form_name, name_plus+'bno');
        bno.value =
            bno1.options[bno1.selectedIndex].value+
            bno2.options[bno2.selectedIndex].text+
            bno3.options[bno3.selectedIndex].text+
            bno4.options[bno4.selectedIndex].text+
            bno5.options[bno5.selectedIndex].text;

        if(form_name != "pnotice"){
            var bno = myGetElementById(form_name, 'def_bno');
            if(bno != null){
                var bno1 = myGetElementById(form_name, 'def_bno1');
                var bno2 = myGetElementById(form_name, 'def_bno2');
                var bno3 = myGetElementById(form_name, 'def_bno3');
                var bno4 = myGetElementById(form_name, 'def_bno4');
                var bno5 = myGetElementById(form_name, 'def_bno5');
                if(
                (bno1!=null) &&
                (bno2!=null) &&
                (bno3!=null) &&
                (bno4!=null) &&
                (bno5!=null)
                ){
                    bno.value =
                        bno1.options[bno1.selectedIndex].value+
                        bno2.options[bno2.selectedIndex].text+
                        bno3.options[bno3.selectedIndex].text+
                        bno4.options[bno4.selectedIndex].text+
                        bno5.options[bno5.selectedIndex].text;
                }
            }
        }

        var myForm  = eval("document."+form_name);
        /*
        if(form_name == "pscreening"){
            myForm.birthdate.value =
            myForm.BirthYear.value +"-"+
            myForm.BirthMonth.value +"-"+
            myForm.BirthDay.value;
        }
        */
        myForm.event.value = myEvent;
        myForm.submit();
    }
}
//questions
var QuestionState = "";
var NextEnabled = false;
var OriginalNextValue = "";
var OriginalBackValue = "";
var Way = "0";
var preobj;
var preobj_no;
var preWay;
var Product = false;
function SendQForm(){
    document.pscreening.qproduct.value = Way;
    document.pscreening.event.value = 400201;
    document.pscreening.submit();
}
function PageBack(){
    document.pscreening.event.value = 400202;
    document.pscreening.submit();
}
function Page3ButtonNext(myEvent){
    if(Product == false){
        QuestionNext();
    }else{
        top.location.href=myEvent;
    }
}
function Page3ButtonBack(myEvent){
    if(Way.length > 1){
        QuestionBack();
    }else{
        top.location.href=myEvent;
    }
}
function myGetElementById_Plus(id_name){
    var all =   document.forms;
    var elements = new Array();
    var return_elem = null;
    var return_str = "";
    for (var e = 0; e < all.length; e++){
        var formok = all[e];
        for(var i = 0; i < formok.length; i++){
            return_str += formok[i].name+"/"+formok[i].id+" - ";
            if(formok[i].type == "radio"){
                if(formok[i].id == id_name){
                    return formok[i];
                }else if((formok[i].name == id_name)){
                    return formok[i];
                }
            }
            if(formok[i].id == id_name){
                return_elem = formok[i];
            }else if((formok[i].name == id_name)){
                return_elem = formok[i];
            }
        }
        return_str += "\n\n";
    }
   return return_elem;
}
function QuestionNext(checkboxObj){
    var myObj = myGetElementById_Plus("set_q"+Way);
    var myObj_no = myGetElementById_Plus("no_q"+Way);

    if((myObj.checked) || (myObj_no.checked)){
        QWay(myObj, myObj_no);
        if((Way != "011") && (Way != "0100") && (Way != "0101") && (Way != "001") && (Way != "0000") && (Way != "0001")){
            var a = document.getElementById("q"+Way);

            a.style.visibility = "visible";
            a.style.position = "static";
            var c = document.getElementById("yes_q"+Way);
            var d = document.getElementById("no_q"+Way);
            c.checked = false;
            d.checked = false;
            if(preobj != null){
                preobj.disabled = "disabled";
                preobj_no.disabled = "disabled";
            }
            Product = false;
        }else{
            Product = true;
            SendQForm();
            //document.getElementById("questionControlNext").innerHTML = '<div onClick="SendQForm();">'+OriginalNextValue+'</div>';
            //document.getElementById("questionControlNext").innerHTML = '<span class="linktype" onClick="SendQForm();" onMouseOut="ChangeClass(this, \'linktype\');" onMouseOver="ChangeClass(this, \'linktype_over\');">tovább</span>';
        }
        //SetUpBackButton();
    }else alert("A kérdőív csak válaszadás után lép tovább");

}
function QNext(){ //visszaadja a tovabb nak a kerdesbeliseget
    if(Product){
        Way = Way.substr(0, Way.length-1);
        myGetElementById_Plus("questionControlNext").innerHTML = '<span class="linktype" onClick="QuestionNext();" onMouseOut="ChangeClass(this, \'linktype\');" onMouseOver="ChangeClass(this, \'linktype_over\');">tovább</span>';
        Product = false;
    }
    //SetUpBackButton();
}
function ValueClear(myObj){
    myObj.value = "";
}
function NextFocusIfChar(focusedObject, charr, namee){
    if(focusedObject.value == charr){
        SetFocus(namee);
    }
}
function AddLeadingZero(focusedObject){
    if(focusedObject.value == 1)
        focusedObject.value = "01";
}
function SetFocus(namee){
    var a = myGetElementById('pscreening', namee);
    if(a == undefined) a = myGetElementById('pnotice', namee);
    if(a != undefined){
        //a.focus(); commented because made error in ff
    }
    //myGetElementById('pscreening', namee).focus();
}
function QuestionBack(){
    if(Product){
        Way = Way.substr(0, Way.length-1);
        myGetElementById_Plus("questionControlNext").innerHTML = '<span class="linktype" onClick="QuestionNext();" onMouseOut="ChangeClass(this, \'linktype\');" onMouseOver="ChangeClass(this, \'linktype_over\');">tovább</span>';
    }
            document.getElementById("q"+Way).style.visibility = "hidden";
            document.getElementById("q"+Way).style.position = "absolute";
    //myGetElementById_Plus("q"+Way).style.visibility = "hidden";
    //myGetElementById_Plus("q"+Way).style.position = "absolute";

    Way = Way.substr(0, Way.length-1);

    //SetUpBackButton();

    myGetElementById_Plus("set_q"+Way).disabled = "";
    myGetElementById_Plus("no_q"+Way).disabled = "";

    Product = false;
}

function QWay(myObj, myObj_no){
    if(myObj != preobj)
    {
        preWay = Way;
        if(myObj.checked != true)
            Way += "0";
        else
            Way += "1";
        preobj = myObj;
        preobj_no = myObj_no;
    }else{
        if(myObj.checked != true)
            Way = preWay+"0";
        else
            Way = preWay+"1";
    }
}
function ShowOtherDisease(){
    var de = document.getElementById('anotherdisease_td');
    if(de.style.visibility == "hidden"){
        de.style.visibility = "visible";
        de.style.position = "static";
        de.checked = true;
    }else{
        de.style.visibility = "hidden";
        de.style.position = "absolute";
        de.checked = false;
    }
}
//page4
var productCountArray = new Array(5)
    productCountArray[0] = 0.5;
    productCountArray[1] = 1;
    productCountArray[2] = 1.5;
    productCountArray[3] = 2;
    productCountArray[4] = 3;
    productCountArray[5] = 4;
    productCountArray[6] = 5;
var pCArrayLastIndex = 0;

function IncreaseCount(textname){
    var ta = document.getElementById(textname);
    if(ta == null)    var ta =  eval("document.forms.pnotice."+textname);
    if(ta.disabled == 0){
        for(var i = 0; i<productCountArray.length; i++){
            if(ta.value == productCountArray[i]){
                pCArrayLastIndex = i+1;
                if(pCArrayLastIndex >= productCountArray.length) pCArrayLastIndex = 0;
                ta.value = productCountArray[pCArrayLastIndex];
                return;
            }
        }
    }
}
function DecreaseCount(textname){
    var ta = document.getElementById(textname);
    if(ta == null)    var ta =  eval("document.forms.pnotice."+textname);
    if(ta.disabled == 0){
        for(var i = 0; i<productCountArray.length; i++){
            if(ta.value == productCountArray[i]){
                pCArrayLastIndex = i-1;
                if(pCArrayLastIndex < 0) pCArrayLastIndex = productCountArray.length-1;
                ta.value = productCountArray[pCArrayLastIndex];
                return;
            }
        }
    }
}
function PreportExcelGen(namee){
    if(namee=="week"){
        document.forms.excelgen_form.xlsgen_type.value=namee;
        if(document.forms.excelgen_form.week_select.selectedIndex == 0){
            alert("Kérem válassza ki, hogy melyik hét riportját szeretné kigeneráltatni");
        }else{
            document.forms.excelgen_form.submit();
        }
    }else if(namee == "export"){
        var asd = document.forms.myexportform;
        if(asd.nurse.value != 0){
            asd.submit();
        }else{
            alert("Kérem válassza ki az ápolót!");
        }
    }else if(namee == "default"){
        document.forms.excelgen_form.xlsgen_type.value=namee;
        document.forms.excelgen_form.submit();
    }
}
function SetTaMaxValue(textname){
    var ta = document.getElementById(textname);
    if(ta.value >= 100) ta.value = 99;
    if(ta.value < 0) ta.value = 0;
}
function IsAnyCheckedProduct(){
    var logic = false;
    for(var i = 0; i< 100; i++){
        var a = eval("document.pscreening.value"+i);
        if(a){
            if(a.disabled == 0) return true;
        }
    }
    var b =  eval("document.pscreening.value_all");
    if(!b.disabled) return true;
}
function CheckBoxChange(idd, which_form){
    if(idd != "checkbox_all"){
        var v = document.getElementById("value"+idd);
        if(v == null)    var v =  eval("document.forms."+which_form+".value"+idd);

        var s = document.getElementById("select"+idd);
        if(s == null)    var s =  eval("document.forms."+which_form+".select"+idd);

        var d1 = document.getElementById("suggest_time"+idd);
        if(d1 == null)    var d1 =  eval("document.forms."+which_form+".suggest_time"+idd);

        var d2 = document.getElementById("doctor_time"+idd);
        if(d2 == null)    var d2 =  eval("document.forms."+which_form+".doctor_time"+idd);

        if(v.disabled == 0) v.disabled = 1;     else v.disabled=0;
        if(v.value == 0) v.value = 1;     else v.value=0;
        if(s != null)
            if(s.disabled == 0) s.disabled = 1;     else s.disabled=0;
    }else{
        var v = document.getElementById("value_all");
        if(v == null)    var v =  eval("document.forms."+which_form+".value_all");

        var s = document.getElementById("select_all");
        if(s == null)    var s =  eval("document.forms."+which_form+".select_all");

        var d1 = document.getElementById("suggest_time_all");
        if(d1 == null)    var d1 =  eval("document.forms."+which_form+".suggest_time_all");

        var d2 = document.getElementById("doctor_time_all");
        if(d2 == null)    var d2 =  eval("document.forms."+which_form+".doctor_time_all");

        if(v.disabled == 0){
            v.disabled = 1;
            v.value=0;
        }else{
            v.disabled=0;
            v.value = 1;
        }
        if(s.disabled == 0){
            s.disabled = 1;
            s.value=0;
        }else{
            s.disabled=0;
            s.value = 1;
        }
    }
    if(d1.disabled == 0){
        d1.disabled = 1;
        d1.selectedIndex = 0;
    }else{
        d1.disabled = 0;
        d1.selectedIndex = 0;
    }
    if(d2.disabled == 0){
        d2.disabled = 1;
        d2.selectedIndex = 0;
    }else{
        d2.disabled = 0;
        d2.selectedIndex = 0;
    }
}