// MEMORIZZAZIONE DEI Cookies DELLE CARATTERISTICHE DEL Browser:
var BrowserVars = new Array() ;
	BrowserVars['appName'] 		= navigator.appName 	;
	BrowserVars['appVersion'] 	= navigator.appVersion 	;
	BrowserVars['ScreenWidth'] 	= screen.width 			;
	BrowserVars['ScreenHeight'] = screen.height 		;

for ( Browser_NameVar in BrowserVars )
	{
		Set_Cookie(  'BrowserVars['+Browser_NameVar+']', 
					 BrowserVars[Browser_NameVar], 
					 1000, 
					 '', 	// -> da settare con '/'; settare a '/directory' per limitare il Cookie ad una directory
					 // variabili opzionali
					 '', // -> da settare sul dominio principale in caso di sottodomini (se il cookie deve essere accessibile dal dominio oltre che dal sottodominio)
					 '' )	
		//ctrl
		//alert(Browser_NameVar)
	}


function RilevaXMLHttpRequest() 
{
	// informazioni sul nome del browser
	Browser = navigator.userAgent.toUpperCase();


	// browser standard con supporto nativo
	// non importa il tipo di browser
	if(typeof(XMLHttpRequest) === "function" || typeof(XMLHttpRequest) === "object")
		{ XHR = new XMLHttpRequest(); }

	// browser Internet Explorer
	// e necessario filtrare la versione 4
	else if (
				window.ActiveXObject &&
				Browser.indexOf("MSIE 4") == -1
			 ) 
		{
	 
		   // la versione 6 di IE ha un nome differente
		   // per il tipo di oggetto ActiveX
		   if( Browser.indexOf("MSIE 5") == -1 )
				{
					XHR = new ActiveXObject("Msxml2.XMLHTTP");
				}
	
		  // le versioni 5 e 5.5 invece sfruttano lo stesso nome
		   else
				{
					XHR = new ActiveXObject("Microsoft.XMLHTTP");
				}
		}	

	return XHR;
} 

function AjaxExchangeData(	 PageToConnect
							,Method // [get][post]
							,DataArray
							,FunctionsToExcute_Array // array{'ConnectionOk','ConnectionNotOk'} funzioni da eseguire rispettivamente quando si è risolta positivamente o negativamente la connessione Ajax
							)
{
	var BadConnectionAdvise = false ;
	
	var Ajax = RilevaXMLHttpRequest();	
	var ResponseText = '' ;
	
	if ( Ajax ){ 
		//alert("ok") ; 
		Ajax.open(Method, PageToConnect, true); //-> true INDICA LA RICHIESTA DI ASINCRONICITA' 
		// impostazione headera 
		Ajax.setRequestHeader("content-type", "application/x-www-form-urlencoded");
		// invio dei dati alla pagina: 
		var DataStrings = new Array() ;
		for (var Key in DataArray){
			DataStrings.push(Key+"="+encodeURIComponent(DataArray[Key]))  ;
		}
		var DataString = DataStrings.join("&") ;
		
		// CTRL
		// alert('notes: DataString:\n\n'+DataString) ;
		
		/*if ( DataString == '' ) {
			alert(
				'ATTENZIONE!\n\n'
				+'Nessun dato risulta impostato per Ajax\n'
				+'da inviare al file: '+PageToConnect
			) ;
		} else {*/
			
			Ajax.send(DataString); 
				
			var FunctionsToExcute = new Array() ;
			
			// FUNZIONI DA ESEGUIRE SE LA CONNESSIONE Ajax E' ANDATA A BUON FINE 
			FunctionsToExcute['ConnectionOk'] = function(){
				if (typeof(FunctionsToExcute_Array['ConnectionOk'])=='function'){
					FunctionsToExcute_Array['ConnectionOk']() ;
				} else {
					''  // funzione di default
				}
			};
			
			// FUNZIONI DA ESEGUIRE SE LA CONNESSIONE Ajax - NON E'ANDATA - A BUON FINE 
			FunctionsToExcute['ConnectionNotOk'] = function(){
				if (typeof(FunctionsToExcute_Array['ConnectionNotOk'])=='function'){
					FunctionsToExcute_Array['ConnectionNotOk']() ;
				} else {
					'' ;  // funzione di default
				}
			};
			
			Ajax.onreadystatechange = function() {
				
				if(Ajax.readyState === 4){ // -> 4 indica che i dati sono stati completamente scaricati dal Server 
					
					if(Ajax.status == 200){ // 200 e lo stato che indica che il codice di risposta e stato correttamente restituito dal Server 
							
						FunctionsToExcute['ConnectionOk']() ;
						
						var ResponseText = IfUndefinedDo(Trim(Ajax.responseText),'') ;
						if ( ResponseText != '' ){
							try {
								document.forms['FormProva'].elements['Textarea'].value = ResponseText ;
							} catch(e){}
							eval(ResponseText) ;
						}
					}  else {
						
						// CONNESSIONE Ajax NON AVVENUTA !
						switch(Ajax.status){
							case 404:
							alert("ATTENZIONE!\\n\nLa Pagina '"+PageToConnect+"'\n" 
								 +"indicata per la connessione AJAX non e\' stata trovata!")
							break ;
							
							case 403:
							alert("ATTENZIONE!\\n\nLa Pagina '"+PageToConnect+"'\n" 
								 +"indicata per la connessione AJAX non e\' accessibile"
								 +"pèr la mancanza dei permessi necessari!")
							break ;
						}
					
						FunctionsToExcute['ConnectionNotOk']() ;
					}
					
				} else {
					// IN QUESTA FASE Ajax STA' TENTANDO DI CONNETTERSI... (NON E' ANCORA ERRORE)
				}
			} 
		//}
	}
}


