/*Gomma Layout Jerry Masslo www.mondoquarto.org jerrymasslo@mondoquarto.org Gennaio 2004 - mod aprile - maggio 2004*/
function createCookie(name,value,days) { 
if (days) { 
var date = new Date(); 
date.setTime(date.getTime()+(days*24*60*60*1000)); 
var expires = '; expires='+date.toGMTString(); 
} 
else expires = ''; 
document.cookie = name+'='+value+expires+'; path=/';
return true;
} 
function readCookie(name) { 
var nameEQ = name + '='; 
var ca = document.cookie.split(';'); 
ritorno=false;
for(var i=0;i < ca.length;i++) { 
var c = ca[i]; 
while (c.charAt(0)==' ') c = c.substring(1,c.length); 
if (c.indexOf(nameEQ) == 0)ritorno=c.substring(nameEQ.length,c.length); 
} 
return ritorno; 
} 




caratteri=new Array('verdana','arial','courier','georgia','garamond',"'lucida console'","'trebuchet ms'",'tahoma',"'11S01 Black Tuesday'",'AddElectricCity','African','AlgerianD','Amano',"'Amelia BT'","'Americana XBd BT'","'AmerType Md BT'",'Aquaduct','Arbeka',"'AvantGarde Bk BT'","'Babylon5 Hollow'","'BankGothic Lt BT'","'Bauhaus Md BT'",'Beatbox','Bedrock','BinnerD','BlackForest','Book Antiqua',"'Bookman Old Style'","'Bremen Blk BT'",'Brisk',"'Brookhouse Heavy'","'CaslonOpnface BT'","'Century Gothic'","'Century725 Blk BT'",'ChiselD',"'Clarendon BT'","'Clarendon Hv BT'","'CloisterBlack BT'","'Comic Sans MS'","'Compacta Blk BT'","'CopprplGoth Hv BT'",'CountdownD',"'Courier New'",'Dunebug','Eklektic',"'EngrvrsOldEng Bd BT'",'EnviroD',"'Exotc350 Lt BT'",'Fixedsys',"'Follies LET'","'Forgotten Futurist'","'FormalScrp421 BT'","'Freefrm721 Blk BT'","'Freehand591 BT'",'FreestyleScrD','Frission',"'FrizQuadrata BT'","'Futura Md BT'",'Future','Galleria',"'Geometr231 BT'","'Geometr885 BT'",'Glacier','GlaserSteD','GoldMine','GoudyOlSt BT','Griffon',"'Hazel LET'",'Honda',"'Humnst777 Lt BT'","'HuxleyVertical BT'",'Impact','mancante',"'Jazz LET'","'Kabel Bk BT'","'Kaufmann BT'","'Lady Ice'",'Larabiefont','LatinWidD',"'Lois Ann'","'London Tube'","'Lucida Sans Unicode'","'Millenium BdEx BT'",'Modern',"'Monospac821 BT'","'Orbit-B BT'","'Palatino Linotype'","'ParkAvenue BT'",'Pepper',"'Pioneer BT'",'President',"'Ribbon131 BT'",'Roman','Sanlite',"'Sci Fied 2002'",'Script','SerpentineDBol',"'SF Arborcrest Medium'","'SF Laundromatic'","'SF Old Republic'","'SF Speedwaystar'","'SF Theramin Gothic Shaded'","'SF TransRobotics'","'SF Willamette'",'SquireD',"'Staccato222 BT'",'StopD',"'Swis721 BlkOul BT'","'Swis721 BlkRnd BT'",'Technical','Ultraworld',"'VAGRounded BT'","'Van Dijk'",'Xpressive','Zekton','Zrnic',"'New Aster'");



Linkili =  new Array (82)
for (i=0;i<83;i++)
Linkili[i]='Linki'+[i];

Lonkiul =  new Array (82)
for (i=0;i<83;i++)
Lonkiul[i]='Lonki'+[i];

Lanki =  new Array (82)
for (i=0;i<83;i++)
Lanki[i]='Lanki'+[i];

Apri = new Array ('block','none');



