// fix W3C compliance addEvent(window,'load', function(){ tiphpOnResize(); }); addEvent(window,'resize', function() { tiphpOnResize(); }); function createXMLHttpRequest() { var xmlhttp; if(window.XMLHttpRequest) { try { xmlhttp = new XMLHttpRequest(); } catch(e) { xmlhttp = false; } } else if(window.ActiveXObject) { try { xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0"); } catch(e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { xmlhttp = false; } } } return xmlhttp; } var tiphpAjax = createXMLHttpRequest(); function handleResponse(){ if(tiphpAjax.readyState == 1) document.body.style.cursor = 'wait'; else if(tiphpAjax.readyState == 4){ document.body.style.cursor = 'auto'; var response = tiphpAjax.responseText; var parser_div = new Array(); var parser_subdiv = new Array(); var delimiter_begin = '*#@|'; var delimiter_end = '*#@EOL|*'; if(response.indexOf('||') != -1) { var content = ''; var javascript = ''; var div = ''; parser_div = response.substr(2).split('||'); for(i=0;i<(parser_div.length);i++){ content = ''; javascript = ''; if(i%2==0){ div = parser_div[i]; if(parser_div[i+1].indexOf('*#@|') != -1){ parser_subdiv = parser_div[i+1].substr(parser_div[i+1].indexOf('*#@|')+delimiter_begin.length).split('*#@|'); if(parser_div[i+1].indexOf('*#@|')!=0){ content = parser_div[i+1].substr(0,parser_div[i+1].indexOf('*#@|'));tiphpGetElementById(div).innerHTML = content; } for(y=0;y<(parser_subdiv.length);y++){ if(y%2==0){ if(parser_subdiv[y].substr(0,2) == '**'){ javascript += "tiphpGetElementById('"+parser_subdiv[y].substring(2,parser_subdiv[y].indexOf('/'))+"')."+(parser_subdiv[y].substring(parser_subdiv[y].indexOf('/')+1))+" = "+(parser_subdiv[y+1].substring(0,String(parser_subdiv[y+1]).indexOf(delimiter_end)))+";"; } else if(parser_subdiv[y].substr(0,2) == '##'){ javascript += parser_subdiv[y].substring(2)+"="+parser_subdiv[y+1].substring(0,parser_subdiv[y+1].indexOf(delimiter_end))+";"; } else if(parser_subdiv[y].substr(0,2) == '@@'){ javascript += parser_subdiv[y].substring(2)+";"; } if(parser_subdiv[y+1].length!=(parser_subdiv[y+1].substring(0,parser_subdiv[y+1].indexOf(delimiter_end)).length+delimiter_end.length)){ content += parser_subdiv[y+1].substring(parser_subdiv[y+1].indexOf(delimiter_end)+delimiter_end.length);tiphpGetElementById(div).innerHTML = content; } } } if(content.length>0){ } eval(javascript); } else { tiphpGetElementById(parser_div[i]).innerHTML = parser_div[i+1]; } } } } } } function tiphpRequest(hash0,hash1,hash2,hash3,hash4,hash5,hash6,hash7,hash8,hash9,hash10,hash11,hash12,hash13,hash14,hash15){ var tiphp_url = 'http://www.fssi.ch/ajax_request.php'; var tiphp_params = ''; var tiphp_post = ''; tiphp_asynchronous = false; if(document.getElementById('tiphp-dialog-status')) tiphp_status = document.getElementById('tiphp-dialog-status').innerHTML; else tiphp_status = 0; for(i=1;i<15;i++) if(eval('hash'+i)!=undefined) tiphp_post += '&hash'+i+'='+encodeURIComponent(eval('hash'+i)); else break; tiphp_params = 'request=tiphp&hash0=' + encodeURIComponent(hash0+'-'+tiphp_status+'-'+f_scrollTop()+'-'+screen.availWidth) + tiphp_post; tiphpAjax.open('POST', tiphp_url, tiphp_asynchronous); tiphpAjax.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); tiphpAjax.setRequestHeader('Content-length', tiphp_params.length); tiphpAjax.setRequestHeader('Connection', 'close'); tiphpAjax.send(tiphp_params); try { tiphpAjax.onreadystatechange = handleResponse(); // FIX FF } catch(e) { tiphpAjax.onreadystatechange = handleResponse; } } function tiphpExecute(option){ switch(option){ case true: case false: document.getElementById('tiphp-dialog-status').innerHTML = 1; eval(document.getElementById('tiphp-dialog-'+option).innerHTML); break; } } function tiphpGetElementById(div,object){ if(!object) object = 'document'; var tiphpElement = ""; var tmp = ""; eval("tiphpElement = "+object+".getElementById('"+div+"');"); if(!tiphpElement){ tiphpElement = document.createElement('div'); tmp = document.createAttribute('id'); tmp.value = div; tiphpElement.setAttributeNode(tmp); document.body.appendChild(tiphpElement); if(div!='tiphp-execute'){ alert(div+' DIV non presente, generato!'); //eval("tiphpElement = "+object+".getElementById('"+div+"');"); } } return tiphpElement; } function tiphpCenterBox(hash1,hash2){ var offsetWidth = tiphpGetElementById(hash1).offsetWidth; var offsetHeight = tiphpGetElementById(hash1).offsetHeight; // FIX offsetWidth/offsetHeight caused by display none if(tiphpGetElementById(hash1).offsetWidth==0){ tiphpGetElementById(hash1).style.visibility = 'hidden'; tiphpGetElementById(hash1).style.display = 'inline'; offsetWidth = tiphpGetElementById(hash1).offsetWidth; offsetHeight = tiphpGetElementById(hash1).offsetHeight; tiphpGetElementById(hash1).style.display = 'none'; tiphpGetElementById(hash1).style.visibility = 'visible'; } var marginLeft = (f_clientWidth()-offsetWidth)/2; if(marginLeft<0) marginLeft = 0; tiphpGetElementById(hash1).style.marginLeft = marginLeft+'px'; if(hash2==true){ var marginTop = ((f_clientHeight()-offsetHeight)/2)+f_scrollTop(); if(marginTop<0) marginTop = 0; tiphpGetElementById(hash1).style.marginTop = marginTop+'px'; } } function tiphpOnResize(){ tiphpCenterBox('tiphp-dialog-container-box',true); tiphpCenterBox('page-container',false); } function tiphpOverlaySize() { if (window.innerHeight && window.scrollMaxY) return window.innerHeight + window.scrollMaxY; else if (document.body.scrollHeight > document.body.offsetHeight) return document.body.scrollHeight; else if (document.documentElement && document.documentElement.scrollHeight > document.documentElement.offsetHeight) return document.documentElement.scrollHeight; else return document.body.offsetHeight; } function f_clientWidth() { return f_filterResults ( window.innerWidth ? window.innerWidth : 0, document.documentElement ? document.documentElement.clientWidth : 0, document.body ? document.body.clientWidth : 0 ); } function f_clientHeight() { return f_filterResults ( window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0 ); } function f_scrollLeft() { return f_filterResults ( window.pageXOffset ? window.pageXOffset : 0, document.documentElement ? document.documentElement.scrollLeft : 0, document.body ? document.body.scrollLeft : 0 ); } function f_scrollTop() { return f_filterResults ( window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0 ); } function f_filterResults(n_win, n_docel, n_body) { var n_result = n_win ? n_win : 0; if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel; return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result; } function addEvent( obj, type, fn ) { if ( obj.attachEvent ) { obj['e'+type+fn] = fn; obj[type+fn] = function(){obj['e'+type+fn]( window.event );} obj.attachEvent( 'on'+type, obj[type+fn] ); } else obj.addEventListener( type, fn, false ); } function removeEvent( obj, type, fn ) { if ( obj.detachEvent ) { obj.detachEvent( 'on'+type, obj[type+fn] ); obj[type+fn] = null; } else obj.removeEventListener( type, fn, false ); }