function Set_Cookie( NomeCookie, 
					 ValoreCookie, 
					 GiorniScadenzaCookie, 
					 PathCookie, 	// -> da settare con '/'; settare a '/directory' per limitare il Cookie ad una directory
					 // variabili opzionali
					 DominioCookie, // -> da settare sul dominio principale in caso di sottodomini (se il cookie deve essere accessibile dal dominio oltre che dal sottodominio)
					 SecureCookie ) 
{
	
	var Data = new Date();
		Data.setTime( Data.getTime() ); // imposto la data a quella corrente
	
	// TRASFORMO LA SCADENZA DA GIORNI A millisecondi
	if ( IfUndefinedDo(GiorniScadenzaCookie,"") !='' ) {
		GiorniScadenzaCookie = GiorniScadenzaCookie * 1000 * 60 * 60 * 24 ; // trasformo i giorni in millisecondi
	}
	
	var ScadenzaCookie = new Date( Data.getTime() + GiorniScadenzaCookie );
	
	document.cookie = NomeCookie + "=" +escape( ValoreCookie ) +
						( ( GiorniScadenzaCookie ) ? ";expires=" + ScadenzaCookie.toGMTString() : "" ) + 
						( ( PathCookie ) ? ";path=" + PathCookie : "" ) + 
						( ( DominioCookie ) ? ";domain=" + DominioCookie : "" ) +
						( ( SecureCookie ) ? ";secure" : "" );
}

function DeleteCookie( 	NomeCookie, 
					 	PathCookie,   // -> da settare con '/'; settare a '/directory' per limitare il Cookie ad una directory
					 	DominioCookie // -> da settare sul dominio principale in caso di sottodomini (se il cookie deve essere accessibile dal dominio oltre che dal sottodominio)
					 	)
{
	// setto la data all'inizio dell'era Unix per eliminare il Cookie
	var Data = new Date(0) ;
		/*
		Data.setDate(Data.getDate()) ;
		Data.setMonth(Data.getMonth()) ;
		Data.setFullYear(Data.getFullYear()) ;
		*/
	
	var StartDataUnix = Data.toGMTString() ;
	//ctrl
	//alert(StartDataUnix) ; 
	
	document.cookie = NomeCookie + "=" +
	( ( PathCookie ) ? ";path=" + PathCookie : "") +
	( ( DominioCookie ) ? ";domain=" + DominioCookie : "" ) +
	";expires="+StartDataUnix ;
		
}