croma=new Array('#ffffff','#f7f7f7','#f0f0f0','#e8eaee','#dbdbdb','#cdcdcd','#a4a4a4','#838383','#727272','#616161','#1a2326','#785243','#966654','#b08371','#c09b8d','#e3cad2','#cda0af','#c0879a','#ad677d','#9d6670','#cf6c67','#d88985','#e2a8a5','#ecc8c6','#f7e7e6','#ffb09f','#ffcbbf','#ff8971','#ff0000','#ea3e60','#e12700','#ae1f00','#844f00','#b76c4d','#ce7b00','#ff9900','#ffcc00','#ffe3bb','#fff4e6','#ffffec','#ffffa8','#ffff6c','#f4f400','#deff93','#c0ff2d','#a4ea00','#8dca00','#76a800','#00824e','#7d8b72','#809b64','#00c475','#2bffaa','#7dffcb','#ceffec','#9de1d9','#9ccdcb','#79bbb8','#55a6a2','#6f9591','#417e7b','#336462','#40535e','#4f6775','#648395','#32859c','#3996b0','#829cac','#a7bac5','#cbd6dc','#cee7ff','#b0d8ff','#7dbeff','#3399ff','#0078f0','#0000ff','#0061c1','#8375ac','#6700c4','#9622ff','#c17dff','#d5a6ff');

Testi =new Array ('60%','70%','80%','90%','100%','120%','150%','200%','500px','620px','760px','900px','1100px','1400px','3000px');
ImgSfondo=new Array('BSf/ScY8.png','BSf/ChY8.png','BSf/A2Y8.png','BSf/ArY8.png','BSf/AvY8.png','BSf/GiY8.png','BSf/M2Y8.png','BSf/MaY8.png','BSf/MiY8.png','BSf/QBY8.png','BSf/V1Y8.png','BSf/VeY8.png','BSf/VsY8.png','BSF/QuadVerY8.png','BSf/BeigLinY24.png','BSF/BeigGriglY24.png','BSf/GriglTraspY8.png','BSf/DiagTraspY8.png','BSf/RigTraspY8.png','BSf/Rig2TraspY8.png','BSf/QuadTraspY8.png','BSf/Quad2TraspY8.png','BSf/RettanTraspY8.png','BSf/CercTraspY8.png','BSf/CercTrasp2Y8.png','BSf/BulkTrY8.png','BSf/BulkTr2Y8.png','BSf/FanESfon2.jpg');

Immagini=new Array('GommaSimboli4.jpg','TeIm/PomY8.png','TeIm/RocY8.png','TeIm/TazY8.png','TeIm/FanA.jpg','TeIm/FanB.jpg','TeIm/FanC.jpg','TeIm/FanD.jpg','TeIm/FanE.jpg','TeIm/Fave.jpg','TeIm/Pen.jpg');

Acc=new Array()
for(i=0;i<14;i++){
Acc[i]=new Array();
for(j=0;j<14;j++){
if(j!=i){
Acc[i][j]=0
}
else Acc[i][j]="-.3em"
}
}
Bor=new Array()
for(i=0;i<14;i++){
Bor[i]=new Array();
for(j=0;j<14;j++){
if(j!=i){
Bor[i][j]=0
}
else Bor[i][j]="2px dashed #ffcc66"
}
}


function FS(fs){//cambia la posizione dei link ridimensiona caratteri e bordeggia
var sezione = document.getElementById('Carat');
var punti = sezione.getElementsByTagName('a');
for(k=0;k<8;k++) { 
punti[k].style.bottom=Acc[k][fs];
punti[k].style.border=Bor[k][fs];
}
createCookie('GomFS',fs,365);
}

function PS(ps){//cambia la posizione dei link ridimensiona pagina e bordeggia
var sezione = document.getElementById('LarPag');
var punti = sezione.getElementsByTagName('a');
for(k=0;k<14;k++) { 
punti[k].style.bottom=Acc[k][ps];
punti[k].style.border=Bor[k][ps];
}
createCookie('GomPS',ps,365);
}

