// GLOBAL FUNCTION

//varibili per il rating
var timerID;
var myWidthOLD;
var myHeightOLD;

window.onload = function(){
	MM_preloadImages('/_images/fondo_vocemenu.jpg','/_images/logo_f2.png');
	caricaFlashAvvio();
	if(window.location.href.indexOf("armageddon")!=-1){
		var currentTime = new Date();
		//var currentTime = new Date(09,09,28);
		var day = currentTime.getDate();
		var current_day=0;
		if(day>=21 && day<=27 && currentTime.getMonth()==8 && currentTime.getYear()==9)
		current_day=day-20;
		slideMenu.build('sm',335,5,5,current_day);
		if(day<=21 || day>=27 || currentTime.getMonth()!=8){
			slideMenu.build('sm',335,5,5,1);
		}
	}
}
/* succede oggi */
var giorno;
var mesi;
var succedeRQ = false; // XMLHttpRequest Object

if (window.XMLHttpRequest) // try to create XMLHttpRequest
	succedeRQ = new XMLHttpRequest();

if (window.ActiveXObject)	// if ActiveXObject use the Microsoft.XMLHTTP
	succedeRQ = new ActiveXObject("Microsoft.XMLHTTP");

function apriSubMenu(trgt){
	var el=document.getElementById(trgt);
	if(el.style.display == 'none'){
		el.style.display = 'block';
	}else{
		el.style.display = 'none';
	}
}
function closeMsgPanel(){
	showFlash();
	document.getElementById('toppa').style.display="none";
	document.getElementById('divWildfirePost').innerHTML="...";
	document.getElementById('sendMsg').style.display="none";			
}

function openMsgPanel(){
	hideFlash();
	document.getElementById('toppa').style.display="block";	
	document.getElementById('toppa').style.height=document.body.clientHeight+"px";
	document.getElementById('sendMsg').style.display="block";
}

function seleziona(trgt,label,val){
	var el=document.getElementById(trgt).getElementsByTagName('li')[0].getElementsByTagName('span')[0].getElementsByTagName('a')[0];
	this[trgt] = val;
	el.innerHTML = label;
	document.getElementById(trgt+"SubMenu").style.display = 'none';
}

function cerca(trgt,val){
	if (giorno && mesi) {
		document.getElementById("succedeCnt").innerHTML="loading ..."+" /_php/inc/succedeoggi.php?d="+giorno+"&m="+mesi;
		succedeRQ.open("GET", "/_php/inc/succedeoggi.php?d="+giorno+"&m="+mesi, true);
		succedeRQ.onreadystatechange = fillSuccede;
		succedeRQ.send(null); 	
	} else {
		alert("Devi selezionare giorno e mese");
	}
}
function fillSuccede(){
	if (succedeRQ.readyState==4) {
		if (succedeRQ.responseText.indexOf('invalid') == -1) { 	
			document.getElementById("succedeCnt").innerHTML="loading complete.";
			document.getElementById("succedeCnt").innerHTML=succedeRQ.responseText;
		}
	}
}

/* fine succede oggi */

function setIframeSrc(src){
	myFrame=document.getElementById("flashback");
	if(myFrame){
		myFrame.src=src;
	}
}
function showExtra(id){
	for(var i=0;i<3;i++){
		if(document.getElementById("extra"+i)) {
			document.getElementById("extra"+i).style.display = "none";
		}
	}
	document.getElementById("extra"+id).style.display = "block";
}


function setGeo(cnt){
	if(document.getElementById("geo")) {
		document.getElementById("geo").value = cnt;
	}
}

