// Example: // onMouseOver="toolTip('tool tip text here')"; // onMouseOut="toolTip()"; // -or- // onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')"; // onMouseOut="toolTip()"; /* MOVE this to the : */ var ns4 = document.layers; var ns6 = document.getElementById && !document.all; var ie4 = document.all; offsetX = -230; offsetY = -210; var toolTipSTYLE=""; function initToolTips() { if(ns4||ns6||ie4) { if(ns4) toolTipSTYLE = document.toolTipLayer; else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style; else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style; if(ns4) document.captureEvents(Event.MOUSEMOVE); else { toolTipSTYLE.visibility = "visible"; toolTipSTYLE.display = "none"; } document.onmousemove = moveToMouseLoc; } } function toolTip(msg, fg, bg) { if(toolTip.arguments.length < 1) // hide { if(ns4) toolTipSTYLE.visibility = "hidden"; else toolTipSTYLE.display = "none"; } else // show { if(!fg) fg = "#777777"; if(!bg) bg = "#F7F9FD"; var content = '
' + '
 \;' + msg + ' \;
'; if(ns4) { toolTipSTYLE.document.write(content); toolTipSTYLE.document.close(); toolTipSTYLE.visibility = "visible"; } if(ns6) { document.getElementById("toolTipLayer").innerHTML = content; toolTipSTYLE.display='block' } if(ie4) { document.all("toolTipLayer").innerHTML=content; toolTipSTYLE.display='block' } } } function moveToMouseLoc(e) { if(ns4||ns6) { x = e.pageX; y = e.pageY; } else { x = event.x + document.body.scrollLeft; y = event.y + document.body.scrollTop; } newX=x + offsetX; newY=y + offsetY; //controllo che non esca a sinistra if (newX<2) {newX=2;} //controllo le dimensioni del browser if (document.all) { height = document.body.offsetHeight, width = document.body.offsetWidth; //} else if (document.layers) { } else { height = window.innerHeight, width = window.innerWidth; } //controllo che non esca in alto if (newY<(document.body.scrollTop)) {newY=(document.body.scrollTop);} //controllo che non esca a destra if (newX>(width-200)) {newX=(width-200);} //sposto toolTipSTYLE.left = newX; toolTipSTYLE.top = newY; return true; } function top() //Restituisce la posizione di scorrimento verticale { return (document.body)?document.body.scrollTop:(window.pageYOffset)?window.pageYOffset:(window.scrollY)?window.scrollY:0; } function soloNum(txtField) { if (isNaN(txtField.value)) {txtField.value=0;} else {txtField.value=Math.abs(Math.round(txtField.value))}; } function printIt() { window.print(); } var isNav4, isIE4, w, h; if (parseInt(navigator.appVersion.charAt(0)) >= 4) { isNav4 = (navigator.appName == "Netscape") ? 1 : 0; isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0; } function resizeToHeight() { if (isNav4) { //alert(window.outerWidth); w = 800; h = screen.height-25; window.outerWidth = w; window.outerHeight = h; //alert(window.outerWidth); } if (isIE4) { //alert(document.body.clientWidth); w = 802; h = screen.height-25; window.resizeTo(w, h); //alert(document.body.clientWidth); } self.moveTo(0,0); } function resizeToFull() { if (isNav4) { //alert(window.outerWidth); w = screen.width; h = screen.height-25; window.outerWidth = w; window.outerHeight = h; //alert(window.outerWidth); } if (isIE4) { //alert(document.body.clientWidth); w = screen.width; h = screen.height-25; window.resizeTo(w, h); //alert(document.body.clientWidth); } self.moveTo(0,0); } //MACROMEDIA function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i= 4) { isNav4 = (navigator.appName == "Netscape") ? 1 : 0; isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0; } function MM_showHideLayers() { //v6.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; } obj.visibility=v; } } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i4 || navigator.userAgent.indexOf("MSIE")>-1)&& !window.opera){pa="px";} if(navigator.userAgent.indexOf("NT")>-1 || navigator.userAgent.indexOf("Windows 2000")>-1){slw=false;} if(spd=="Slow"){sp=(slw)?2:1;fr=(slw)?40:30;}else if(spd=="Medium"){sp=(slw)?4:1;fr=(slw)?40:10; }else{sp=(slw)?8:4;fr=(slw)?40:10;}if(spd=="Warp"){sp=5000;}var yy=parseInt(gg.top);if(isNaN(yy)){ if(g.currentStyle){yy=parseInt(g.currentStyle.top);}else if(document.defaultView){ yy=parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("top"));}else{yy=0;}} if(document.all || document.getElementById){h=parseInt(g.offsetHeight); if(!h){h=parseInt(g.style.pixelHeight);} }else if(document.layers){h=parseInt(g.clip.height);}ly=ty+parseInt(oy)-h; if(dr=="Down"){if(yy>ly){m=true;yy-=sp;if(yyty){yy=ty;}}} if(dr=="Reset"){gg.top=ty+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=false;} if(m){gg.top=yy+pa;if(g.toMove){clearTimeout(g.p7Magic);}g.toMove=true; eval("g.p7Magic=setTimeout(\"P7_VScroller('"+el+"','"+dr+"',"+ty+","+oy+",'"+spd+"')\","+fr+")"); }else{g.toMove=false;} } // quando raggiungo il limite massimo di caratteri passa all'elemento successivo var isNN = (navigator.appName.indexOf("Netscape")!=-1); function autoTab(input,len, e) { var keyCode = (isNN) ? e.which : e.keyCode; var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; if(input.value.length >= len && !containsElement(filter,keyCode)) { input.value = input.value.slice(0, len); //input.form[(getIndex(input)+1) % input.form.length].focus(); input.form[(getIndex(input)+1) % input.form.length].select(); } function containsElement(arr, ele) { var found = false, index = 0; while(!found && index < arr.length) if(arr[index] == ele) found = true; else index++; return found; } function getIndex(input) { var index = -1, i = 0, found = false; while (i < input.form.length && index == -1) if (input.form[i] == input)index = i; else i++; return index; } return true; } // nella textfield --> onKeyUp="return autoTab(this, 4, event);" // permette di digitare più caratteri per posizionarsi su una tendina var timerid = null; var matchString = ""; var mseconds = 1000; // Length of time before search string is reset function shiftHighlight(keyCode,targ) { keyVal = String.fromCharCode(keyCode); // Convert ASCII Code to a string matchString = matchString + keyVal; // Add to previously typed characters elementCnt = targ.length - 1; // Calculate length of array -1 for (i = elementCnt; i > 0; i--) { selectText = targ.options[i].text.toLowerCase(); // convert text in SELECT to lower case if (selectText.substr(0,matchString.length) == matchString.toLowerCase()) { targ.options[i].selected = true; // Make the relevant OPTION selected sito(); //aggiorno il campo di testo, aggiunta di Fausto } } clearTimeout(timerid); // Clear the timeout timerid = setTimeout('matchString = ""',mseconds); // Set a new timeout to reset the key press string return false; // to prevent IE from doing its own highlight switching } /***************************************** Controllo della Partita I.V.A. Linguaggio: JavaScript ******************************************/ function ControllaPIVA(pi) { if( pi == '' ) return '- Inserire il numero di partita IVA\r'; if( pi.length != 11 ) return '- La lunghezza della partita IVA non è\n' + 'corretta: la partita IVA dovrebbe essere lunga\n' + 'esattamente 11 caratteri.\n'; validi = '0123456789'; for( i = 0; i < 11; i++ ){ if( validi.indexOf( pi.charAt(i) ) == -1 ) return '- La partita IVA contiene un carattere non valido (' + pi.charAt(i) + ').\nI caratteri validi sono le cifre.\n'; } s = 0; for( i = 0; i <= 9; i += 2 ) s += pi.charCodeAt(i) - '0'.charCodeAt(0); for( i = 1; i <= 9; i += 2 ){ c = 2*( pi.charCodeAt(i) - '0'.charCodeAt(0) ); if( c > 9 ) c = c - 9; s += c; } if( ( 10 - s%10 )%10 != pi.charCodeAt(10) - '0'.charCodeAt(0) ) return '- La partita IVA non è valida:\n' + 'il codice di controllo non corrisponde.\n'; return ''; } //restituisce true se il campo codice fiscale contiene un CF function CFPI(campo) { var re = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/; var re2 = /^\d{5}\d{6}$/; Codice=Trim(campo); isCF = re.test(Codice); isPI = re2.test(Codice); //alert(campo+':CF='+isCF+'/PI='+isPI) if (isCF) { return true; } else { return false; } } //FAUSTO function azzeraTutto() { // Imposta tutti i campi di testo e tutte le textarea a '' // e tutte le tendine sull'ultimo valore for (i=0; i0) { url = 'carrello.asp?' +'azione=add' +'&antPost='+antPost +'&brakePadId='+brakePadId +'&qta='+qta; //alert(url); this.location.href = url; } else { alert("Inserire la quantità!"); } } //elimina il prodotto dal carrello function removeFromCart(antPost,brakePadId,brakePadCodice) { if (confirm('Eliminare l\'articolo \r'+brakePadCodice+' '+antPost+' dal carrello?')) { self.location.href='carrello.asp?azione=delete&brakePadId='+brakePadId+'&antPost='+antPost; } } function skipToLanguage(language) { attuale = self.location.href; if (language==1) { re = /english/gi; newUrl = attuale.replace(re, 'italiano'); self.location.href = newUrl; } else { re = /italiano/gi; newUrl = attuale.replace(re, 'english'); self.location.href = newUrl; } } function aggiornaStato(oggetto) { trStato = escape(oggetto[oggetto.selectedIndex].value); self.location.href = 'carrello.asp?trStato='+trStato; } // hides all select-one elements of a form function hideFormElements() { if (document.forms.length>0) { // loops through all elements of a form, looking for the first // element that can receive focus if (navigator.appName=='Microsoft Internet Explorer') { for(i = 0; i < document.forms(0).elements.length; i++) { strType = document.forms(0).elements(i).type; if (strType == 'select-one') { document.forms(0).elements(i).style.visibility = 'hidden'; } // end the loop } return; } } } // shows all select-one elements of a form function showFormElements() { if (document.forms.length>0) { // loops through all elements of a form, looking for the first // element that can receive focus if (navigator.appName=='Microsoft Internet Explorer') { for(i = 0; i < document.forms(0).elements.length; i++) { strType = document.forms(0).elements(i).type; if (strType == 'select-one') { document.forms(0).elements(i).style.visibility = 'visible'; } // end the loop } return; } } } //restituisce true se data è una data valida function controllaData(data) { re = /(\d+)\W(\d+)\W(\d+)/; re.exec(data); //alert(RegExp.$1 + '-' + RegExp.$2 + '-' + RegExp.$3); gg=Number(RegExp.$1); mm=Number(RegExp.$2); aa=Number(RegExp.$3); strdata=gg+'/'+mm+'/'+aa; data = new Date(parseInt(aa),parseInt(mm)-1,parseInt(gg)); daa=Number(data.getFullYear().toString()); dmm=Number((data.getMonth()+1).toString()); dgg=Number(data.getDate().toString()); dddata=dgg+'/'+dmm+'/'+daa if (dddata!=strdata) { //alert('Verificare la data inserita ('+dddata+'/'+strdata+')'); return false; } else { //alert('ok'); return true; } } //toglie gli spazi function Trim(stringa) { reTrim=/\s+$|^\s+/g; return stringa.replace(reTrim,""); } /* Script realizzato da Filippo Bonanni Copyright©2k1FilippoBonanni e-mail: hyppos@aruba.it Questo script è di libero utilizzo. Unica condizione è che non vengano tolti i riferimenti all'autore all'interno del codice e che specifichiate se possibile, nella pagina in cui inserirete lo script, www.jsdir.com quale sito da cui è possibile prelevarlo. */ var lung=null; var test=null; lettere=new Array(); //array= lettera, valore se pari, valore se dispari lettere[0]=["A","0","1"]; lettere[1]=["B","1","0"]; lettere[2]=["C","2","5"]; lettere[3]=["D","3","7"]; lettere[4]=["E","4","9"]; lettere[5]=["F","5","13"]; lettere[6]=["G","6","15"]; lettere[7]=["H","7","17"]; lettere[8]=["I","8","19"]; lettere[9]=["J","9","21"]; lettere[10]=["K","10","2"]; lettere[11]=["L","11","4"]; lettere[12]=["M","12","18"]; lettere[13]=["N","13","20"]; lettere[14]=["O","14","11"]; lettere[15]=["P","15","3"]; lettere[16]=["Q","16","6"]; lettere[17]=["R","17","8"]; lettere[18]=["S","18","12"]; lettere[19]=["T","19","14"]; lettere[20]=["U","20","16"]; lettere[21]=["V","21","10"]; lettere[22]=["W","22","22"]; lettere[23]=["X","23","25"]; lettere[24]=["Y","24","24"]; lettere[25]=["Z","25","23"]; lettere[26]=["0","0","1"]; lettere[27]=["1","1","0"]; lettere[28]=["2","2","5"]; lettere[29]=["3","3","7"]; lettere[30]=["4","4","9"]; lettere[31]=["5","5","13"]; lettere[32]=["6","6","15"]; lettere[33]=["7","7","17"]; lettere[34]=["8","8","19"]; lettere[35]=["9","9","21"]; ConfrontoCarattereControllo=new Array(); ConfrontoCarattereControllo[0]=["A"]; ConfrontoCarattereControllo[1]=["B"]; ConfrontoCarattereControllo[2]=["C"]; ConfrontoCarattereControllo[3]=["D"]; ConfrontoCarattereControllo[4]=["E"]; ConfrontoCarattereControllo[5]=["F"]; ConfrontoCarattereControllo[6]=["G"]; ConfrontoCarattereControllo[7]=["H"]; ConfrontoCarattereControllo[8]=["I"]; ConfrontoCarattereControllo[9]=["J"]; ConfrontoCarattereControllo[10]=["K"]; ConfrontoCarattereControllo[11]=["L"]; ConfrontoCarattereControllo[12]=["M"]; ConfrontoCarattereControllo[13]=["N"]; ConfrontoCarattereControllo[14]=["O"]; ConfrontoCarattereControllo[15]=["P"]; ConfrontoCarattereControllo[16]=["Q"]; ConfrontoCarattereControllo[17]=["R"]; ConfrontoCarattereControllo[18]=["S"]; ConfrontoCarattereControllo[19]=["T"]; ConfrontoCarattereControllo[20]=["U"]; ConfrontoCarattereControllo[21]=["V"]; ConfrontoCarattereControllo[22]=["W"]; ConfrontoCarattereControllo[23]=["X"]; ConfrontoCarattereControllo[24]=["Y"]; ConfrontoCarattereControllo[25]=["Z"]; var Carattere=0; var ValorePari=1; var ValoreDispari=2; function ControlloFisc(stringa){ var SommaCaratteri=0; var PariDispari=null; stringa=stringa.toUpperCase(); lung=stringa.length; //alert(lung); CarattereControllo=stringa.substr(lung-1,1); //alert(CarattereControllo) stringa=stringa.substring(lung-1,0); //alert(stringa); lung=stringa.length; //alert(lung); for (i=0; i=lung-1; i++){ if ((i+1)%2==0){ PariDispari='P' } else { PariDispari='D' } //alert(PariDispari); temp=stringa.charAt(i); for (t=0; t=35; t++){ test=lettere[t][Carattere]; if (temp==test){break} } if(PariDispari=='P') { SommaCaratteri=SommaCaratteri+parseInt(lettere[t][ValorePari]) } else { SommaCaratteri=SommaCaratteri+parseInt(lettere[t][ValoreDispari]) } } Risultato=SommaCaratteri % 26; //alert(Risultato); Risultato=ConfrontoCarattereControllo[Risultato][0]; //alert(Risultato); if (Risultato==CarattereControllo) { return true; } else { return false } } //PAGINA SHOP function zoomIt(imageUrl) { if (imagesTotal>0) { if (imagesLoaded==imagesTotal) { //MM_showHideLayers('livzoom','','show'); tmt_DivAlign('livzoom','l','t','2',2+top()); MM_showHideLayers('livzoom','','show'); MM_setTextOfLayer('livzoom','',' %3Ctable border=%220%22 cellpadding=%220%22 cellspacing=%223%22%3E%0D%0A %3Ctr%3E %0D%0A %3Ctd height=%221%25%22 align=%22right%22 valign=%22top%22 bgcolor=%22#774200%22%3E%3Ca href=%22#%22 onClick=%22MM_showHideLayers(%27livzoom%27,%27%27,%27hide%27);return false;%22%3E%3Cimg src=%22img/close.gif%22 width=%2214%22 height=%2214%22 border=%220%22%3E%3C/a%3E%3C/td%3E%0D%0A %3C/tr%3E%0D%0A %3Ctr%3E %0D%0A %3Ctd height=%2298%25%22 align=%22center%22 valign=%22middle%22 bgcolor=%22#E88000%22%3E%3Cimg src=%22'+imageUrl+'%22 name=%22foto%22 hspace=%220%22 vspace=%220%22 border=%220%22 id=%22foto%22 %3E%3C/td%3E%0D%0A %3C/tr%3E%0D%0A %3C/table%3E'); //alert(imagesLoaded); } else { alert('Gli zoom sono in fase di caricamento,\rattendere prego...'); //alert(imagesLoaded+' su '+imagesTotal); return false; } } else { alert('Gli zoom sono in fase di caricamento,\rattendere prego...'); //alert(imagesLoaded+' su '+imagesTotal); return false; } //alert(imagesLoaded+' su '+imagesTotal); } function estensioneJPG(stringa) { var re = /.jpg$/gi; valido = re.test(stringa); if (valido) { return true; } else { return false; } return true; }