xGap=(navigator.appName == "Netscape")?11:9;
yGap=(navigator.appName == "Netscape")?31:29;

function footer(quale)
{
            var xCrd=(screen.availWidth-500-xGap)/2;
            var yCrd=(screen.availHeight-500-yGap)/2;
            windowFeatures = 'width=500,height=500,status=no,top='+yCrd+',left='+xCrd
            newWindow=window.open("http://static.timcafe.it/inc/lphp/"+quale+".html", "popFooter", windowFeatures);
}

// FIX ROLLOVER INPUT BUTTON EXPLORER
function buttonStyle(){
	var bottoni = document.getElementsByTagName("input");
	for (i = 0; i != bottoni.length; i++) {
		if(bottoni[i].className == 'bottoneblu'){
			bottoni[i].onmouseover = function(){
				this.className = 'bottonebluUnderline';
			}
			bottoni[i].onmouseout = function(){
				this.className = 'bottoneblu';
			}
		}
		if(bottoni[i].className == 'bottonerosso'){
			bottoni[i].onmouseover = function(){
				this.className = 'bottonerossoUnderline';
			}
			bottoni[i].onmouseout = function(){
				this.className = 'bottonerosso';
			}
		}
	}
}
window.onload = function(){
	buttonStyle();
}


function mostraRicercaTipo(tipo){
	if (tipo == "1"){
		//alert('people');
		document.getElementById('ricercaTipoPeople').className = "on";
		document.getElementById('ricercaTipoFotoVideo').className = "off";
		document.getElementById('ricercaTipoBlog').className = "off";
		document.getElementById("ricercaCosa").selectedIndex = 0;
	}
	if (tipo == "2"){
		//alert('fotovideo');
		document.getElementById('ricercaTipoPeople').className = "off";
		document.getElementById('ricercaTipoFotoVideo').className = "on";
		document.getElementById('ricercaTipoBlog').className = "off";
		document.getElementById("ricercaCosa").selectedIndex = 1;
		
	}
	if (tipo == "3"){
		//alert('blog');
		document.getElementById('ricercaTipoPeople').className = "off";
		document.getElementById('ricercaTipoFotoVideo').className = "off";
		document.getElementById('ricercaTipoBlog').className = "on";
		document.getElementById("ricercaCosa").selectedIndex = 2;
	}
}

function ricercaTipo(){
	tipo = document.boxRicercaVerticale.ricercaCosa.value;
	if (tipo == "1"){
		//alert('people');
		document.getElementById('ricercaTipoPeople').className = "on";
		document.getElementById('ricercaTipoFotoVideo').className = "off";
		document.getElementById('ricercaTipoBlog').className = "off";
	}
	if (tipo == "2"){
		//alert('fotovideo');
		document.getElementById('ricercaTipoPeople').className = "off";
		document.getElementById('ricercaTipoFotoVideo').className = "on";
		document.getElementById('ricercaTipoBlog').className = "off";
	}
	if (tipo == "3"){
		//alert('blog');
		document.getElementById('ricercaTipoPeople').className = "off";
		document.getElementById('ricercaTipoFotoVideo').className = "off";
		document.getElementById('ricercaTipoBlog').className = "on";
	}
}

function messaggioTipo(){
	tipo = document.profiloOggi.messaggiotipo.value;
	if (tipo == "1"){
		document.getElementById('mmsImmagine').className = "off";
	}else{
		document.getElementById('mmsImmagine').className = "on";
	}
}

function messaggioTipo02(){
	tipo = document.messaggioInvio.messaggiotipo.value;
	if (tipo == "1"){
		document.getElementById('mmsImmagineBox').className = "off";
	}else{
		document.getElementById('mmsImmagineBox').className = "on";
	}
}

function checkMessage(message_value, message_type){
	
	var error_message = '';
	
	message_value = message_value.replace("\n", " ");	

    var message_validchars = "\n ABCDEFGHIJKLMNOPQRSTUVWXYZàèìòùabcdefghijklmnopqrstuvwxyz0123456789.,?!'-()@:;+&%*=[]{}\"";

	for (var i=0; i < message_value.length; i++) {	
		letter = message_value.charAt(i);		
		if (message_validchars.indexOf(letter) < 0)
		{
		    error_message = "Caracter não aceito: " + letter;	
		}          	
	}
	
	if (message_value.length == 0) {
		error_message = "Tem que escriver a mensagem da enviar";
	}	
	/*
	if (message_type == 1) {
		if (message_value.length > 120) {
			error_message = "A mensagem não pode ter mais de 120 caracteres !";
		}
	} else {
		if (message_value.length > 300) {
			error_message = "Il messaggio non deve superare i 300 caratteri !";
		}
	}
	*/
	if (message_value.length > 120) {
			error_message = "A mensagem não pode ter mais de 120 caracteres !";
		}
	return error_message;
}

function Yetii(obj,active){
    
    this.active = (active) ? active : 1,
    this.timeout = null,
    this.tabclass = 'tab',
    this.activeclass = 'active',
    
    this.getTabs = function(){
 
        var retnode = [];
        var elem = document.getElementById(obj).childNodes;     //modified for IE 5.x support
        for (var i = 0; i < elem.length; i++) {
        if (elem[i].className==this.tabclass) retnode[retnode.length]=elem[i];
        }
    
        return retnode;
    
    },
        
    this.links = document.getElementById(obj+'-nav').getElementsByTagName('a'),
    this.tabs = this.getTabs();
    
    this.show = function(number){
        
        for (var i = 0; i < this.tabs.length; i++) {
        this.tabs[i].style.display = ((i+1)==number) ? 'block' : 'none';
        this.links[i].className = ((i+1)==number) ? this.activeclass : '';
        }
    
    },
    
    this.rotate = function(interval){
    
        this.show(this.active);
        this.active++;
    
        if(this.active > this.tabs.length) this.active = 1;
    
        var self = this;
        this.timeout = setTimeout(function(){self.rotate(interval);}, interval*1000);
    
    },
    
    this.init = function(interval){
    
        this.show(this.active);
        
        var self = this; 
        for (var i = 0; i < this.links.length; i++) {
        this.links[i].customindex = i+1;
        this.links[i].onclick = function(){ if (self.timeout) clearTimeout(self.timeout); self.show(this.customindex); return false; };
        } 
        
        if (interval) this.rotate(interval);
            
    };

};


function showHide(quale)
{
	if (document.layers)
	{
		current = (document.layers[quale].display == 'block') ? 'none' : 'block';
		document.layers[quale].display = current;
	}
	else if (document.all)
	{
		current = (document.all[quale].style.display == 'block') ? 'none' : 'block';
		document.all[quale].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(quale).style.display == 'block') ? 'none' : 'block';
		document.getElementById(quale).style.display = vista;
	}
	
	if(quale == "popupModale"){
		var selects = document.getElementById("page").getElementsByTagName("select");
			for (i = 0; i != selects.length; i++) {
				if(selects[i].style.visibility == "hidden"){
					selects[i].style.visibility = "visible";
				}else{
					selects[i].style.visibility = "hidden";
				}
				
		}
	}
	
	
	
}