function popupwindow(LarghezzaCont,AltezzaCont,Pagina,nome,scrol,stat) {
	var lsBrowser = navigator.appName;
	var navInfo = navigator.userAgent;
	if (scrol == "yes") {
		if (navInfo == "Mac" && lsBrowser.indexOf("Microsoft") >= 0) {
				aw = 0;
		} else {
		aw = 17;
		}		
	} else {
	aw = 0;
	}		
    var iMyWidth;
    var iMyHeight;
    var LarghezzaPagina;
    var AltezzaPagina;
    LarghezzaPagina = screen.availWidth;
    AltezzaPagina = screen.availHeight;
    LarghezzaCont=LarghezzaCont.toUpperCase()
    AltezzaCont=AltezzaCont.toUpperCase()
				
    if (LarghezzaCont == "FULL") {
            LarghezzaWindow = screen.availWidth;
        } else {
            LarghezzaWindow = parseInt(LarghezzaCont) + aw;
        }
    if (AltezzaCont == "FULL") {
            AltezzaWindow = screen.availHeight;
        } else {
            AltezzaWindow = AltezzaCont;
        }
    iMyWidth = (LarghezzaPagina/2) - (LarghezzaWindow/2);
    iMyHeight = (AltezzaPagina/2) - (AltezzaWindow/2);
    win = window.open(Pagina,nome,"height=" + AltezzaWindow + ",width="	+ LarghezzaWindow 
	+ ",menubar=0,resizable=yes,scrollbars=" + scrol + ",status=" + stat + ",titlebar=0,toolbar=0,left="
	+ iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
    win.focus();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&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<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImage2() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore2() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;width=100;
}


function openFileUpFormVideo(){
	for(var i=0;i<9;i++){
		document.getElementById("file"+i).value="";			
		if(i>0)
			chiudiDIV("file"+i+"cnt");		
	}
}

function openFileUpFormFoto(){
	for(var i=0;i<9;i++){
		document.getElementById("file"+i).value="";					
		if(i>0)
			apriDIV("file"+i+"cnt");		
	}
}

function hoverIMG(Vdiv,IMGsrc){
	document.getElementById(Vdiv).style.backgroundImage = "url("+IMGsrc+")";
}

/* ------------------------------------------------------------- 
 	hoverIMG_smart(name,nImg,hDiv,adr,type)
	name = assegnare un nome univoco come id delle immagini che si intendono sostituire seguito da "_" e numero progressivo
	nImg = il totale delle img a cui e\' assgnata la funzione
	hDiv = il numero progressivo dell'immagine a cui si vuolassegnare la function(N.B. non mettere lo zero davanti i numeri da 1 a 9)
	adr = path del file dell'immagine
	type = se lasciato vuoto prevede una sola immagine da sostituire, altrimenti se impostato a 'multiple' aggiunge il numero progressivo relativo all'immagine
------------------------------------------------------------- */

function hoverIMG_smart(name,nImg,hDiv,adr,type){
	
	if( hDiv < 10 ){hDiv = name +"0"+ hDiv}
	else{ hDiv = name +"0"+ hDiv}
	
	
	adrM = adr.substring(0,adr.lastIndexOf("_"));
	adrS = adr.substring(0,adr.lastIndexOf("."));
	
	//alert(adr);
	
	for(var i=1;i<nImg+1;i++){
	
	if(i<10){nohDiv = name+ "0" + i; n = "0" + i}
	else{nohDiv = name + i; n = i}
	
	if(type == 'multiple'){
		if(nohDiv == hDiv){
							document.getElementById(nohDiv).style.backgroundImage = "url("+adrM+"_"+ n +"_on.jpg)";
							}
		
		//alert(nohDiv);
		else{
			document.getElementById(nohDiv).style.backgroundImage = "url("+adrM+"_"+ n +".jpg)";
			}
		
		}
		
	else{
		if(nohDiv == hDiv){
							document.getElementById(nohDiv).style.backgroundImage = "url("+adrS+"_on.jpg)";
							}
		
		
		else{
			document.getElementById(nohDiv).style.backgroundImage = "url("+adrS+".jpg)";
			}
		
		}
	
	
	}//alert(nohDiv);
}
	
function rolloverIMG(tagIMG,path){
	
	document.getElementById(tagIMG).src = path;
	
	}

function aprichiudi(actdiv){
	if(document.getElementById(actdiv).style.display=="block"){
		document.getElementById(actdiv).style.display="none";		
	}else{
		document.getElementById(actdiv).style.display="block";
	}
}
function apriDIV(actdiv){
	document.getElementById(actdiv).style.display="block";
}

function chiudiDIV(actdiv){
		document.getElementById(actdiv).style.display="none";		
}

/* ------------------------------------------------------------- 
 	aprichiudiDiv(name,nDiv,oDiv)
	name = assegnare un nome univoco come id dei div che si intende aprire/chiudere seguito da "_" e numero progressivo
	nDiv = il totale dei div che si intende aprire/chiudere
	oDiv = il numero del div che si vuole aprire(N.B. non mettere lo zero davanti i numeri da 1 a 9)
	oc = se impostato a both, si può aprire e chiudere il div, cliccando sul link. Se non impostato invece si apre solamente 
------------------------------------------------------------- */

function aprichiudiDiv_smart(name,nDiv,oDiv,oc){
	
	/*var name = "date";
 	var nDiv = 6;*/

	if(oDiv<10){oDiv = name + "_0" + oDiv;}
	else{oDiv = name + "_" + oDiv;}
	
	//alert(oDiv);
	
	for(var i=1;i<nDiv+1;i++){
		
		if(i<10){var cDiv = name + "_0" + i;}
		else {var cDiv = name + "_" + i;}
				
		if(cDiv == oDiv){ 
							if(oc == "both"){
								if(document.getElementById(cDiv).style.display=="block"){
									document.getElementById(cDiv).style.display="none";
									}
									
								else{
									document.getElementById(cDiv).style.display="block";
									}
								}
							else{ document.getElementById(cDiv).style.display="block"; }
							
						}
		else{document.getElementById(cDiv).style.display="none";}
		
		/*alert(cDiv);*/}
	
}

function azionaMenuProgramma(actdiv,str){
	for(var i=0;i<4;i++){
		if(i==actdiv){
			document.getElementById("blocco_"+i).style.display="block";
			document.getElementById("menuA"+i).innerHTML="<span class=\"menuProgrammiSel\">"+str+"</span>";
		}else{
				var tmp = document.getElementById("menuA"+i).firstChild.innerHTML;
			document.getElementById("menuA"+i).innerHTML="<a href=\"#\" onclick=\"azionaMenuProgramma("+i+",'"+tmp+"');return false;\">"+tmp+"</a>";
			document.getElementById("blocco_"+i).style.display="none";	
		}
	}

}

function apriDIVMenu(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="block";
	document.getElementById("menuA"+actdiv).setAttribute("class", "menuProgrammiSel");
}

function chiudiDIVMenu(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="none";		 	
	document.getElementById("menuA"+actdiv).setAttribute("class", "");
}

function apriDIVMenuSearch(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="block";
	if(actdiv==0){
		document.getElementById("videoChannelMenuItem0").innerHTML="<span class=\"postMenuSel\">VIDEO</span>";
		document.getElementById("videoChannelMenuItem1").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('1');chiudiDIVMenuSearch('0'); return false;\" title=\"RICERCA AVANZATA: VIAGGIATORI\">VIAGGIATORI</a>";	
	}else{
		document.getElementById("videoChannelMenuItem0").innerHTML="<a href=\"#\" onclick=\"apriDIVMenuSearch('0');chiudiDIVMenuSearch('1'); return false;\" title=\"RICERCA AVANZATA: VIDEO\">VIDEO</a>";
		document.getElementById("videoChannelMenuItem1").innerHTML="<span class=\"postMenuSel\">VIAGGIATORI</span>";	
	}
}

function chiudiDIVMenuSearch(actdiv){
	document.getElementById("blocco_"+actdiv).style.display="none";		 		
}


function checkData(){
	mf=document.register;

	tmp = mf.nick.value;
	if(tmp.length < 1)
	{	alert("Inserisci il Nickname.");
		mf.nick.focus();
		return false;
	};

	if(tmp.length > 12 || tmp.length < 4 )
	{	alert("Inserisci un Nickname compreso tra i 4 e i 12 caratteri.");
		mf.nick.focus();
		return false;
	};

// email control
	if(window.RegExp)
	{
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)) 
		{
			alert("L\'e-mail deve avere questo formato: username@dominio.it \r\n\""+mf.email.value+"\" non e\' un indirizzo valido. Verificalo e prova di nuovo.");
			mf.email.focus();
			return false;
		};
	}else
	{
		if(!(mf.email.value.indexOf("@") > 0))
		{
			alert("L\'e-mail deve avere questo formato: username@dominio.it \r\n\""+mf.email.value+"\" non e\' un indirizzo valido. Verificalo e prova di nuovo.");
			mf.email.focus();
	      	return false;
		}
	}

	tmp = mf.nome.value;
	if(tmp.length < 1)
	{	alert("Inserisci il Nome");
		mf.nome.focus();
		return false;
	};


	tmp = mf.cognome.value;
	if(tmp.length < 1)
	{	alert("Inserisci il Cognome");
		mf.cognome.focus();
		return false;
	};
	

