var partOnSide=true
function loadSponsor() {
	callAction(["P",loadSponsorDone,"/support_/getSponsor.php","","T"])	
}
function loadSponsorDone(m,x) {
	if(m) {
		var r=x.parseJSON()
		if (r) {
			var v=[]
			if (r.p.length!=0) {
				if (partOnSide) {
					var o=$o("sidesponsor")
					if (o) {
						v.push('<h1>Aziende Partners</h1>')
						for(var i=0;i<r.p.length;i++) {
							if (r.p[i].l=="") {
								v.push('<img src="/img/sponsor/med/'+r.p[i].id+'.jpg"/>')	
							} else {
								v.push('<a href="'+r.p[i].l+'">')
								v.push('<img src="/img/sponsor/med/'+r.p[i].id+'.jpg"/>')	
								v.push('</a>')
							}
						}
						o.innerHTML=v.join("")
					}
				} else {
					var o=$o("bottomsponsor1")
					if (o) {
						v.push('<h1>Aziende Partners</h1><div class="outmove">')
						v.push('<div id="movesponsor1" style="top:0px">')
						for(var i=0;i<r.p.length;i++) {
							if (r.p[i].l=="") {
								v.push('<img src="/img/sponsor/med/'+r.p[i].id+'.jpg"/>')	
							} else {
								v.push('<a href="'+r.p[i].l+'">')
								v.push('<img src="/img/sponsor/med/'+r.p[i].id+'.jpg"/>')	
								v.push('</a>')
							}
						}
						v.push('</div></div>')
						o.innerHTML=v.join("")
						oObjMng.push(new cls_runsponsor(oObjMng.length,"1"))
					}
				}
			}
		
			if (r.s.length!=0) {
				var o=$o("bottomsponsor")
				if (o) {
					v=[]
					v.push('<h1>Aziende Supporters</h1><div class="outmove">')
					v.push('<div id="movesponsor" style="top:0px">')
					for(var i=0;i<r.s.length;i++) {
						if (r.s[i].l=="") {
							v.push('<img src="/img/sponsor/med/'+r.s[i].id+'.jpg"/>')	
						} else {
							v.push('<a href="'+r.s[i].l+'">')
							v.push('<img src="/img/sponsor/med/'+r.s[i].id+'.jpg"/>')	
							v.push('</a>')
						}
					}
					v.push('</div></div>')
					o.innerHTML=v.join("")
					oObjMng.push(new cls_runsponsor(oObjMng.length,""))
				}	
			}
		}
	}
}
function cls_runsponsor(id,indice) {
	this.obIndex=id
	this.clock=0
	this.cy=0
	this.h=$o("bottomsponsor"+indice).offsetHeight
	this.o=$o("movesponsor"+indice)
	this.hh=this.o.offsetHeight
	this.h=this.o.parentNode.offsetHeight
	this.stopTime=10000
	if (Math.floor(this.hh/this.h)>1) {
		var ii=this.obIndex
		this.clock=setTimeout(function(){oObjMng[ii].moveRun()},this.stopTime)
	}
	
	this.moveRun=function() {
		this.cy-=this.h
		if (this.cy<=-this.hh) {this.cy=0}
		this.o.style.top=this.cy+"px"
		var ii=this.obIndex
		this.clock=setTimeout(function(){oObjMng[ii].moveRun()},this.stopTime)
	}
	this.unload=function unload() {
		clearTimeout(this.clock)
		this.o=null
	}
}
