/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"

}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}



function setCities(chooser) {
	
	var par = new Object()
	par["1"] = [{value:"Assistente Sanitario", text:"Assistente Sanitario"},
	{value:"Biologo", text:"Biologo"},
	{value:"Chimico", text:"Chimico"},
	{value:"Dietista", text:"Dietista"},
	{value:"Educatore Professionale", text:"Educatore Professionale"},
	{value:"Farmacista", text:"Farmacista"},
	{value:"Fisico", text:"Fisico"},
	{value:"Fisioterapista", text:"Fisioterapista"},
	{value:"Igienista Dentale", text:"Igienista Dentale"},
	{value:"Infermiere", text:"Infermiere"},
	{value:"Infermiere Pediatrico", text:"Infermiere Pediatrico"},
	{value:"Logopedista", text:"Logopedista"},
	{value:"Medico Chirurgo", text:"Medico Chirurgo"},
	{value:"Odontoiatra", text:"Odontoiatra"},
	{value:"Odontotecnico", text:"Odontotecnico"},
	{value:"Ortottista/Assistente di Oftalmologia", text:"Ortottista/Assistente di Oftalmologia"},
	{value:"Ostetrico/a", text:"Ostetrico/a"},
	{value:"Ottico", text:"Ottico"},
	{value:"Podologo", text:"Podologo"},
	{value:"Psicologo", text:"Psicologo"},
	{value:"Tecnico Audiometrista", text:"Tecnico Audiometrista"},
	{value:"Tecnico Audioprotesista", text:"Tecnico Audioprotesista"},
	{value:"Tecnico della fisiopatologia cardiocircolatoria e perfusione cardiovascolare", text:"Tecnico della fisiopat. cardiocirc. ..."},
	{value:"Tecnico della Prevenzione nell’ambiente e nei luoghi di lavoro", text:"Tecnico della Prev. nell’ambiente ..."},
	{value:"Tecnico della Riabilitazione psichiatrica", text:"Tecnico della Riabilitazione psichiatrica"},
	{value:"Tecnico di Neurofisiopatologia", text:"Tecnico di Neurofisiopatologia"},
	{value:"Tecnico Ortopedico", text:"Tecnico Ortopedico"},
	{value:"Tecnico Sanitario di laboratorio biomedico", text:"Tecnico Sanitario di laboratorio biomedico"},
	{value:"Tecnico Sanitario di Radiologia medica", text:"Tecnico Sanitario di Radiologia medica"},
	{value:"Biologo", text:"Terapista della neuro e psicom. età evol."},
	{value:"Terapista occupazionale", text:"Terapista occupazionale"},
	{value:"Veterinario", text:"Veterinario"}];
	par["2"] = [{value:"Architetto", text:"Architetto (Dirigente)"},
	{value:"Avvocato", text:"Avvocato (Dirigente)"},
	{value:"Ingegnere", text:"Ingegnere (Dirigente)"}];
	par["3"] = [{value:"Architetto", text:"Architetto"},
	{value:"Assistente Sociale", text:"Assistente Sociale"},
	{value:"Assistente Tecnico CED", text:"Assistente Tecnico CED"},
	{value:"Ausiliario Specializzato", text:"Ausiliario Specializzato"},
	{value:"Autista", text:"Autista"},
	{value:"Autista Ambulanza", text:"Autista Ambulanza"},
	{value:"Barbiere", text:"Barbiere"},
	{value:"Camera Iperbarica", text:"Camera Iperbarica"},
	{value:"Centralinista", text:"Centralinista"},
	{value:"Conduttore Caldaie", text:"Conduttore Caldaie"},
	{value:"Cuciniere", text:"Cuciniere"},
	{value:"Cuoco", text:"Cuoco"},
	{value:"Cuoco abilitato", text:"Cuoco abilitato"},
	{value:"Dispensiere", text:"Dispensiere"},
	{value:"Elettricista", text:"Elettricista"},
	{value:"Elettromeccanico", text:"Elettromeccanico"},
	{value:"Falegname", text:"Falegname"},
	{value:"Geometra", text:"Geometra"},
	{value:"Guardaroba", text:"Guardaroba"},
	{value:"Idraulico", text:"Idraulico"},
	{value:"Informatico", text:"Informatico"},
	{value:"Ingegnere", text:"Ingegnere"},
	{value:"Macchine elettrocontabili", text:"Macchine elettrocontabili"},
	{value:"Magazziniere", text:"Magazziniere"},
	{value:"Massofisioterapista", text:"Massofisioterapista"},
	{value:"Muratore", text:"Muratore"},
	{value:"O.T.A.", text:"O.T.A."},
	{value:"Operatore CED", text:"Operatore CED"},
	{value:"Operatore Socio Sanitario", text:"Operatore Socio Sanitario"},
	{value:"Perito Elettronico", text:"Perito Elettronico"},
	{value:"Perito Industriale", text:"Perito Industriale"},
	{value:"Perito Informatico", text:"Perito Informatico"},
	{value:"Pittore", text:"Pittore"},
	{value:"Preparatore Farmacia", text:"Preparatore Farmacia"},
	{value:"Preparatore L.I.P.", text:"Preparatore L.I.P."},
	{value:"Programmatore", text:"Programmatore"},
	{value:"Responsabile macchine lavanderia", text:"Responsabile macchine lavanderia"},
	{value:"Sarto", text:"Sarto"},
	{value:"Statistico", text:"Statistico"},
	{value:"Termoidraulico", text:"Termoidraulico"}];
	par["4"] = [{value:"Assistente Amministrativo", text:"Assistente Amministrativo"},
	{value:"Coadiutore Amministrativo", text:"Coadiutore Amministrativo"},
	{value:"Collaboratore Amministrativo", text:"Collaboratore Amministrativo"},
	{value:"Commesso", text:"Commesso"},
	{value:"Dirigente Amministrativo", text:"Dirigente Amministrativo"}];

	







    var newElem;
    var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
    var cityChooser = chooser.form.elements["qualifica"];
    while (cityChooser.options.length) {
        								cityChooser.remove(0);
    }

    var choice = chooser.options[chooser.selectedIndex].value;
    var db = par[choice];
    newElem = document.createElement("option");newElem.text = "Qualifica";newElem.value = "";
    cityChooser.add(newElem, where);
    if (choice != "") {
						for (var i = 0; i < db.length; i++) {
																newElem = document.createElement("option");
																newElem.text = db[i].text;
																newElem.value = db[i].value;
																cityChooser.add(newElem, where);
				
						}
    }

}


