function calc_left (w) { var left = (screen.availWidth / 2) - (w / 2); return (left); } function calc_top (h) { var top = (screen.availHeight / 2) - (h / 2); return (top); } function open_popup (url, w, h, scrollbar,toolbar,status,menubar,id) { //alert(scrollbar) if(!scrollbar){scrollbar = 'no'} if(!toolbar){toolbar = 'no'} if(!status){status = 'no'} if(!menubar){menubar = 'no'} if(!id){id = ''} var top = calc_top (h); var left = calc_left (w); popup = window.open (url,id,'width='+w+',height='+h+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'status='+status+', menubar='+menubar+', toolbar='+toolbar+', scrollbars='+scrollbar); popup.focus(); } /** FUNZIONI */ // funzione per prendere un elemento con id univoco function prendiElementoDaId(id_elemento) { var elemento; if(document.getElementById) elemento = document.getElementById(id_elemento); else elemento = document.all[id_elemento]; return elemento; }; // funzione per assegnare un oggetto XMLHttpRequest function assegnaXMLHttpRequest() { var XHR = null, browserUtente = navigator.userAgent.toUpperCase(); if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object") XHR = new XMLHttpRequest(); else if(window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) { if(browserUtente.indexOf("MSIE 5") < 0) XHR = new ActiveXObject("Msxml2.XMLHTTP"); else XHR = new ActiveXObject("Microsoft.XMLHTTP"); } return XHR; }; /** OGGETTI / ARRAY */ // oggetto di verifica stato var readyState = { INATTIVO: 0, INIZIALIZZATO: 1, RICHIESTA: 2, RISPOSTA: 3, COMPLETATO: 4 }; // array descrittivo dei codici restituiti dal server // [la scelta dell' array è per evitare problemi con vecchi browsers] var statusText = new Array(); statusText[100] = "Continue"; statusText[101] = "Switching Protocols"; statusText[200] = "OK"; statusText[201] = "Created"; statusText[202] = "Accepted"; statusText[203] = "Non-Authoritative Information"; statusText[204] = "No Content"; statusText[205] = "Reset Content"; statusText[206] = "Partial Content"; statusText[300] = "Multiple Choices"; statusText[301] = "Moved Permanently"; statusText[302] = "Found"; statusText[303] = "See Other"; statusText[304] = "Not Modified"; statusText[305] = "Use Proxy"; statusText[306] = "(unused, but reserved)"; statusText[307] = "Temporary Redirect"; statusText[400] = "Bad Request"; statusText[401] = "Unauthorized"; statusText[402] = "Payment Required"; statusText[403] = "Forbidden"; statusText[404] = "Not Found"; statusText[405] = "Method Not Allowed"; statusText[406] = "Not Acceptable"; statusText[407] = "Proxy Authentication Required"; statusText[408] = "Request Timeout"; statusText[409] = "Conflict"; statusText[410] = "Gone"; statusText[411] = "Length Required"; statusText[412] = "Precondition Failed"; statusText[413] = "Request Entity Too Large"; statusText[414] = "Request-URI Too Long"; statusText[415] = "Unsupported Media Type"; statusText[416] = "Requested Range Not Satisfiable"; statusText[417] = "Expectation Failed"; statusText[500] = "Internal Server Error"; statusText[501] = "Not Implemented"; statusText[502] = "Bad Gateway"; statusText[503] = "Service Unavailable"; statusText[504] = "Gateway Timeout"; statusText[505] = "HTTP Version Not Supported"; statusText[509] = "Bandwidth Limit Exceeded"; function caricaTesto(nomeFile,idElement,method,postVariables,typePrint,fadeIn) { // variabili di funzione //alert('eccomi'); if((method=='')||(method == null)) { method = 'get'; } var // assegnazione oggetto XMLHttpRequest ajax = assegnaXMLHttpRequest(), // assegnazione elemento del documento elemento = prendiElementoDaId(idElement), // risultato booleano di funzione usaLink = true; // se l'oggetto XMLHttpRequest non è nullo if(ajax) { // il link al file non deve essere usato usaLink = false; // impostazione richiesta asincrona in GET // del file specificato if((method.toLowerCase() == 'post')) { ajax.open("post", nomeFile, true); ajax.setRequestHeader("content-type", "application/x-www-form-urlencoded"); ajax.setRequestHeader("connection", "close"); ajax.send(postVariables); } else { ajax.open("get", nomeFile, true); ajax.setRequestHeader("connection", "close"); } // rimozione dell'header "connection" come "keep alive" // impostazione controllo e stato della richiesta ajax.onreadystatechange = function() { // verifica dello stato if(ajax.readyState === readyState.COMPLETATO) { // verifica della risposta da parte del server if(statusText[ajax.status] === "OK"){ // operazione avvenuta con successo if(typePrint=='add') { elemento.innerHTML += ajax.responseText; } else{ if(fadeIn==1) { //opacity('ajaxContent', 100, 0, 1000) elemento.innerHTML = '
'+ajax.responseText+'
'; opacity('ajaxContent', 0, 100, 1000) } else { elemento.innerHTML = ajax.responseText; } } } else { // errore di caricamento elemento.innerHTML = "Impossibile effettuare l'operazione richiesta.
"; elemento.innerHTML += "Errore riscontrato: " + statusText[ajax.status]; } } } // invio richiesta ajax.send(null); } return usaLink; } function menu(params) { //alert(); document.write(''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''); } function printFlash(swf,w,h,params) { //alert(); document.write(''+ ''+ ''+ ''+ ''+ ''+ ''+ ''); } function toMenu(args){ var sendText = args; window.document.menu.SetVariable("menu", sendText); } function checkQuest() { if(document.getElementById('risposta').value) { return(true); } else { alert('Attenzione!\nbisogna votare per proseguire.'); return(false); } } function makeRisp(risp,altro) { document.getElementById("risposta").value = risp; if(altro == 1) { document.getElementById("altro").readOnly = false; } else { if(document.getElementById("altro")){ document.getElementById("altro").value = ""; document.getElementById("rispostaAltro").value = ""; document.getElementById("altro").readOnly = true;} } } function caricaSez(reparto,baseUrl) { window.open('/contenuti/il_tuo_ipermercato/mappa/reparto.php?r='+reparto,reparto,'width=500,height=400'); } function volantino(vol) { idIper = GetCookie("ipermercato"); if(!idIper) { window.open('/volantino/?'+vol,'volantino','width=400,height=250') } else { window.open('/volantino/?'+vol); } } function cambiaPagina(parIn) { var myvars=parIn.split("&"); for(i=0;i1)) { if(!contains(tmp, a[i])){ tmp.length+=1; tmp[tmp.length-1]=a[i]; } } } return tmp; } function contains(a, e) { for(j=0;j opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } } //change the opacity for different browsers function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; } function roll(base,menu,status) { eval("document.menu_"+menu+".src='"+base+"comuni/img/menu_"+menu+"_"+status+".gif';"); } var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) function fixPNG(myImage) { //alert(version) if ((version >= 5.5) && (version < 7) && (document.body.filters)) { var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "" var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "" var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' " var imgStyle = "display:inline-block;" + myImage.style.cssText var strNewHTML = "" //alert(strNewHTML); myImage.outerHTML = strNewHTML } } var bn = navigator.appName; var ie = (bn=="Microsoft Internet Explorer"); var nn = (bn=="Netscape"); var d = document; if(ie) { document.write(''); } else{document.write('');} document.write(''); /********************************************************************************** ScrollText * Copyright (C) 2001 Thomas Brattli * This script was released at DHTMLCentral.com * Visit for more great scripts! * This may be used and changed freely as long as this msg is intact! * We will also appreciate any links you could give us. * * Made by Thomas Brattli *********************************************************************************/ function lib_bwcheck(){ //Browsercheck (needed) //alert(navigator.appVersion) this.ver=navigator.appVersion this.agent=navigator.userAgent this.dom=document.getElementById?1:0 this.opera5=this.agent.indexOf("Opera 5")>-1 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0; this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0; this.ie4=(document.all && !this.dom && !this.opera5)?1:0; this.ie=this.ie4||this.ie5||this.ie6 this.mac=this.agent.indexOf("Mac")>-1 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie7 ||this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5) //alert(this.ns6); return this } var bw=new lib_bwcheck() //If you want it to move faster you can set this lower, it's the timeout: var speed = 30 //Sets variables to keep track of what's happening var loop, timer //Object constructor function makeObj(obj,nest){ nest=(!nest) ? "":'document.'+nest+'.' this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; h1 = this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight h2 = this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight w1 = this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth w2 = this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth this.up=goUp;this.down=goDown; this.left=goLeft;this.right=goRight; this.moveIt=moveIt; this.x=0; this.y=0; this.obj = obj + "Object" eval(this.obj + "=this") //alert(h1+" || "+h2+" ** "+w1+" || "+w2); return this } // A unit of measure that will be added when setting the position of a layer. var px = bw.ns4||window.opera?"":"px"; function moveIt(x,y){ this.x = x this.y = y this.css.left = this.x+px this.css.top = this.y+px } //Makes the object go up function goDown(move){ //alert(this.y+" || "+(-this.scrollHeight)+" || "+oCont.clipHeight) if (this.y>-this.scrollHeight+oCont.clipHeight){ this.moveIt(0,this.y-move) if (loop) setTimeout(this.obj+".down("+move+")",speed) } } //Makes the object go down function goUp(move){ if (this.y<0){ this.moveIt(0,this.y-move) if (loop) setTimeout(this.obj+".up("+move+")",speed) } } //Makes the object go left function goRight(move){ //alert(this.x+" || "+(-this.scrollWidth)+" || "+oCont.clipWidth) if (this.x<=(-this.scrollWidth+oCont.clipWidth)){ this.moveIt(this.x-move,0) if (loop) setTimeout(this.obj+".right("+move+")",speed) } } //Makes the object go right function goLeft(move){ if (this.x<0){ this.moveIt(this.x-move,0) if (loop) setTimeout(this.obj+".left("+move+")",speed) } } //Calls the scrolling functions. Also checks whether the page is loaded or not. function scroll(speed,type){ if(type!='oriz') { if (scrolltextLoaded){ loop = true; if (speed>0) oScroll.down(speed) else oScroll.up(speed) } } else { if (scrolltextLoaded){ loop = true; if (speed>0){ oScroll.right(speed); alert('right')} else{ oScroll.left(speed);alert('left')} } } } //Stops the scrolling (called on mouseout) function noScroll(){ loop = false if (timer) clearTimeout(timer) } //Makes the object var scrolltextLoaded = false function scrolltextInit(){ if(document.getElementById('divScrollTextCont')) { oCont = new makeObj('divScrollTextCont') oScroll = new makeObj('divText','divScrollTextCont') oScroll.moveIt(0,0) oCont.css.visibility = "visible" scrolltextLoaded = true } } //Call the init on page load if the browser is ok... if (bw.bw) onload = scrolltextInit