// FUNZIONE DI SVUOTAMENTO COMPLETO DI UN ARRAY DI Cookies:
function DeleteCookieGroup(NomeCookie_fThis)
{
	//alert(NomeCookie_fThis) ;
	
	var CookiesString = document.cookie ;
	var Cookies = CookiesString.split(";") ;
	
	var PattCookie = new RegExp("^"+NomeCookie_fThis+"","i") ;
	for ( var i = 0 ; i < Cookies.length ; i++ )
		{
			Cookies[i] = Trim(Cookies[i]) ;
			// splitto by '=' per separare il Nome dal Valore
			var ArrayNomeValue = Cookies[i].split('=') ;
			
			var NomeCookie 	= Trim(ArrayNomeValue[0]) ;
			var ValueCookie = Trim(ArrayNomeValue[1]) ;
			
			if ( PattCookie.test(NomeCookie) )
				{
					DeleteCookie( 	NomeCookie,
									"/",   	// -> da settare con; settare a/director per limitare il Cookie ad una directory
									""		// -> da settare sul dominio principale in caso di sottodomini (se il cookie deve essere accessibile dal dominio oltre che dal sottodominio)
								) ;
				}
		}
			
}


function ResearchCookie(NomeCookie)
{
	//ctrl
	//alert(NomeCookie) ;
	
	var ValueCookie = '' ;
	
	// SPLITTO I coookies
	var Cookies = document.cookie.split( ';' );
	
	for ( var i = 0 ; i < Cookies.length ; i++ )
		{
			// dei cookie presenti considero quelli che hanno il Nome  ' NomeCookie '
			var Patt_Cookie = new RegExp("^"+NomeCookie+"","g") ;
			
			Cookies[i] = Trim(Cookies[i]) ; //att!-> e sempre necessario per sicurezza trimmare le stringhe/cookie, dato che potrebbero esservi degli spazi molesti
			
			// splitto il cookie by '=' per separare i nome del Cookie dal suo valore:
			var ElementiCookie = Cookies[i].split('=') ;
			// si controlla la corrispondenza col Cookie ricercato:
			if ( ElementiCookie[0] == NomeCookie )
				{
					ValueCookie = unescape(Trim(ElementiCookie[1])) ;
					//ctrl
					//alert(NomeCookie+': '+ValueCookie) ;
					
					break ;
				}
		}
	
	return ValueCookie ;

}



// funzione per la creazione di una tabella bordata:
function CreaTabellaBordata(WidthTab,HeightTab,AlignTab,CellpaddingTab,CellspacingTab,ClassTab,
							DirectoryImages,ArrayImmagini,Content,TipoRisultato)
{
	var TabellaBordata =  '<table border="0" width="'+WidthTab+'" height="'+HeightTab+'" cellpadding="'+CellpaddingTab+'" cellspacing="'+CellspacingTab+'" align="'+AlignTab+'" class="'+ClassTab+'">'
							+'<tr>'
								+'<td width="1" height="1" style="font-family:Verdana; font-size:1px"><img src="'+DirectoryImages+'/'+ArrayImmagini[0]+'" border="0" hspace="0" vspace="0"></td>'
								+'<td width="100%" style="font-family:Verdana; font-size:1px; background-image:url('+DirectoryImages+'/'+ArrayImmagini[1]+'); background-repeat:repeat-x">&nbsp;</td>'
								+'<td width="1" style="font-family:Verdana; font-size:1px"><img src="'+DirectoryImages+'/'+ArrayImmagini[2]+'" border="0" hspace="0" vspace="0"></td>'
							+'</tr>'
							+'<tr>'
								+'<td style="font-family:Verdana; font-size:1px; background-image:url('+DirectoryImages+'/'+ArrayImmagini[3]+'); background-repeat:repeat-y">&nbsp;</td>'
								+'<td height="100%" align="center"  style="background-image:url('+DirectoryImages+'/'+ArrayImmagini[4]+'); background-repeat:repeat">'
									+Content
								+'</td>'
								+'<td  style="font-family:Verdana; font-size:1px; background-image:url('+DirectoryImages+'/'+ArrayImmagini[5]+'); background-repeat:repeat-y">&nbsp;</td>'
							+'</tr>'
							+'<tr>'
								+'<td height="1" style="font-family:Verdana; font-size:1px"><img src="'+DirectoryImages+'/'+ArrayImmagini[6]+'" border="0" hspace="0" vspace="0"></td>'
								+'<td  style="font-family:Verdana; font-size:1px; background-image:url('+DirectoryImages+'/'+ArrayImmagini[7]+'); background-repeat:repeat-x">&nbsp;</td>'
								+'<td  style="font-family:Verdana; font-size:1px"><img src="'+DirectoryImages+'/'+ArrayImmagini[8]+'" border="0" hspace="0" vspace="0"></td>'
							+'</tr>'
						 +'</table>'
						 
	if ( TipoRisultato == 'Return' )
		{ return TabellaBordata ; }
	else
		{ document.write(TabellaBordata) ; }
} 