function Immagine(Imm) {//cambia le imm della testata
var body =document.getElementById('Gomma');
document.images.Gomma.src=Immagini[Imm];
document.images.Gomma2.src=Immagini[Imm];
createCookie('GomTesta',Imm,365);
}


function SfonImg(bix){//Immagine di sfondo
body=document.getElementsByTagName('body')[0];
if (bix==40) {body.style.backgroundImage ="none";}
else{
body.style.backgroundImage = "url(" + ImgSfondo[bix] + ")";
}
createCookie('GomSfonImg',bix,365);
}
function SfonCol(bex){//Immagine di sfondo
body=document.getElementsByTagName('body')[0];
body.style.backgroundColor = croma[bex];
createCookie('GomSfonCol',bex,365);
}


function Capi(let){//capilettera e link corpo
crody = document.getElementById('SottoVoci');
var body = document.getElementsByTagName ('p');
for(i=0;i<body.length;i++){
body[i].className = Linkili[let];
}

	createCookie('GomCapi',let,365);
}

function Extra (bre) {//voce menu corrente e menų basso
body=document.getElementById('XMenu');
body.style.color = croma [bre];
sbody=document.getElementById('Interruttore1');
crody=sbody.getElementsByTagName('a');
crody[0].style.color= croma [bre];
crody[1].style.color= croma [bre];
createCookie('GomExtra',bre,365);
}

function Linki(be){// voci menų
sbody=document.getElementById('Menu');
var body=sbody.getElementsByTagName('ul'); 
 for(i=0;i<body.length;i++){
 body[i].className = Lonkiul[be];
}
//var body=document.getElementById('XMenu');//voce menų evidenziata
//body.style.color = croma [be];
createCookie('GomLinki',be,365);
}

function Lonki(ba){//hover voci menų
body = document.getElementsByTagName ('li');
 for(i=0;i<body.length;i++){
 body[i].className = Lanki[ba];
}
createCookie('GomLonki',ba,365);
}

function Font(size) {//dimensioni testo
	var body = document.getElementsByTagName('body')[0];
	body.style.fontSize = Testi[size];
	createCookie('GomFont',size,365);
}

function Pag(largo) {//dimensioni pagina
	var body = document.getElementById('Contenitore');
	body.style.width = Testi[largo];
	createCookie('GomPag',largo,365);
}



function Car(fam) { //tipo di carattere
var body = document.getElementsByTagName('body')[0]; 
body.style.fontFamily = caratteri[fam]; 
var body = document.getElementsByTagName('select')[0]; 
body.style.fontFamily = caratteri[fam]; 
createCookie('Car',fam,365); 
}

function Sfondo1(color) { //sfondo menų basso e bordi estremi
var body=new Array(); 
body[0]=document.getElementById('SottoMenu'); 
body[1]=document.getElementById('XMenu');
body[2]=document.getElementById('BordinoSopra');
body[3]=document.getElementById('BordinoSotto');
body[4]=document.getElementById('Impostazioni');
body[5]=document.getElementById('Interruttore1');
body[6]=document.getElementById('VecchieVersioni');
for(i=0;i<body.length;i++){ 
body[i].style.backgroundColor = croma[color];
}
var body = document.getElementsByTagName ('hr');
 for(i=0;i<body.length;i++){
 body[i].style.backgroundColor = croma[color];
}
createCookie('GomSfondo1',color,365); 
}


function Font(size) {//dimensioni testo
var body=new Array(); 
body[0]=document.getElementsByTagName('body')[0];
body[1]=document.getElementsByTagName('select')[0];
body[2]=document.getElementById('Bottone');
for(i=0;i<body.length;i++){ 	
body[i].style.fontSize = Testi[size];
}
createCookie('GomFont',size,365);
}



function Sfondo2(colore) { //sfondo menų alto e titoli estremi
var body=new Array(); 
body[0]=document.getElementById('Xh1'); 
body[1]=document.getElementById('Testata'); 
body[2]=document.getElementById('Xh2');
body[3]=document.getElementById('Menu');
body[4]=document.getElementById('SottoVoci');
body[5]=document.getElementById('Interruttore2');
for(i=0;i<body.length;i++){ 
body[i].style.backgroundColor = croma[colore];
} 
createCookie('GomSfondo2',colore,365); 
}

