var rt='/';var isWorking=false;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;}var http=getHTTPObject();var form_element;var show_loader=1;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=\"128\" height=\"15\" /></p>";}}function call_ajax(data,id){var url=rt+"php/apps/ajax.php?id="+id;if(!isWorking&&http){http.open("GET",url+data,true);http.onreadystatechange=generate_html;isWorking=true;http.send(null);}}function perform_search(field_to_show,search_str,op,args){if(search_str.length>0){form_element=field_to_show;show_loader=1;ajax_id=6;var data='&data='+escape(search_str)+'&op='+escape(op)+'&args='+escape(args);call_ajax(data,ajax_id);}else{document.getElementById(field_to_show).style.display='none';}}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;ajax_id=6;var data='&op='+escape(op)+'&args='+escape(args);call_ajax(data,ajax_id);}}function load_more_form(field_to_show,op,p){if(!isWorking&&!isSameType(op)){form_element=field_to_show;show_loader=1;ajax_id=4;var data='&op='+escape(op)+'&p='+escape(p);call_ajax(data,ajax_id);document.getElementById('p_question_type').value=op;}}function isSameType(op){var op=parseInt(op);var p_op=parseInt(document.getElementById('p_question_type').value);switch(op){case 0:case 1:if(p_op==0||p_op==1){return true;}else{return false;}break;case 6:case 7:case 8:if(p_op==6||p_op==7||p_op==8){return true;}else{return false;}break;case 9:case 10:case 12:if(p_op==9||p_op==10||p_op==12){return true;}else{return false;}break;}}function load_calendar(field_to_show,dt_value,curr_dt,field_val,op){form_element=field_to_show;show_loader=0;ajax_id=2;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,ajax_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 generate_html_2(){if(http.readyState==4){if(http.responseText.indexOf('invalid')==-1){results=http.responseText.split("|||");if(results[0]!=""){form_element.src=results[0];}isWorking=false;}}}function call_ajax_2(data,id){var url=rt+"php/apps/ajax.php?id="+id;if(!isWorking&&http){http.open("GET",url+data,true);http.onreadystatechange=generate_html_2;isWorking=true;http.send(null);}}function update_img(this_img,twitter_name){form_element=this_img;show_loader=0;ajax_id=3;var data='&tn='+escape(twitter_name);call_ajax_2(data,ajax_id);}function close_calendar(field_to_hide){document.getElementById(field_to_hide).style.display = 'none';}