// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()";
/*
MOVE this to the body>:
*/
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = -50;
offsetY = -70;
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, w)
{
if (Number(w)>0) {
toolTipSTYLE.width = w + " px";
} else {
toolTipSTYLE.width = "200 px";
}
if(toolTip.arguments.length < 1) // hide
{
if(ns4) toolTipSTYLE.visibility = "hidden";
else toolTipSTYLE.display = "none";
}
else // show
{
if(!fg) fg = "#777777";
if(!bg) bg = "#FFFFFF";
var content =
'
';
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);}
divWidth = Number(OnlyNum(toolTipSTYLE.width))+20;
//controllo che non esca a destra
if (newX>(width-(divWidth))) {newX=(width-(divWidth));}
//sposto
toolTipSTYLE.left = newX;
toolTipSTYLE.top = newY;
return true;
}
function tmt_DivAlign(theDiv,h,v,hPx,vPx){
var obj,fun,dw,dh,lw,lh,x,y;
fun = (document.getElementById) ? "document.getElementById" : "MM_findObj";
obj = (document.getElementById) ? document.getElementById(theDiv) : MM_findObj(theDiv);
if(obj){if(document.all){
dw = document.body.clientWidth;dh = document.body.clientHeight;}
else{dw = innerWidth;dh = innerHeight;}
if(document.layers){lw = obj.clip.width;lh = obj.clip.height;}else{
lw = obj.style.width.replace("px","");lh = obj.style.height.replace("px","");}
x = (document.layers) ? ".left" : ".style.left";
y = (document.layers) ? ".top" : ".style.top";
if(h == "l"){eval(fun+"('"+theDiv+"')"+x+"="+hPx);}
if(h == "c"){eval(fun+"('"+theDiv+"')"+x+"="+dw+"/2-"+lw+"/2");}
if(h == "r"){eval(fun+"('"+theDiv+"')"+x+"="+dw+"-"+lw+"-"+hPx);}
if(v == "t"){eval(fun+"('"+theDiv+"')"+y+"="+vPx);}
if(v == "m"){eval(fun+"('"+theDiv+"')"+y+"="+dh+"/2-"+lh+"/2");}
if(v == "b"){eval(fun+"('"+theDiv+"')"+y+"="+dh+"-"+lh+"-"+vPx);}}
}
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))};
}
var isNav4, isIE4;
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 = 675;
h = screen.height-25;
window.outerWidth = w;
window.outerHeight = h;
//alert(window.outerWidth);
}
if (isIE4) {
//alert(document.body.clientWidth);
w = 675;
h = screen.height-25;
window.resizeTo(w, h);
//alert(document.body.clientWidth);
}
self.moveTo(0,0);
}
function resizeToFull() {
self.moveTo(0,0);
w = screen.width;
h = screen.height-30;
if (isNav4) {
self.outerWidth = w;
self.outerHeight = h;
}
if (isIE4) {
self.resizeTo(w, h);
}
}
function obbligatori() {
return true;
}
function qta(indice,modo) {
browser = navigator.appName;
P7_downClass2('buttAggiorna','pulsantiHover');
document.forms[0].buttAggiorna.disabled = false;
if (modo=='+1') {
document.forms[0]['qta'+indice].value = Number(document.forms[0]['qta'+indice].value)+1;
} else {
if (document.forms[0]['qta'+indice].value>1) {
document.forms[0]['qta'+indice].value = Number(document.forms[0]['qta'+indice].value) - 1;
}
}
}
function svuotaCarrello() {
if (confirm('Eliminare tutti i prodotti \rdal carrello?')) {
submitForm('empty');
}
}
function printIt() {
window.print();
}
//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) { WindowOpen.window.focus(); }
}
//PVII
function P7_downClass2() { //v1.0 by PVII
var j,args=P7_downClass2.arguments;if(document.getElementById){
if(!document.p7setdown){p7dco=new Array();document.p7setdown=true;}
p7dco.length=0;j=0;for(var 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;
}
}
function IsValidUrl(urlToTest) {
var re;
re = new RegExp("(http|ftp|https)://[-A-Za-z0-9._/]+");
if (re.test(urlToTest)==false) {
return false;
} else {
return true;
}
}
//FAUSTO
clicked=false;
function gotoLink(url) {
if (clicked==false) {
//alert(url);
if (IsValidUrl(url)) {
OpenWin = this.open(url, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
clicked=true;
self.location.reload();
} else {
self.location.href=url;
clicked=true;
}
}
}
function noSpam(user,site) {
document.write('');
document.write(user + '@' + site + '');
}
pageLoaded=0;
// Code by AshzFall.
// http://www.ashzfall.com/flash/fscjslib.html
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var libLoad=0;
// Handle all the the FSCommand messages in a Flash movie
function dove_DoFSCommand(command, args) {
if (libLoad)
{doComs(command,args);}}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
document.write('<'+'SCRIPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('Sub dove_FSCommand(ByVal command, ByVal args)\n');
document.write(' call dove_DoFSCommand(command, args)\n');
document.write('end sub\n');
document.write('<'+'/SCRIPT\> \n');
}
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 = 'addToCart.asp?'
+'azione=add'
+'&prodId='+prodId
+'&qta='+qta;
//+'&continua='+urlContinua;
this.location.href = url;
} else {
alert("Inserire la quantità!");
}
}
//elimina il prodotto dal carrello
function removeFromCart(prodId) {
if (confirm('Eliminare il prodotto \r'+prodId+' dal carrello?')) {
self.location.href='carrello.asp?azione=delete&prodId='+prodId;
}
}
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 vaiACategoria(pagina,tipo,tipoNo,oggetto,queryString) {
prodCat = escape(oggetto[oggetto.selectedIndex].value);
self.location.href = pagina
+'?prodCat='+prodCat
+'&tipo='+tipo
+'&tipoNo='+tipoNo
+queryString;
}
function vaiASettore(pagina,tipo,oggetto) {
prodSettore = escape(oggetto[oggetto.selectedIndex].value);
self.location.href = pagina
+'?prodSettore='+prodSettore
+'&tipo='+tipo;
}
function vaiAGenere(pagina,oggetto) {
artGenere = escape(oggetto[oggetto.selectedIndex].value);
self.location.href = pagina
+'?artGenere='+artGenere;
}
function aggiornaStato(oggetto) {
trStato = escape(oggetto[oggetto.selectedIndex].value);
self.location.href = 'carrello.asp?trStato='+trStato;
}
//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) {
//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');
}
function estensioneJPG(stringa) {
var re = /.jpg$/gi;
valido = re.test(stringa);
if (valido) {
return true;
} else {
return false;
}
return true;
}