//  return true if the input date is valid, false otherwise
	day = mf.gg.value;
	month = mf.mm.value-1; //The month needs to be a 0 (zero) for Jan, up to 11 to Dec.
	year = mf.aaaa.value;

	dteDate=new Date(year,month,day);

	if (!((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear())))
	{
		alert("Inserisci una data valida.");
		mf.gg.focus();
		return false;

	};
	if(!mf.sesso[0].checked && !mf.sesso[1].checked){
		alert("Specifica il Sesso.");
		mf.sesso[0].focus();
		return false;
	};
	
	tmp = mf.citta.value;
	if(tmp.length < 1)
	{	alert("Inserisci la Città.");
		mf.citta.focus();
		return false;
	};	

	tmp = mf.prov;
	if(tmp.selectedIndex==0)
	{	alert("Seleziona la Provincia.");
		mf.prov.focus();
		return false;
	};	
	if(!mf.abbonato[0].checked && !mf.abbonato[1].checked){
		alert("Specifica se sei Abbonato.");
		mf.abbonato[0].focus();
		return false;
	};
	
	tmp = mf.telefono.value;
	if(tmp.length < 1)
	{	alert("Inserisci il telefono.");
		mf.telefono.focus();
		return false;
	};	
	
	
	

	if(!mf.consenso[0].checked){
		alert("Per registrarti devi aderire alle condizioni di trattamento dei dati personali.");
		mf.consenso[0].focus();
		return false;
	};
	return true;
}

