var mem_win=new Array();if(!document.getElementById('pop_up_class')){var s=document.createElement("script");s.setAttribute("id","pop_up_class");s.setAttribute("type","text/javascript");s.setAttribute("src","/script/calendar/PopUpClass.js");document.getElementsByTagName("head")[0].appendChild(s);}function Comando(_azione,_query,_param){this.azione=_azione;this.query=_query;this.param=_param;}function Queque(){this.current_win=-1;this.old_win=-1;this.last_win=-1;this.comandi=new Array();this.Add=function(azione,query,param){if(this.old_win==this.current_win){this.last_win++;this.comandi[this.last_win]=new Comando(azione,query,param);this.current_win=this.last_win;}this.old_win=this.current_win;};this.Azione=function(){return(this.comandi[this.current_win]).azione;};this.Query=function(){return(this.comandi[this.current_win]).query;};this.Param=function(){return(this.comandi[this.current_win]).param;};}function getBrowser(){appCodeName=navigator.appCodeName;appName=navigator.appName;appVersion=navigator.appVersion;userAgent=navigator.userAgent;platform=navigator.platform;if(appName.indexOf("Netscape")!=-1){appName="NS";}else if(appName.indexOf("Microsoft")!=-1){appName="MSIE";}else if(appName.indexOf("Opera")!=-1){appName="Opera";}return(appName);}function processXML(xml,param){var id_nodo="msg_nodo";var parent_node="body";var position="absolute";var drag=false;var base_style=false;var i;var str;if(param){var coppie=param.split(";");for(i=0;i<coppie.length;i++){var coppia=coppie[i].split(":");var nome=coppia[0];var valore=coppia[1];switch(nome){case "id_nodo":id_nodo=valore;break;case "parent":parent_node=valore;break;case "position":position=valore;break;case "drag":drag=(valore=="yes")||(valore=="si")||(valore=="true");break;case "style":base_style=!((valore=="no")||(valore=="false"));break;}}}var link=xml.getElementsByTagName("link");for(i=0;i<link.length;i++){var id_link=link[i].getAttribute("id");var link_obj=document.getElementById(id_link);if(link_obj){var link_node=document.createElement('link');link_node.setAttribute('id',link[i].getAttribute("id"));link_node.setAttribute('rel','stylesheet');link_node.setAttribute('type','text/css');link_node.setAttribute('href',link[i].getAttribute("href"));document.getElementsByTagName("head")[0].appendChild(link_node);}}var script=xml.getElementsByTagName("script");for(i=0;i<script.length;i++){var id_script=script[i].getAttribute("id");var script_obj=document.getElementById(id_script);if(!script_obj){var script_node=document.createElement('script');script_node.setAttribute('id',script[i].getAttribute("id"));script_node.setAttribute('type',script[i].getAttribute("type"));script_node.setAttribute('src',script[i].getAttribute("src"));document.getElementsByTagName("body")[0].appendChild(script_node);}}var p=new PopUp(id_nodo);var dat=xml.getElementsByTagName("data")[0];if(xml.getElementsByTagName("style")){var style=xml.getElementsByTagName("style")[0];if(style){var cont;if(style.childNodes!=null)cont=style.childNodes[0].nodeValue;else cont="";var id_style=style.getAttribute("id");var style_obj=document.getElementById(id_style);if(!style_obj){var s=document.createElement("style");s.setAttribute("id",id_style);s.setAttribute("type","text/css");document.getElementsByTagName("head")[0].appendChild(s);if(s.styleSheet){s.styleSheet.cssText=cont;}else{var css_text_node_loc=document.createTextNode(cont);s.appendChild(css_text_node_loc);}}}}if(dat.getAttribute("style")){p.style=dat.getAttribute("style");}var childs;var obj_header=xml.getElementsByTagName("header");if(obj_header.length>0){childs=obj_header[0].childNodes;str="";for(i=0;i<childs.length;i++){str+=printXML(childs[i],1);}p.Header(str);}var obj_corpo=xml.getElementsByTagName("corpo");if(obj_corpo.length>0){var body_style=obj_corpo[0].getAttribute("style");if(body_style!==""){}childs=obj_corpo[0].childNodes;str="";for(i=0;i<childs.length;i++){str+=printXML(childs[i],1);}p.Body(str);}var obj_footer=xml.getElementsByTagName("footer");if(obj_footer.length>0){var footer_style=obj_footer[0].getAttribute("style");if(footer_style){}var btn_cont=document.createElement('span');var prev_btn=document.createElement('input');prev_btn.setAttribute("value","&lt;&lt;");prev_btn.type="button";prev_btn.setAttribute('id',"prev_btn");btn_cont.appendChild(prev_btn);var next_btn=document.createElement('input');next_btn.setAttribute('type','button');next_btn.setAttribute('value','&gt;&gt;');next_btn.setAttribute('id','next_btn');btn_cont.appendChild(next_btn);btn_cont.style.cssText="float:left;padding:0 3px";str=printXML(btn_cont);childs=obj_footer[0].childNodes;for(i=0;i<childs.length;i++){str+=printXML(childs[i],1);}p.Footer(str);}if(position=="absolute"){p.position=position;}else{p.position=position;}p.load_base_style=base_style;p.top="100"+'px';p.left="100"+'px';p.create(parent_node);if(obj_footer.length>0){var the_nodo=id_nodo;document.getElementById("prev_btn").onclick=function(){mem_win[the_nodo].current_win--;var _azione=mem_win[the_nodo].Azione();var _query_string=mem_win[the_nodo].Query();var _param=mem_win[the_nodo].Param();callA(_azione,_query_string,_param);};document.getElementById("next_btn").onclick=function(){mem_win[the_nodo].current_win++;var _azione=mem_win[the_nodo].Azione();var _query_string=mem_win[the_nodo].Query();var _param=mem_win[the_nodo].Param();callA(_azione,_query_string,_param);};if(mem_win[id_nodo].current_win<1){document.getElementById("prev_btn").disabled=true;}if(mem_win[id_nodo].current_win>=mem_win[id_nodo].last_win){document.getElementById("next_btn").disabled=true;}}}function rispostaHttp(http,param){var id_nodo="msg_nodo";if(param){var coppie=param.split(";");for(var i=0;i<coppie.length;i++){var coppia=coppie[i].split(":");var nome=coppia[0];var valore=coppia[1];switch(nome){case "id_nodo":id_nodo=valore;break;}}}var doc;if(http.readyState>=4){if(http.status==200){var cType=http.getResponseHeader("Content-Type");if(cType.indexOf('text/xml')!=-1){xml=http.responseXML;processXML(xml,param);}else if(cType.indexOf('text/html')!=-1){processText(id_nodo);doc=document.getElementById("msg_body");doc.innerHTML=http.responseText;}else if(cType.indexOf('text/plain')!=-1){processText(id_nodo);doc=document.getElementById('msg_body');doc.innerHTML=http.responseText;}else{processText(id_nodo);doc=document.getElementById('msg_body');doc.innerHTML=http.responseText;}}else{alert("Errore "+http.status);}}}function callA(azione,query_string,param){if(!param){param="";}if(!query_string){query_string="";}var id_nodo="msg_nodo";var id_form="";var parent_node="body";var i;var nome;var valore;if(param){var coppie=param.split(";");for(i=0;i<coppie.length;i++){var coppia=coppie[i].split(":");nome=coppia[0];valore=coppia[1];switch(nome){case "id_nodo":id_nodo=valore;break;case "id_form":id_form=valore;break;}}}var old_child=document.getElementById(id_nodo);if(old_child){var btn=old_child.getElementsByTagName("input");for(i=0;i<btn.length;i++){btn[i].disabled=true;}btn=old_child.getElementsByTagName("select");for(i=0;i<btn.length;i++){btn[i].disabled=true;}}var http;if(window.XMLHttpRequest){http=new XMLHttpRequest();}else{if(window.ActiveXObject){try{http=new ActiveXObject("Msml2.XMLHTTP");}catch(err1){try{http=new ActiveXObject("Microsoft.XMLHTTP");}catch(err2){alert("Attenzione il suo browser non supporta le nuove tecnologie usate in questo sito.");return false;}}}}http.open("POST",azione,true);http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');http.onreadystatechange=function(){rispostaHttp(http,param);};if(id_form!==""){if(query_string!==""){query_string+="&";}var frm=document.getElementById(id_form);if(frm){var num=frm.elements.length;for(i=0;i<num;i++){nome=frm.elements[i].name;if(nome){valore=encodeURIComponent(frm.elements[i].value);var tipo=frm.elements[i].type;if(tipo=="radio"){if(frm.elements[i].checked){query_string+=nome+"="+valore+"&";}}else if(tipo=="checkbox"){if(frm.elements[i].checked){query_string+=nome+"="+valore+"&";}}else{query_string+=nome+"="+valore+"&";}}}}}if(!mem_win[id_nodo]){mem_win[id_nodo]=new Queque();}mem_win[id_nodo].Add(azione,query_string,param);http.send(query_string);}function processText(id_nodo){var p=new PopUp(id_nodo);p.create("","header","body","footer");}function printXML(curEl,depth){var loc_print="";var tagName;var tab="";var i;if(curEl){tagName=curEl.tagName;if(tagName){tag=tab+"<"+curEl.tagName;var attr=curEl.attributes;for(i=0;i<attr.length;i++){var nome=attr[i].nodeName;var valore=curEl.getAttribute(nome);if(valore){tag+=" "+nome+"=\""+valore+"\"";}}tag+=">";}else{tag=tab+curEl.nodeValue;}loc_print+=tag;var curElChild=curEl.childNodes;for(i=0;i<curElChild.length;i++){loc_print+=printXML(curElChild[i],depth+1);}if(tagName){loc_print+=tab+"</"+tagName+">";}}return loc_print;}