// FUNZIONE CHE EFFETTUA IL resize DELLA POP-UP DALL'INTERNO DELLA POP-UP STESSA (RACCOMANDABILE UTILIZZARLA SULL'onLoad)
// PER BYPASSARE IL PROBLEMA DELLE pop up CHE SE RICHIAMATE QUANDO SONO GIA' APERTE FATICANO A RIDIMENSIONARSI :
function ResizePopUp_ByPopUp(PopUp,PopUpWidth,PopUpHeight,ConnessioneLocale)
{
	if ( window.opener )
		{
			
			var Message_fResizePopUp_OK = ResearchCookie('Message_fResizePopUp_OK') ;
			
			if ( Message_fResizePopUp_OK != 'ok' && ConnessioneLocale == 'yes' )	
				{
					ScriviAlert("ATTENZIONE!\nQuesta pagina richiama la funzione ' ResizePopUp_ByPopUp ' che ridimensiona la pop-up dall'interno!\n(MESSAGGIO SOLO LOCALE)") ;
					// SETTO IL Cookie per estinguere la comparsa del messaggio
					Set_Cookie(  'Message_fResizePopUp_OK', 
								 'ok', 
								 1, 
								 '/', 	// -> da settare con '/'; settare a '/directory' per limitare il Cookie ad una directory
								 // variabili opzionali
								 '', // -> da settare sul dominio principale in caso di sottodomini (se il cookie deve essere accessibile dal dominio oltre che dal sottodominio)
								 '') 
				}
				
				
			// SE CI SI TROVA IN ALCUNI Browser E' NECESSARIO AGGIUNGERE ALLA height IMPOSTATA UN CERTO TOT IN PIU'
			// DATO DALLO SPAZIO OCCUPATO DALLA barra di stato:
					
					var TipoBrowser = navigator.appName ;
					var PattIe 		=  / IE |Microsoft|Explorer/ ;
			if ( PattIe.test(TipoBrowser) )
				{ 
					PopUpHeight += 18 ; 
				} // UMENTO L'ALTEZZA DELLA PopUp
			
			PopUp.resizeTo(PopUpWidth,PopUpHeight) ;	
			
			var PosX = (screen.width - PopUpWidth)/2 ;
			var PosY = (screen.height - PopUpHeight)/2 ;
		
			PopUp.moveTo(PosX,PosY) ;	
			
			try
			{ PopUp.focus() ; } catch(e){}
			
		}
		
}


// FUNZIONE PER IL RILEVAMENTO DEGLI ELEMENTI DELL'ALBERO GENEALOGICO Dom:
function HasDomChild(DomObject,DomObject_Key)
{
	var DomObjectsArray_fThis = new Array()  ;
	var Childs = DomObject.childNodes  ;
	
	
	if ( Childs.length > 0 )
		{
			for ( var i = 0 ; i < Childs.length ; i++ )	
				{
					if ( DomObject_Key != '' )
						{ var KeyGerarchy = DomObject_Key+'_'+i ; }
					else
						{ var KeyGerarchy = i ; }
						
					DomObjectsArray_fThis[KeyGerarchy] = Childs[i] ;
					
					if ( Childs[i].childNodes.length > 0 )
						{
							var DomObjectsArray_fChilds = HasDomChild(Childs[i],KeyGerarchy) ;	
							
							// fondo l'array " DomObjectsArray_fChilds " con " DomObjectsArray ":
							for ( var Key_fThis in DomObjectsArray_fChilds )
								{
									DomObjectsArray_fThis[Key_fThis] = DomObjectsArray_fChilds[Key_fThis] ;
								}
							
						}
				}
		}
	
	// riordinamento dell'Array di appoggio e ri-assegnazione all'array
	// originario dei nuovi elementi
	DomObjectsArray_fThis.sort() ;	
	
	return DomObjectsArray_fThis ;
}