function Sfondo3(colla){//sfondo corpo testo
var body=new Array()
body[0]=document.getElementById('Corpo');
body[1]=document.getElementById('Contenitore');
body[2]=document.getElementById('Piede');
for(i=0;i<body.length;i++){ 
body[i].style.backgroundColor = croma[colla];
}
lody = document.getElementById('Interruttore2');
var crody=new Array()
crody[0] = document.getElementById('SottoVoci');
crody[1] = lody.getElementsByTagName('a')[0];
for(i=0;i<crody.length;i++){ 
crody[i].style.color = croma [colla];
}
createCookie('GomSfondo3',colla,365);
}


function Testo(tinta) {//colore testo corpo 
var body=new Array()
body[0] = document.getElementById('Corpo');
body[1] = document.getElementById('Piede');
for(i=0;i<body.length;i++){ 
body[i].style.color = croma[tinta];
}
createCookie('GomTesto',tinta,365);
}


function Accendi(pre) {//apri chiudi configura layout
	body= document.getElementById('Matrice');
	body.style.display = Apri[pre];
}

function Configura(display) {//apri chiudi configura layout
	body= document.getElementById('Impostazioni');
	body.style.display = Apri[display];
}

function Vecchi(mostra) {//apri chiudi vecchie versioni
	var body = document.getElementById('VecchieVersioni');	
	body.style.display = Apri[mostra];
}

function Aiuto(mostra) {//apri chiudi vecchie versioni
	var body = document.getElementById('AiutoCar');
	body.style.display = Apri[mostra];
}


function SalvaCoc(){
AA = readCookie('GomLinki');
BB = readCookie('GomLonki');
CC = readCookie('GomSfondo1');
DD = readCookie('GomSfondo2');
EE = readCookie('GomSfondo3');
FF = readCookie('GomTesto');
GG = readCookie('GomCapi');
HH = readCookie('GomExtra');
A=Number(AA)+10;
B=Number(BB)+10;
C=Number(CC)+10;
D=Number(DD)+10;
E=Number(EE)+10;
F=Number(FF)+10;
G=Number(GG)+10;
H=Number(HH)+10;
frutta=A+'a'+B+'a'+C+'a'+D+'a'+E+'a'+F+'a'+G+'a'+H;
createCookie('GomSalva',frutta,365);
}

window.onload = function() {

be = (readCookie('GomLinki')? readCookie('GomLinki'):37);
ba = (readCookie('GomLonki')? readCookie('GomLonki'):67);
color = (readCookie('GomSfondo1')? readCookie('GomSfondo1'):64);
colore = (readCookie('GomSfondo2')? readCookie('GomSfondo2'):21);
colla = (readCookie('GomSfondo3')? readCookie('GomSfondo3'):2);
tinta = (readCookie('GomTesto')? readCookie('GomTesto'):10);
let = (readCookie('GomCapi')? readCookie('GomCapi'):27);
bre = (readCookie('GomExtra')? readCookie('GomExtra'):24);

size = (readCookie('GomFont')? readCookie('GomFont'):2);
largo = (readCookie('GomPag')? readCookie('GomPag'):3);
bex = (readCookie('GomSfonCol')? readCookie('GomSfonCol'):21);
fam = (readCookie('Car')? readCookie('Car'):0);
display = 1;
mostra = 1;
bix = (readCookie('GomSfonImg')? readCookie('GomSfonImg'):0);
Imm = (readCookie('GomTesta')? readCookie('GomTesta'):0);
fs = (readCookie('GomFS')? readCookie('GomFS'):2);
ps = (readCookie('GomPS')? readCookie('GomPS'):3);
frutta = (readCookie('GomSalva')? readCookie('GomSalva'):'47a29a74a31a12a19a28a34');
salva = (readCookie('GomSalvaNome')? readCookie('GomSalvaNome'):'qui il tuo');
Conserva();
SfonCol(bex)
//Salva1();
Extra(bre);
PS(ps);
FS(fs);
Immagine(Imm);
SfonImg(bix);
Capi(let);
Font(size);
Testo(tinta);
Linki(be);
Lonki(ba);
Pag(largo);
Sfondo1(color);
Sfondo2(colore);
Sfondo3(colla);
Car(fam);
Configura(display);
Vecchi(mostra);
}





