// Newsky Group (c) 2007 - Tutti i diritti riservati
// Ultima revisione: 23/12/2006

if ( document.location.search.length > 0 )
{
if ( !( IE = navigator.userAgent.indexOf("MSIE ") != -1 ) && navigator.userAgent.indexOf("Firefox") == -1 )
{ alert("Si è verificato un errore. :-(\nIl Deathclock è stato testato con Internet Explorer e Firefox, e potrebbe non funzionare con altri browser.") }
else if ( confirm("Si è verificato un errore. :-(\nPuoi inviarci una mail per segnalarci l'errore e aiutarci a risolverlo.\nNel messaggio saranno indicate le risposte che hai dato e alcune informazioni sul tuo browser e sistema operativo. Tali informazioni saranno usate *unicamente* per cercare di risalire al motivo del problema. Se vuoi puoi aggiungere altre informazioni che ritieni utili/significative per capire il problema.") )
{ link = "mailto:nicholas@newsky.it?subject=[Newsky.it] Segnalazione errori&body=Grazie! [ Pagina " + document.location.toString().substring(0,document.location.toString().indexOf('?')) + " ]   Risposte: " + escape(document.location.search) + " - Sys info: " + navigator.userAgent + " // " + navigator.platform + " // " + screen.width + " - Altre informazioni utili:"
IE ? window.open(link) : document.location = link }
location.replace("index.htm")
}