// FUNZIONE PER LA RICERCA DI UN Oggetto Dom DATO L'Id
// (RISPETTO ALLA FUNZIONE SOTTOSTANTE RILEVA SOLO L'Oggetto Dom
// IN SE', SENZA ACCORPARE I GLI Oggetti Figli)
function SearchDomObject_byId(Id,DomObjectsArray) // !! RESTITUISCE UN SOLO OGGETTO !
{
	for ( var KeyGerarchy in DomObjectsArray )	
		{
			var IdObject = '' ;
			try
				{
					IdObject = DomObjectsArray[KeyGerarchy].getAttribute('ID') ; 
				} catch(e) {}
			
			if ( IfUndefinedDo(IdObject,'') != '' )
				{
					if ( IdObject == Id )
						{
							//ctrl
							//alert(IdObject)
							return 	DomObjectsArray[KeyGerarchy] ; 
						}
				}
		}
}


// FUNZIONE CHE RILEVA UN Gruppo Genealogico Dom
// FIGLIO DI UN OGGETTO Dom PADRE PER INDIVIDUARE IL QUALE VIENE
// PASSATO UN Patt:
function Search_Group_DomObject_byId(PattId,DomObjectsArray)// !! RESTITUISCE UN ARRAY DI OGGETTI !
{
	var ChildsArray  = new Array() ;
	var PattGerarchy = '' ;
	var CounterChilds = -1 ;
	
	for ( var KeyGerarchy in DomObjectsArray )
		{
			var IdObject = '' ;
			try
				{
					IdObject = DomObjectsArray[KeyGerarchy].getAttribute('id') ; 
				} catch(e) {}
			
			if ( IfUndefinedDo(IdObject,'') != '' )
				{
					if ( PattId.test(IdObject) )
						{
							CounterChilds++ ;
							//ctrl
							//alert('IdObject: '+IdObject)
							
							ChildsArray[KeyGerarchy] = DomObjectsArray[KeyGerarchy] ;
							
							/* BYPASS ====> INTERCETTEREI ANCHE I Figli DEGLI OGGETTI CERCATI....
							ChildsArray_fThis = HasDomChild(DomObjectsArray[KeyGerarchy],KeyGerarchy) ;
							
							// FONDO L'ARRAY ESTRATTO " ChildsArray_fThis " IN QUELLO FINALE " ChildsArray "
							for ( var Key_fThis in ChildsArray_fThis )
								{
									ChildsArray[Key_fThis]	= ChildsArray_fThis[Key_fThis] ;
								}
							*/
							
						}
				}
		}
	
	ChildsArray.sort() ;	
	return ChildsArray ;
}


// FUNZIONE PER LA RIMOZIONE DI ELEMENTI DALL'ALBERO GENEALOGICO Dom
function RimuoviElementoDom(KeyGerarchyElemento,DomObjectsArray)
{
	// si ricava la chiave gerarchica dell'oggeetto padre:
	var KeyGerarchy_ObjectPadre = KeyGerarchyElemento.replace(new RegExp('(_[0-9]+)$'),'') ;
	// rimozione
	DomObjectsArray[KeyGerarchy_ObjectPadre].removeChild(DomObjectsArray[KeyGerarchyElemento]) ;
}

// FUNZIONE PER IL REVERSE DI UN ARRAY/OGGETTO CON Keys >>NON NUMERICHE<<
// DATO CHE IN TAL CASO IL " .reverse() "  SEMBRA NON AVERE EFFETTO:
function ObjectsArray_Reverse(ObjectsArray)
{
	var NewArray_Keys 	= new Array() ;
	var NewArray_Values = new Array() ;
	
	for ( var Key_fThis in ObjectsArray )	
		{
			NewArray_Keys[NewArray_Keys.length] 	= Key_fThis ;
			NewArray_Values[NewArray_Keys.length] 	= ObjectsArray[Key_fThis] ;
		}
	
	ObjectsArray = new Array() ;
	
	// REVERTING:...
	for ( var i = (NewArray_Keys.length-1) ; i >= 0 ; i-- )
		{
			ObjectsArray[NewArray_Keys[i]] = NewArray_Values[i] ;
		}
	
	return ObjectsArray ;
}

