//ADICIONAR AOS FAVORITOS
function addFav(){
  var url      = "http://d26848.user22.redicom-ip.net/site/";
  var title    = "Bovi";
  //alert(navigator.appName);
  if(navigator.appName=='Netscape'){
    if (window.sidebar) {
      window.sidebar.addPanel(title, url,"");
    } else {
      alert("Pressione CTRL-D (Chrome) ou CTRL-T (Opera) para adicionar aos favoritos.");
      var mbm = document.createElement('a');
      mbm.setAttribute('rel','sidebar');
      mbm.setAttribute('href',url);
      mbm.setAttribute('title',title);
      mbm.click();
    }
  } else if(document.all){window.external.AddFavorite(url, title);}
}


// AJAX

function getXmlHttpRequest() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function refresh_select(id,tipo){        
  var url ="refresh_lojas.php"; 	
  var post_data="id="+id+"&tipo="+tipo;  
  var cmsajaxhttp = getXmlHttpRequest();
      	
 	cmsajaxhttp.open("GET", url+'?'+post_data, true);
  cmsajaxhttp.onreadystatechange = function(){
		if (cmsajaxhttp.readyState==4){
			var resultado = cmsajaxhttp.responseText;
			var rs = resultado.split('||');
			
			if (rs[1]=='pais'){
        document.getElementById('tdCidades').innerHTML = rs[0];
        document.getElementById('tdLojas').innerHTML = rs[2];
        document.getElementById('morada').innerHTML = "";
      } else if (rs[1]=='cidade'){
        document.getElementById('tdLojas').innerHTML = rs[0];
        document.getElementById('morada').innerHTML = "";
      } else if (rs[1]=='loja'){
        document.getElementById('morada').innerHTML = rs[0];                
      }                  		  
            	              
		}
	}
 	cmsajaxhttp.send(null);
}

//CONTACTOS

function showhideContactos(){
  var contactos = document.getElementById('contactos');  
  
  if (contactos.style.display == "block"){
    contactos.style.display = "none";
  } else if (contactos.style.display == "none"){
    contactos.style.display = "block";    
  } else {
    contactos.style.display = "block";
  }  
    
}

//ESCREVER NOME COLECÇÂO

function writteColection(texto){  
  document.getElementById('titColection').innerHTML = texto;
  RenderSpecialTTFH();  
}

function hideColName(){
  document.getElementById('titColection').style.display = "none";
}

//RENDER FONTS

function RenderTTFH(){

   DATAFUNCS.RenderFonts('menuPrincipalX',{ 
       fontSize         : '13.50',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/estasmac.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('menuPrincipalXX',{ 
       fontSize         : '10.50',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/esta.ttf',
       transparent      : '1'
    });  
    
    DATAFUNCS.RenderFonts('subMenuPrincipalX',{ 
       fontSize         : '9.75',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/esta.ttf',
       transparent      : '1'
    });  
    
    DATAFUNCS.RenderFonts('menuRodapeX',{ 
       fontSize         : '8.25',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/estabold.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('menuRodapeXX',{ 
       fontSize         : '13.50',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/estasmac.ttf',
       transparent      : '1'
    }); 
    
    DATAFUNCS.RenderFonts('tituloRub',{ 
       fontSize         : '12',
       backgroundColor  : 'ABB8C2',
       color            : 'FFFFFF',
       fontFile         : 'fonts/estaital.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('linkIntro',{ 
       fontSize         : '10.50',
       backgroundColor  : 'FFFFFF',
       color            : 'ABB8C2',
       fontFile         : 'fonts/estasmac.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('txtForms',{ 
       fontSize         : '9',
       backgroundColor  : 'ABB8C2',
       color            : 'FFFFFF',
       fontFile         : 'fonts/esta.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('tituloRub2',{ 
       fontSize         : '12',
       backgroundColor  : 'FFFFFF',
       color            : '8497A0',
       fontFile         : 'fonts/estaital.ttf',
       transparent      : '1'
    });
    
                                                   
}

function RenderSpecialTTFH(){

  DATAFUNCS.RenderFonts('titColection',{ 
       fontSize         : '11.25',
       backgroundColor  : 'FFFFFF',
       color            : '546F7C',
       fontFile         : 'fonts/estasmac.ttf',
       transparent      : '1'
    });
    
  document.getElementById('titColection').style.display = "block";
    
}

function checkScroll(){
  var containerScroll = document.getElementById('scrollCount'); 
  var scrollBars = document.getElementById('Scrollbar-Container');      
  if (containerScroll.clientHeight <= 430){        
    scrollBars.style.display = "none";
  } else {
    var scroller = null;
    var scrollbar = null;
    window.onload = function () {
    scroller = new jsScroller(document.getElementById("Scroller-1"), 387, 416);
    scrollbar = new jsScrollbar (document.getElementById("Scrollbar-Container"), scroller, false);
}
  }
}