function checkDataEdit(){

	mf=document.register;

	tmp = mf.passwd.value;
	tmp2 = mf.passwd2.value;
	if(tmp.length > 0){
		if(tmp.length > 12 || tmp.length < 4 ){
			alert("Inserisci una Password compresa tra i 4 e i 12 caratteri.");
			return false;
		}else{		
			if(tmp!=tmp2){
				alert("Verifica che la password fornita coincida con la password di conferma.");
				return false;
			}
		}
	}

// email control
	if(window.RegExp){
		var rexp=new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*(\\.([a-zA-Z]){2,4})$");
		if(!rexp.test(mf.email.value)){
			alert("L\'e-mail deve avere questo formato: username@dominio.it \r\n\""+mf.email.value+"\" non e\' un indirizzo valido. Verificalo e prova di nuovo.");
			mf.email.focus();
			return false;
		}
	}else{
		if(!(mf.email.value.indexOf("@") > 0)){
			alert("L\'e-mail deve avere questo formato: username@dominio.it \r\n\""+mf.email.value+"\" non e\' un indirizzo valido. Verificalo e prova di nuovo.");
			mf.email.focus();
	      		return false;
		}
	}

	tmp = mf.nome.value;
	if(tmp.length < 1){
		alert("Inserisci il Nome");
		mf.nome.focus();
		return false;
	}


	tmp = mf.cognome.value;
	if(tmp.length < 1){
		alert("Inserisci il Cognome");
		mf.cognome.focus();
		return false;
	}
	

//  return true if the input date is valid, false otherwise
	day = mf.gg.value;
	month = mf.mm.value-1; //The month needs to be a 0 (zero) for Jan, up to 11 to Dec.
	year = mf.aaaa.value;

	dteDate=new Date(year,month,day);

	if (!((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()))){
		alert("Inserisci una data valida.");
		mf.gg.focus();
		return false;
	}
	
	tmp = mf.citta.value;
	if(tmp.length < 1){
		alert("Inserisci la Città.");
		mf.citta.focus();
		return false;
	}	

	/*tmp = mf.prov;
	if(tmp.selectedIndex==0){
		alert("Seleziona la Provincia.");
		mf.prov.focus();
		return false;
	}*/	
	
	if(!mf.sesso[0].checked && !mf.sesso[1].checked){
		alert("Specifica il Sesso.");
		mf.sesso[0].focus();
		return false;
	}
	
	tmp = mf.telefono.value;
	if(tmp.length < 1){
		alert("Inserisci il telefono.");
		mf.telefono.focus();
		return false;
	}	
	
	if(!mf.abbonato[0].checked && !mf.abbonato[1].checked){
		alert("Specifica se sei Abbonato.");
		mf.abbonato[0].focus();
		return false;
	}
	return true;
}