// Counting Elementi Oggetto
function ObjectsArray_Counting(ObjectsArray)
{
	var Counter_fThis = 0 ;
	for ( var Key_fThis in ObjectsArray )
		{ Counter_fThis++ ; }
	return Counter_fThis ;
}

// per l'aggiunta ai Preferiti
function AddToFavourites(Title,Url){
	
	// alert("Aggiunta ai favoriti !") ;
	
	if ( Title == '' ){ 
		Title = document.title ; 
	} 
	
	if ( Url == '' ){ 
		Url = document.location.href ; 
	}
	
	if (window.sidebar) {
		window.sidebar.addPanel(Title, Url, "");
	}else if (window.external) {
		window.external.AddFavorite(Url, Title);
	}else if ( window.opera && window.print){
		var elem = document.createElement('a');
		elem.setAttribute('href', Url);
		elem.setAttribute('title', Title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	}
} 

function CtrlEmail(Email)
{
	var PattEmail 		= new RegExp("^[\\.\\-_0-9a-z]+@[\\.\\-_0-9a-z]+\.[\\.\\-_0-9a-z]+$","i") ;
	
	if ( PattEmail.test(Email) ) {
		
		// ulteriori verifiche sulle e-mail:
		
		// deve essere presente una soia "@":
		var Splitted_byChiocciola = Email.split('@') ;
		if ( Splitted_byChiocciola.length > 2 ) {
			return false ;	
		}
		
		// raccolda di Patts per individuare costrutti invalidi
		var PattInvalidConstructions = new Array(
			 new RegExp("^\\.","i")
			,new RegExp("\\.$","i")
			,new RegExp("@\\.","gi")
			,new RegExp("\\.@","gi")
			,new RegExp("\\.@\\.","gi")
			,new RegExp("\\.{2,}","gi")
		) ;
		
		var InvalidEmail = false ;
		for ( var i = 0 ; i < PattInvalidConstructions.length ; i++ ) {
			
			if ( PattInvalidConstructions[i].test(Email) ){
				InvalidEmail = true ;
				break ;
			}
			
		}
		
		if ( InvalidEmail ) {
			return false ;
		} else {
			return true ;
		}
		
	} else { // e-mail non valida in quanto a Patt
		return false ;
	}
}

// ############### funzione per il caricamento delle Virtual Girls
function LoadVirtualGirls()
{
	// CTRL
	if (RemoteAddr == "... IP DA SETTARE ...") {
		alert("Caricamento virtual girls...") ;
	}
	
	CreateSwfDinamically(
		 "http://ap.bannerporno.org/Bp/VirtualGirls/data/vghd"
		,"VirtualGirls"
		,400,300
		,"yes" //[yes][no]
		   // 48645 => Id affiliazione
		,"sub=48645&firstdelay=1000&hideexitbutton=0&id=21&xmlfile=http://ap.bannerporno.org/Bp/VirtualGirls/data/vghd.xml"
		,0,0,"center"
		,{ 'ObjectFeaturesToAdd' : {}, 'ParamFeaturesToAdd' : '' } // { 'ObjectFeaturesToAdd' : {}, 'ParamFeaturesToAdd' : '' }  => aggiunge parametri al tag Object e/o Param
		,eval(RilevaLivello('','DskVg'))
	) ;
}

// funzione che realizza lo slideshow di immagini quando col mouse
// si passa su una delle thumbs della sezione video dedicata a Redtube
var RedTube_Thumbs_Slideshow_StartStopFlags = new Array() ;
var RedTubeThumbPatt = /^(.+_)([0-9]{3})([a-z]\.)(jpeg|jpg|gif|png)$/i ;
function Init_RedTubeSlideshow(ThumbId) 
{
	if ( ThumbId!='' && document.getElementById(ThumbId) ){
		
		var Thumb = document.getElementById(ThumbId) ;	
		var FirstThumbPath = Thumb.src ;
		
		if ( RedTubeThumbPatt.test(FirstThumbPath) ) {
			
			var RedTubeThumbElements = GetRedTubeThumbElements(FirstThumbPath) ;
			var FirstThumbNum = RedTubeThumbElements['ThumbNum'] ;
			
			// Caricamento in slideshow di tutte le thumbs rilevabili
			RedTube_Thumbs_Slideshow_StartStopFlags[ThumbId] = true ;
			var NumThumbToCall = 1 ;
			// Se la thumb caricata di default corrisponde alla numero - uno - carichiamo la successiva
			if ( FirstThumbNum == NumThumbToCall ) {
				NumThumbToCall++ ;	
			}
			
			Start_RedTubeSlideshow(ThumbId,FirstThumbNum,NumThumbToCall,RedTubeThumbElements,true) ;
		}
	}
}

function Start_RedTubeSlideshow(ThumbId,FirstThumbNum,NumThumbToCall,RedTubeThumbElements,InitTrueFalse) // InitTrueFalse => flag che indica la prima chiamata della funzione
{
	if ( RedTube_Thumbs_Slideshow_StartStopFlags[ThumbId] ) { // se  RedTube_Thumbs_Slideshow_StartStopFlags[ThumbId] == true lo Slideshow deve continuare
		
		var NumThumbToCall_fPath = String(NumThumbToCall) ;
		// il numero all'interno del path dell'immagine deve essere del tipo: 003, 004, ... 012  ecc. ecc.
		while (NumThumbToCall_fPath.length < 3){
			NumThumbToCall_fPath = '0'+NumThumbToCall_fPath ;
		}
		
		var ImageToLoadPath = RedTubeThumbElements['ThumbStart']+NumThumbToCall_fPath+RedTubeThumbElements['ThumbEnd'] ;
		var ImageToLoad = new Image() ;
			ImageToLoad.src = ImageToLoadPath ;
		
		setTimeout(
			
			function(){
			
				if (ImageToLoad.complete) {
					
					document.getElementById(ThumbId).src = ImageToLoadPath ;
					NumThumbToCall = Number(NumThumbToCall) ;
					NumThumbToCall++ ;
					
					Start_RedTubeSlideshow(ThumbId,FirstThumbNum,NumThumbToCall,RedTubeThumbElements,false) ;
				} else {
					
					// dato che la Thumb non è stata intercettata si ricomincia lo Slide dalla prima immagine
					Start_RedTubeSlideshow(ThumbId,FirstThumbNum,1,RedTubeThumbElements,false) ;
				}
			}
			,InitTrueFalse? 150 : 500 // InitTrueFalse? 250 : 500 ====> alla prima chiamata accelleriamo il caricamento per dare da subito " l'effetto Slideshow "
		) ;
		
	} else {
		
		// caricamento della Thumb iniziale allo stop dello Slideshow
		var FirstThumbNum_fPath = String(FirstThumbNum) ;
		
		// il numero all'interno del path dell'immagine deve essere del tipo: 003, 004, ... 012  ecc. ecc.
		while (FirstThumbNum_fPath.length < 3){
			FirstThumbNum_fPath = '0'+FirstThumbNum_fPath ;
		}
		
		document.getElementById(ThumbId).src = RedTubeThumbElements['ThumbStart']+FirstThumbNum_fPath+RedTubeThumbElements['ThumbEnd'] ;
	}
}

function GetRedTubeThumbElements(ThumbPath)
{
	var RedTubeThumbElements = {
		 'ThumbNum':''
		,'ThumbStart':''
		,'ThumbEnd':''
	} ;
	
	if ( RedTubeThumbPatt.test(ThumbPath) ) {
		
		// estrazione del numero dell'immagine corrente (che si presenta sotto forma tipo: 003 )
		RedTubeThumbElements['ThumbNum'] = ThumbPath.replace(RedTubeThumbPatt,'$2').replace(/^0+/,'') ;
		
		// estrazione della parte costante ed iniziale del path delle thumbs
		RedTubeThumbElements['ThumbStart'] = ThumbPath.replace(RedTubeThumbPatt,'$1') ;
		
		// estrazione della parte costante e finale del path delle thumbs
		RedTubeThumbElements['ThumbEnd'] = ThumbPath.replace(RedTubeThumbPatt,'$3$4') ;
	}
	
	return RedTubeThumbElements ;
}

function Stop_RedTubeSlideshow(ThumbId)
{
	RedTube_Thumbs_Slideshow_StartStopFlags[ThumbId] = false ;
}


