function opt(text, value)
{
if ( text == null || value == null ) { text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" ; value = "|" }
document.write("<option value='" + value + "'>" + text + "</option>")
}

function initialize()
{
document.modulo.D1.value = document.modulo.D2.value = document.modulo.D3.value = document.modulo.D4.value = document.modulo.D5.value = document.modulo.D6.value = document.modulo.D7.value = document.modulo.D8.value = document.modulo.D9.value = document.modulo.D10.value = document.modulo.D11.value = document.modulo.D12.value = "|"
done = female = false
switchD1()
switchD2()
switchD3()
switchD4()
switchD5()
switchD6()
switchD7()
switchD8()
switchD9()
switchD10()
switchD11()
switchD12()
}

function switchD1()
{
D1 = document.modulo.D1.value
if ( D1 <= 25 ) { text = "Devi ancora iniziare a ripagare tutto quello che la società ha fatto per te..." }
else if ( D1 > 25 && D1 <= 45 ) { text = "Sei nel pieno delle tue forze e all'apice della tua utilità!" }
else if ( D1 > 45 ) { text = "Purtroppo l'orologio ticchetta, e presto la società dovra pagare la tua debolezza..." }
else { text = null }
if ( D1 != "|" ) { D1 = D1 < 35 ? Math.pow(484.9255-Math.pow(35-D1,1.85),0.55) : Math.pow(187.2812-Math.pow(D1-35,1.25),0.65) }
comment("D1x",text)
}

function switchD2()
{
D2 = document.modulo.D2.value
if ( D2 == 8 ) { text = "Ma in Italia serve ancora a qualcosa?... :-/" }
else if ( D2 == 6 ) { text = "Tanta teoria, ma poi, ci si fa qualcosa?" }
else if ( D2 == 4 ) { text = "Il minimo sindacale insomma, ma l'importante è tirare la carretta..." }
else if ( D2 == 2 ) { text = "E che lavoro fai, il politico?! :-)" }
else if ( D2 == 0 ) { text = "No problem, datti alla TV, la non cè bisogno di giente che sà scrivere..." }
else { text = null }
comment("D2x",text)
}

function switchD3()
{
D3 = document.modulo.D3.value
if ( D3 == 14 ) { text = "Complimenti, sei nel gota della società! (Inchino)" }
else if ( D3 == 11 ) { text = "Il cuore pulsante e la spina dorsale della nostra economia! :-)" }
else if ( D3 == 5 ) { text = "Mah, sempre meglio di tanta gente..." }
else if ( D3 == 2 ) { text = "Ma c'è proprio bisogno della tua figura?? :-/" }
else if ( D3 == -2 ) { text = "Essere inutile e antisociale! Cambia \"mestiere\" per favore... :-(" }
else { text = null }
comment("D3x",text)
}

function switchD4()
{
D4 = document.modulo.D4.value
if ( D4 == 15 ) { text = "Ci abbiamo dato sotto eh... brav#! :-)" }
else if ( D4 == 12 ) { text = "Bene, la società te ne sarà riconoscente!" }
else if ( D4 == 8 ) { text = "Qui manca l'impegno! Chi è che ti pagherà la pensione?" }
else if ( D4 == 3 ) { text = "Male! Inizia a *lavorarci* su, sfaticat#! ;-P" }
else if ( D4 == 0 ) { text = "Proporrei di alzare la tasse a tutti i single impenitenti come te..." }
else { text = null }
comment("D4x",text)
}

function switchD5()
{
D5 = document.modulo.D5.value
if ( D5 == 11 ) { text = "Evviva il capitalismo consumistico!" }
else if ( D5 == 8 ) { text = "Beh, non te la passi male mi sembra..." }
else if ( D5 == 5 ) { text = "Middle-class? Eh beh, di 'sti tempi è già tanto..." }
else if ( D5 == 2 ) { text = "Qui o sei disoccupat# o sei mantenut#! :-)" }
else if ( D5 == 0 ) { text = "Squattrinat# come Zio Paperino o taccagn# come Zio Paperone? :-/" }
else { text = null }
comment("D5x",text)
}

function switchD6()
{
D6 = document.modulo.D6.value
if ( D6 == 9 ) { text = "Lo Stato te ne sarà eternamente grato! (Oh yeah, credici...)" }
else if ( D6 == 7 ) { text = "Alto profilo morale! Brav#, così si fa!" }
else if ( D6 == 4 ) { text = "Vale a dire? Quante sul totale? Più o meno del 10%? :-/" }
else if ( D6 == 1 ) { text = "Cioè?! Guarda che non è mica opzionabile la cosa! :-(" }
else if ( D6 == -2 ) { text = "Tranquill#, stiamo avvisando la Guardia di Finanza affiniché rimedi..." }
else { text = null }
comment("D6x",text)
}

function switchD7()
{
D7 = document.modulo.D7.value
if ( D7 == 8 ) { text = "Aiutare il prossimo è quanto di più bello... ma a te chi ci pensa?" }
else if ( D7 == 4 ) { text = "Chiariamo: sono esclusi gli hobby che *costruiscono* figli... ;-)" }
else if ( D7 == 1 ) { text = "Quindi assolutamente niente... SVEGLIA!!" }
else if ( D7 == -1 ) { text = "Ottimo, ottimo, una vita intensa la tua... :-/" }
else if ( D7 == -4 ) { text = "Ti auguro tante belle bastonate... Te le meriti!!" }
else { text = null }
comment("D7x",text)
}

function switchD8()
{
D8 = document.modulo.D8.value
if ( D8 == 7 ) { text = "Ecco, allora c'è qui qualcuno che avrebbe bisogno del tuo aiuto... 0:-)" }
else if ( D8 == 5 ) { text = "Ehm, usanza piuttosto diffusa in Italia... 8-|" }
else if ( D8 == 3 ) { text = "Parenti serpenti, stai attent#!" }
else if ( D8 == 1 ) { text = "Eh, questa la si può intendere in molti modi... ;-)" }
else if ( D8 == 0 ) { text = "Guarda, mi fai schifo e non voglio neanche conoscerti..." }
else { text = null }
comment("D8x",text)
}

function switchD9()
{
D9 = document.modulo.D9.value
if ( D9 == 5 ) { text = "Insomma scassi loro le balle a ogni ora, bene! :-)" }
else if ( D9 == 4 ) { text = "Bene, ma mi raccomando, non FATE casini!" }
else if ( D9 == 3 ) { text = "Eh vabbè, il sabato è il giorno sacro, si sa." }
else if ( D9 == 2 ) { text = "Ogni tanto li incontri per strada?..." }
else if ( D9 == 0 ) { text = "[ Un minuto di silenzio :'-( ]" }
else { text = null }
comment("D9x",text)
}

function switchD10()
{
D10 = document.modulo.D10.value
if ( D10 == 4 ) { text = "Guarda che ti viene la tendinite..." }
else if ( D10 == 3 ) { text = "Hai anche dato un nome al tuo telefono?" }
else if ( D10 == 2 ) { text = "Vedo che tieni il pollice allenato..." }
else if ( D10 == 1 ) { text = "Qualcuno ancora si ricorda di te! :-)" }
else if ( D10 == 0 ) { text = "COOSA?!? Niente SMS, MMS, GPRS, TVB, CCT?? Sei inutile!! :-O" }
else { text = null }
comment("D10x",text)
}

function switchD11()
{
D11 = document.modulo.D11.value
if ( D11 == 6 ) { text = "Chi regge la casa regge il mondo, può sembrare stupido ma è così..." }
else if ( D11 == 4 ) { text = "Fossero tutti come te, il mondo sarebbe migliore... ;-)" }
else if ( D11 == 2 ) { text = "E chissene... voglio dire, complimenti per la cultura!" }
else if ( D11 == 1 ) { text = "Mmm quanto odio quelle maledette suonerie... :-/" }
else if ( D11 == -1 ) { text = "AHH! VERGOGNATI! Ladr#! (Se hai GTA2 chiamami 3479298*** thx)" }
else { text = null }
comment("D11x",text)
}

function switchD12()
{
D12 = document.modulo.D12.value
if ( D12 == 5 ) { text = "Tu persegui i valori, brav#, sei illuminat#." }
else if ( D12 == 4 ) { text = "Tu persegui la conoscenza, ti fa onore." }
else if ( D12 == 2 ) { text = "Tu persegui la grandezza, ma non pensare troppo a te stess#!" }
else if ( D12 == 0 ) { text = "Tu persegui la fama, ma non ci sono cose più importanti?" }
else if ( D12 == -1 ) { text = "A te ti perseguono penalmente!!! :-DD" }
else { text = null }
comment("D12x",text)
}

function comment(id,text)
{
if ( text == null ) { text = "Rispondi alla domanda!" }
document.getElementById(id).innerHTML = text.replace("#",( female ? "a" : "o" )).replace("#",( female ? "a" : "o" ))
}

function calculate()
{
if ( D1 == "|" ) { error(1) }
else if ( D2 == "|" ) { error(2) }
else if ( D3 == "|" ) { error(3) }
else if ( D4 == "|" ) { error(4) }
else if ( D5 == "|" ) { error(5) }
else if ( D6 == "|" ) { error(6) }
else if ( D7 == "|" ) { error(7) }
else if ( D8 == "|" ) { error(8) }
else if ( D9 == "|" ) { error(9) }
else if ( D10 == "|" ) { error(10) }
else if ( D11 == "|" ) { error(11) }
else if ( D12 == "|" ) { error(11) }
else
{
if ( !done ) { alert("Ricorda che puoi richiedere il tuo Attestato di utilità sociale cliccando sul relativo link in fondo alla pagina.") }
scrollTo(0,1350)
done = true
score = -(-D1-D2-D3-D4-D5-D6-D7-D8-D9-D10-D11-D12)
score = Math.round((score+25)/1.5)
k = Math.floor((99-score)/5)
IE ? document.styleSheets(1).addRule("#bar1","background-image: url('"+base+"deathclock/_/bar-sc.jpg')") : document.styleSheets[1].insertRule("#bar1 { background-image: url('"+base+"deathclock/_/bar-sc.jpg') }",document.styleSheets[1].cssRules.length)
document.getElementById("verdict").innerHTML = "L'esclusivo e infallibile Socialclock di Newsky.it ti attribuisce un punteggio di<br><span id='scorex'>0/100</span><br>il che ti vale il titolo onorifico di<br><span id='classx'></span>&nbsp;(<a href='javascript:levelsList(" + (k+1) + ")'>a che livello sono?</a>),"
if ( screen.width < 1000 && k == 17 ) { IE ? document.styleSheets(1).addRule("#classx","letter-spacing: -1px") : document.styleSheets[1].insertRule("#classx { letter-spacing: -1px }",document.styleSheets[1].cssRules.length) }
else { IE ? document.styleSheets(1).addRule("#classx","letter-spacing: 0px") : document.styleSheets[1].insertRule("#classx { letter-spacing: 0px }",document.styleSheets[1].cssRules.length) }
document.getElementById("classx").innerHTML = levels[k][0]
if ( screen.width < 1000 && levels[k][1].substring(0,1) == "#" ) { IE ? document.styleSheets(1).addRule("#defx","letter-spacing: -1px") : document.styleSheets[1].insertRule("#defx { letter-spacing: -1px }",document.styleSheets[1].cssRules.length) }
else { IE ? document.styleSheets(1).addRule("#defx","letter-spacing: 0px") : document.styleSheets[1].insertRule("#defx { letter-spacing: 0px }",document.styleSheets[1].cssRules.length) }
def = levels[k][1].substring(1)
document.getElementById("defx").innerHTML = "<span style='color: #FFFFFF; font-weight: normal'>conferito </span>" + def + "<span style='color: #FFFFFF; font-weight: normal'>.</span>"
countdown(score*0.05)
window.setTimeout("countdown(" + (score*0.1) + ")",50)
window.setTimeout("countdown(" + (score*0.15) + ")",100)
window.setTimeout("countdown(" + (score*0.2) + ")",150)
window.setTimeout("countdown(" + (score*0.25) + ")",200)
window.setTimeout("countdown(" + (score*0.3) + ")",250)
window.setTimeout("countdown(" + (score*0.35) + ")",300)
window.setTimeout("countdown(" + (score*0.4) + ")",350)
window.setTimeout("countdown(" + (score*0.45) + ")",400)
window.setTimeout("countdown(" + (score*0.5) + ")",450)
window.setTimeout("countdown(" + (score*0.55) + ")",500)
window.setTimeout("countdown(" + (score*0.6) + ")",550)
window.setTimeout("countdown(" + (score*0.65) + ")",600)
window.setTimeout("countdown(" + (score*0.7) + ")",650)
window.setTimeout("countdown(" + (score*0.75) + ")",700)
window.setTimeout("countdown(" + (score*0.8) + ")",750)
window.setTimeout("countdown(" + (score*0.85) + ")",800)
window.setTimeout("countdown(" + (score*0.9) + ")",850)
window.setTimeout("countdown(" + (score*0.95) + ")",900)
window.setTimeout("countdown(" + (score) + ")",950)
}
}

function error(q)
{
alert("Non hai risposto alla domanda " + q + "!")
}

function countdown(score)
{
document.getElementById("scorex").innerHTML = Math.round(score) + "/100"
IE ? document.styleSheets(1).addRule("#bar1","width: "+Math.round(7*score)+"px!important") : document.styleSheets[1].insertRule("#bar1 { width: "+Math.round(7*score)+"px!important }",document.styleSheets[1].cssRules.length)
}

function attestation()
{
if ( !done ) { alert("Devi chiedere il verdetto prima!") }
else
{
q = ( female ? '1' : '0' ) + '&' + score
window.open("richiesta.htm?" + q,"richiesta","height=295,width=600,status=no,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=no")
}
}

function levelsList(level)
{
n = level == null ? "" : "?" + level
window.open("livelli.htm"+n,"livelli","height=445,width=470,status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,resizable=no")
}