function feffe(indice) { 

switch(indice) 
{
case 0:
break;
case 1: Linki(37);Lonki(19);Sfondo1(64);Sfondo2(21);Sfondo3(2);Testo(9);Capi(18);Extra(24);//default
break;
case 2: Linki(37);Lonki(50);Sfondo1(36);Sfondo2(8);Sfondo3(1);Testo(19);Capi(50);Extra(61);//Xinod
break;
case 3: Linki(38);Lonki(50);Sfondo1(29);Sfondo2(61);Sfondo3(2);Testo(10);Capi(28);Extra(24);//Antos
break;
case 4: Linki(37);Lonki(27);Sfondo1(14);Sfondo2(7);Sfondo3(2);Testo(9);Capi(49);Extra(9);//Mich
break;
case 5: Linki(36);Lonki(35);Sfondo1(37);Sfondo2(49);Sfondo3(38);Testo(61);Capi(49);Extra(49);//Dennis
break;
case 6: Linki(39);Lonki(34);Sfondo1(49);Sfondo2(14);Sfondo3(39);Testo(32);Capi(34);Extra(37);//Var
break;
case 7: Linki(54);Lonki(81);Sfondo1(36);Sfondo2(77);Sfondo3(2);Testo(78);Capi(35);Extra(78);//Willibyt
break;
case 8: Linki(37);Lonki(6);Sfondo1(5);Sfondo2(21);Sfondo3(8);Testo(26);Capi(81);Extra(20);//Alethesnake
break;
case 9:
prendi=frutta;
a=prendi.substr(0,2);
b=prendi.substr(3,2);
c=prendi.substr(6,2);
d=prendi.substr(9,2);
e=prendi.substr(12,2);
f=prendi.substr(15,2);
g=prendi.substr(18,2);
h=prendi.substr(21,2);
A=Number(a)-10;
B=Number(b)-10;
C=Number(c)-10;
D=Number(d)-10;
E=Number(e)-10;
F=Number(f)-10;
G=Number(g)-10;
H=Number(h)-10; Linki(A);Lonki(B);Sfondo1(C);Sfondo2(D);Sfondo3(E);Testo(F);Capi(G);Extra(H);//personale
 }
}


function trim(str){ 


var str1 = str.replace(/^ +/, ""); 
str1 = str1.replace(/ +$/, ""); 
return str1; 
} 

function SalvaNome(){

var maxLen = 16; /* codice  per limitare e condizionare i caratteri del prompt č di AletheSnake*/
var actLen = maxLen + 1;
var salva   = "";

while (actLen < 1 || actLen > maxLen) {
salva = prompt('Vengono salvate le impostazioni di colore scelte da questo pannello o dalla pagina dedicata con scelta pių vasta di colori - massimo 16 caratteri', '');
if (salva==null) return;
salva   = trim(salva);
actLen = salva.length;

if (actLen < 1 || actLen > maxLen) {
alert('Il tuo nome deve essere compreso tra 1 e ' + maxLen + ' caratteri!, te lo dissi, non te lo dissi, ma te lo dissi, dai');
}
}
questo=document.getElementById('PreImpostate');
questa=questo.getElementsByTagName('option')[9];
questa.text=(salva);
createCookie('GomSalvaNome',salva,365);
}

function Conserva(){
questo=document.getElementById('PreImpostate');
questa=questo.getElementsByTagName('option')[9];
scrivi=readCookie('GomSalvaNome');
if (scrivi==false) return;
questa.text=scrivi;
}

function Fai(){
Linki(37);Lonki(67);Sfondo1(64);Sfondo2(21);Sfondo3(2);Testo(10);Capi(27);Extra(14);
}
