var rt='/';var isWorking=false;var http=getHTTPObject();var form_element;var show_loader=1;function open_popup(theURL,winName,features){window.open(theURL,winName,features);}function clear_field(field_name,field_value,field_value_r){if(document.getElementById(field_name).value==field_value){document.getElementById(field_name).value=field_value_r;}}function fill_field(field_name,field_value,field_value_r){if(document.getElementById(field_name).value==field_value_r){document.getElementById(field_name).value=field_value;}}function disable_submit(dform){if(document.getElementById){for(var sch=0;sch<dform.length;sch++){if(dform.elements[sch].type.toLowerCase()=="submit"){dform.elements[sch].value='Please wait...';dform.elements[sch].disabled=true;}}}return true;}function update_count(field_name,div_name){var new_count=140-field_name.value.length;document.getElementById(div_name).innerHTML=new_count;}function hide_field(field_to_hide){document.getElementById(field_to_hide).innerHTML='';document.getElementById(field_to_hide).style.display='none';}function disable_form(form_element){form_element.disabled=true;}function enable_form(form_element){form_element.disabled=false;}function set_val(field_name,field_value){document.getElementById(field_name).value=field_value;}function goto_url(url){eval("parent.location='"+url+"'");}function getHTTPObject(){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}if(!http_request){return false;}return http_request;}function generate_html(){if(!form_element.nodeName)form_element=document.getElementById(form_element);if(http.readyState==4){if(http.responseText.indexOf('invalid')==-1){results=http.responseText.split("|||");if(results[0]!=""){form_element.innerHTML=results[0];form_element.style.display='block';}else{form_element.style.display='none';}isWorking=false;}}else if(http.readyState==1&&show_loader){form_element.innerHTML="<p align=\"center\"><img src=\""+rt+"images/ajax-loader.gif\" width=\"16\" height=\"11\" /></p>";}}function call_ajax(data,id){var url=rt+"php/_ajax/base.php?id="+id;if(!isWorking&&http){http.open("GET",url+data,true);http.onreadystatechange=generate_html;isWorking=true;http.send(null);}}function call_ajax_content(data,f_name){var url=rt+"php/_ajax/"+f_name+".php?";if(!isWorking&&http){http.open("GET",url+data,true);http.onreadystatechange=generate_html;isWorking=true;http.send(null);}}function get_content(field_to_show,op,args,rfre_flag){if((document.getElementById(field_to_show).innerHTML==''||rfre_flag)&&!isWorking){form_element=field_to_show;show_loader=1;f_name=get_f_name(op);var data='op='+escape(op)+'&args='+escape(args);call_ajax_content(data,f_name);}}function get_f_name(op){switch(op){case 1:f_name="base";break;}return f_name;}function load_calendar(field_to_show,dt_value,curr_dt,field_val,op){form_element=field_to_show;show_loader=0;id=1;var start_dt=dt_value;if(start_dt!=''){curr_dt=start_dt;}var data='&start_dt='+escape(curr_dt)+'&f_name='+escape(field_to_show)+'&f_val='+escape(field_val)+'&op='+escape(op);call_ajax(data,id);}function change_dt(dt,field_to_hide,field_dt_value){document.getElementById(field_to_hide).style.display='none';document.getElementById(field_dt_value).value=dt;}function close_calendar(field_to_hide){document.getElementById(field_to_hide).style.display='none';}function swap_view(hide_field,show_field){if(hide_field){document.getElementById(hide_field).style.display='none';}if(show_field){document.getElementById(show_field).style.display='block';}}