function checkPostData(){
	mf=document.post;
	tmp = mf.titolo.value;
	if(tmp.length < 1){
		alert("Inserisci il Titolo.");
		mf.titolo.focus();
		return false;
	}
	tmp = mf.testo.value;
	if(tmp.length < 1){
		alert("Inserisci il Testo.");
		mf.testo.focus();
		return false;
	}	
	tmp = mf.valore.value;
	if(tmp.length < 1){
		alert("Inserisci il Valore dell'oggetto.");
		mf.valore.focus();
		return false;
	}	
	var estPhotoArray = new  Array("gif", "jpg", "png");		
	if(mf.file0.value.length>1){
		if(!validateFileName(mf.file0.value,estPhotoArray)){
			mf.file0.value="";				
			mf.file0.focus();
			return false;
		}
	}else{
		alert("Devi caricare una foto");
		mf.file0.focus();
		return false;		
	}
	if(!document.getElementById("consenso_2_SI").checked && !document.getElementById("consenso_2_NO").checked){
		alert("Scegli se partecipare al concorso(e\' obbligatorio rispondere SI o NO).");
		document.getElementById("consenso_2_SI").focus();
		return false;
	}
	if(!document.getElementById("consenso_1_SI").checked){
		alert("Accetta le condizioni legali.");
		document.getElementById("consenso_1_SI").focus();
		return false;
	}
	
	window.scroll(0,0);
	document.getElementById('toppa').style.display="block";	
	document.getElementById('toppa').style.height=document.body.clientHeight+"px";
	var resStr="<div id=\"boxError\">";
	resStr+="<div class=\"labelBig\">Caricamento in corso</div>";
	resStr+="<div>Attendere Prego</div>";
	resStr+="</div>";
	document.getElementById("sendMsg").innerHTML=resStr;
	document.getElementById("sendMsg").style.display="block";

	return true;
}

var STag= new Array();

function addStag(id,tname){
	if(STag.length==0){
		STag[0]=tname;
		document.getElementById(id).style.color="#EFC700";
	}else{
		allowAdd=true;
		remPos=0;
		STagStr="";
		for(i=0;i<(STag.length);i++){
			if(STag[i]==tname){
				allowAdd=false;
				remPos=i;
				break;
			}
		}
		if(allowAdd){
			STag[STag.length]=tname;
			document.getElementById(id).style.color="#EFC700";
		}else{
			STag.splice(remPos,1);
			document.getElementById(id).style.color="black";
		}
	}
}

