// ajax // update calendar availability // version 2.1 // define your default vars here var update_url = './update_cal.ajax.php'; // path to ajax file var image_dir = "./images/"; // path to calendar images var icon_loading = "icon_loading.gif"; // loading animation image var cal_on = "cal_on_"; // start of cal number file name (om/booked) var cal_num_img_type= ".png"; // file type extension (include "." before extension) var num_w = "20px"; // width of numbers var num_h = "20px"; // height of numbers var image_loading= ""; // no need to modify below here unless you know what you are doing ;) var state_elm =new Object(); var elm_num = new Object(); var special_state= new Object(); function ajax_mod_state(id_item,the_date,the_num,e){ // 2008-03-12 // catch client id // NOT USED IN CURRENT VERSION - JUST A TEST //id_client=document.getElementById('id_client').value; //alert(id_client); //catch key press special_state=""; the_key=what_key(e) if(the_key!="ko")special_state=the_key; //alert(event.keyCode); // start class ajax = new sack(); // define image span to update state_elm=document.getElementById("state_"+the_date); // set state loading while ajax is executed state_elm.innerHTML = image_loading; // define number for grahic to show (needed in completion function) elm_num = the_num; // call ajax file to update state var the_url=update_url+"?id_item="+id_item+"&the_date="+the_date+"&special_state="+special_state; //alert(the_url); ajax.requestFile = the_url; ajax.onCompletion =reset_state; ajax.runAJAX(); } function reset_state(){ //alert(ajax.response); if (ajax.response=="on" || ajax.response=="off" || ajax.response=="am" || ajax.response=="pm" ){ state_elm.innerHTML = ""; }else{ alert(ajax.response); } } function what_key(e) { if(document.all)e = event; // IE need this //alert(e); if(e.ctrlKey) return "pm"; else if(e.altKey) return "am"; else if(e.shiftKey) return "ko"; }