/* mostravideo*/
function mostravideo(nomefile)
{
	
		window.open(nomefile,'videokerlite','width=400,height=300 ,toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no');	
	

	
}

function dettaglioRef(tipo,idref)
{





		var myurl = "dettaglioRefAjax.aspx?tipo="+tipo+"&idref="+idref;
		
		var req = new Request.HTML({url:myurl, 
			onSuccess: function(html) {
				//Clear the text currently inside the results div.
				$('refDetAjax').set('text', '');
				//Inject the new DOM elements into the results div.
				$('refDetAjax').adopt(html);
				
				if(tipo=="desc")
				{
					new ScrollControl($('refDetContent'), {'createControls': true});
				}
				else
				{
					new ScrollControl($('refDetCar'), {'createControls': true});
				}
				
			},
			//Our request will most likely succeed, but just in case, we'll add an
			//onFailure method which will let the user know what happened.
			onFailure: function() {
				$('refDetAjax').set('text', 'Richiesta fallita');
			}
		});
			
		req.send();
		
}



window.addEvent('domready', function(){	



// disattivazione contatti e download
		/*
		var my_mmenu = $$('#mainMenuBox a');
		my_mmenu.each(function(element){
			
			if(element.href == "http://www.kerlite.it/nstech/nsHome.aspx"){
				element.destroy();
			}
			
			if(element.href == "http://www.kerlite.it/download.aspx"){
				element.href="#";
				element.addEvent('click',function(){		
					alert("PAGE DISABLED FOR DATABASE UPDATE");
				});
			}
					
		});
		
		var my_mmenucont = $$('.linkContatti');
		my_mmenucont.each(function(element){
			
			element.href="#";
			element.addEvent('click',function(){		
				alert("PAGE DISABLED FOR DATABASE UPDATE");
			});
						
		});
		*/



	/*
	// se in dettaglio news controllo l'attributo rel
	var intNews = $$('.intDettNews');
	if(intNews!=null){
		var myImgs = $$('#immaginiAllegate a');
		myImgs.each(function(element){
			//alert(element.rel);
			if(element.rel=="lightbox[News]"){
				element.rel="milkbox[News]"
			}
		});
	}

*/

	
	/*
	// se in intro aggiungo il logo original
	var inintro = $('bodyintro');
	if(inintro!=null){
	
		var myDiv = new Element('div', {
			'id': 'logo_original',
			'styles': {
				'display': 'block',
				'background':'url(images/logo_original.jpg) no-repeat top left',
				'width':'129px',
				'height':'146px',
				'position':'absolute',
				'top':'0',
				'right':'0'
				
				
			}
		});
	myDiv.inject($('introContenitore'));
	}
	*/
	
	
	
	// creo il link al sito Cotto d'Este se non sono nell'intro
	/*
	var inintro = $('bodyintro');
	if(inintro==null){
	
	var myAnchor = new Element('a', {
	    'href': 'http://www.cottodeste.it',
		'target': '_blank',
	    'class': 'linkacotto',
	    'html': 'www.cottodeste.it',
	    'styles': {
	        'display': 'block',
	        'float':'right',
			'margin-right':'15px'
	    }
	});

	myAnchor.inject($('introDefaultLinks'));
	
	}
	*/
	
	/*
	// elimino gli alt dall'elenco delle serie collegate
	var serieColl = $$('.serieCollegata');
	if(serieColl!=null){
		
		serieColl.each(function(element){

			element.getElement("img").removeProperty('alt');

		});

	}
	*/
	
	
	// chiudo il div del portoghese
	var portolink = $('chiudiPorto');
	if(portolink!=null){
	
		portolink.addEvent('click',function(){
		
			$('popUpPorto').setStyle('display','none');	
			
		});
	
	}
	
	
	//funzione per la visualizzazione in roll over dell'anteprima referenza	
	var divRef = $('refAnteprima');
	if(divRef!=null){
	
		var listaLinkRef = $$('.refLink');
		listaLinkRef.each(function(element){
		
			var numRef = element.id.split('_')[1];
			var relImage = $('ref' + numRef);			
			
			element.addEvent('mouseover',function(){
				relImage.setStyle('display','block');			
			});
			
			element.addEvent('mouseout',function(){
				relImage.setStyle('display','none');			
			});
			
		});
	
	}
	
	
	
	// controllo la descrizione della serie
	var mioDescrDiv = $('descrizioneSerie');
	if(mioDescrDiv!=null){
		var mioshowlink = $('showDescrSerie');
		var miohidelink = $('hideDescrSerie');
		//var mioDescrDiv = $('descrizioneSerie');
		
		mioshowlink.addEvent('click', function(e){
			mioDescrDiv.setStyle('visibility','visible');
		});
		miohidelink.addEvent('click', function(e){
			mioDescrDiv.setStyle('visibility','hidden');
		});
	}		
	
/*	
	// modifico via js lo sfondo della intro
	var myintro = $('bodyintro');
	if(myintro!=null){
		
		var numero = Math.round(10*Math.random());
			
		if(numero<3){
			//alert("caso 1");
			$('introPrincipale').addClass('kover');
		}	
		else if(3<= numero <=7){
			//alert("caso 2");
			$('introPrincipale').addClass('ragazza');
		}	
		else if(7< numero <=10){
			//alert("caso 3");
			$('introPrincipale').addClass('monolito');
		}
		else{
			//alert("caso 4");
			$('introPrincipale').addClass('monolito');
		}
	}
*/	
	//
	

	// ISTANZIO IL TOOLTIP DEI MINIMALI
	

	    $$('a.minColore').each(function(element,index) {  
			var content = element.get('title').split('::');  
			element.store('tip:title', content[0]);  
			element.store('tip:text', content[1]);  
	    });  
		
		
		var tipz = new Tips('.minColore',{  
			className: 'tip',  
	        fixed: false,  
			hideDelay: 50,  
			showDelay: 50  
	     });  

	



});	