function checkMsg(){
	if(document.posta.commento.value.length <= 1){
		alert("Inserisci il testo del commento.");
		return false;
	}else{
		return true;
	}
}

function checkOut(Obj){
	if(Obj.options[Obj.selectedIndex].value!="17"){
		document.getElementById("divtestata").style.display="none";
		document.getElementById("testata").value="";
	}else{
		document.getElementById("divtestata").style.display="block";		
	}
}

function moveTopScroll(){
	window.scrollTo(0,0);
}

var maxchar=7000
function checkLimit(obj){
	if(obj.value.length>maxchar){
		alert("Il testo non deve superare i 7.000 caratteri");
		obj.value=obj.value.substring(0,maxchar);
	}
}
function checkTextLimit(obj){
	if(obj.value.length>999){
		alert("Il testo non deve superare i 1000 caratteri");
		obj.value=obj.value.substring(0,999);
	}
}
function validateFileName(str,est) {
   var charValid = false;
   if(str.indexOf("/")!=-1 && (str.lastIndexOf("/")+1)<str.length ){
	   str=str.substr((str.lastIndexOf("/")+1));
   }
   if(str.indexOf("\\")!=-1 && (str.lastIndexOf("\\")+1)<str.length ){
	   str=str.substr((str.lastIndexOf("\\")+1));
   }
   msg_str_err="";
   if (str.length>0) {
       //valido i caratteri          
	   for (var i = 0; i<str.length; i++) {
           codice = str.charCodeAt(i);
           if (codice == 95 || codice == 45 || codice == 46 || (codice>=48 && codice<=57) || (codice>=65 && codice<=90) || (codice>=97 && codice<=122)) {
               charValid = true;
           } else {
               charValid = false;
               msg_str_err+=" - il carattere:" +str.charAt(i)+" non valido, e\' possibile usare solo caratteri alfanumerici ed i simboli '.' '-' '_'\n";
               break;
           }
       }
       //valido le estensioni
       var myest = str.substr((str.length-3));
       var estValid = false;
       for (var j = 0; j<est.length; j++) {
           if (est[j] == myest.toLowerCase()) {
               estValid = true;
               break;
           }
       }
       if (!estValid) {
           charValid = false;
           msg_str_err+=" - il formato "+myest+" non e' accettato.";
       }
	   if(!charValid){
		   alert("Impossibile caricare il file:"+str+".\n"+msg_str_err);
	   }
       return charValid;
   } else {
       return charValid;
   }
}


function askAndDeleteComment(id){
	if(window.confirm("Sei sicuro/a di voler cancellare questo commento?")){
		var loc=document.location.href;
		if(loc.indexOf("?")!=-1)
		document.location.href=loc.replace("#","")+"&deleteCommentId="+id;
		else
		document.location.href=loc.replace("#","")+"?deleteCommentId="+id;
	}	
}

function muovi(div,w){
	var pos_i=$('scrolled').style.left.replace("px", "");
	var pos_f=parseInt(pos_i)+w;
	var dw=parseInt($('scrolled').style.width.replace("px", ""));

	if(pos_f<=0 && (pos_f>(dw*-1)) ){
		$('scrolled').tween('left', pos_i,pos_f);
		if(pos_f==0){
			//alert("HIDE SX");			
			$('left_ctrl_scroll').fade('out');
		}else{
			//alert("SHOW SX");
			$('left_ctrl_scroll').fade('in');
		}
		if(pos_f<=((dw*-1)+200)){
			$('right_ctrl_scroll').fade('out');
		}else{
			$('right_ctrl_scroll').fade('in');			
		}
	}
}

