/*
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

 var inici='<b>Inici</b>';
 var prc='<b>Presentació IDEC</b>';
 var qsf='<b>Qui som què fem</b>';
 var sg01='<b>Què és una Infraestructura de Dades Espacials?</b>';
 var sg02='<b>Perquè us pot interessar?</b>';
 var sg03='<b>Què es pot trobar en aquest geoportal?</b>';
 var sg04='<b>Indicadors de l\'evolució de la IDEC.</b>';
 var sg05='<b>Dades estadístiques de l\'activitat del C.S.IDEC.</b>';
 var sg06='<b>Documentació</b>';
 var sg07='<b>Notícies</b>';
 var sg08 ='<b>Enllaços</b>';
 var sg09 ='<b>MetaD</b>';
 var sg10='<b>Geoserveis IDEC</b>';
 var sg11='<b>Connector de Catàlegs (OGC-CSW)</b>';
 var sg12='<b>IDE Sectorials</b>';
 var sg13='<b><u>Presentació</u><b>';
 var sg14='<b>IDEC Local</b>';
 var sg15='<b>IDE Univers</b>';
 var sg16='<b>IDEC Litoral (en construcció)</b>';
 var urlWS='http://delta.icc.es/idecwebservices/index.html';
 var sg17='Enllaç a la pàgina';
 
 if(idioma=="en"){
 
 inici='<b>Home</b>';
 prc='<b>IDEC Presentation</b>';
 qsf='<b>Who we are, and what we do.</b>';
 sg01='<b>What a Spatial Data Infrastructure is?</b>';
 sg02='<b>Why might you be interested?</b>';
 sg03='<b>What can you find in this geo-portal?</b>';
 sg04='<b>Indicators of the IDEC\'s evolution.</b>';
 sg05='<b>Statistical data from the C.S.IDEC\'s activities.</b>';
 sg06='<b>Documentation</b>';
 sg07='<b>News</b>';
 sg08 ='<b>Links</b>';
 sg09 ='<b>MetaD</b>';
 sg10='<b>Web Services</b>';
 sg11='<b>Catalog Connector (OGC-CSW)</b>';
 sg12='<b>Thematic SDI</b>';
 sg13='<b><u>Presentation</u><b>';
 sg14='<b>IDEC Local</b>';
 sg15='<b>IDE Univers</b>';
 sg16='<b>IDEC Litoral (under construction)</b>';
 urlWS='http://delta.icc.es/idecwebservices/indexeng.html';
 sg17='Link to page';
 
 }else if (idioma=="es"){
 inici='<b>Inicio</b>';
 prc='<b>Presentación IDEC</b>';
 qsf='<b>Quienes somos y que hacemos</b>';
 sg01='<b>¿Que es una Infraestructura de Datos Espaciales?</b>';
 sg02='<b>¿Por qué os puede interesar?</b>';
 sg03='<b>¿Que se puede encontrar en este Geoportal?</b>';
 sg04='<b>Indicadores de la evolución de la IDEC.</b>';
 sg05='<b>Datos estadísticos de la actividad del C.S. IDEC.</b>';
 sg06='<b>Documentación</b>';
 sg07='<b>Notícias</b>';
 sg08 ='<b>Enlaces</b>';
 sg09 ='<b>MetaD</b>';
 sg10='<b>Geoservicios IDEC</b>';
 sg11='<b>Conector de Catálogos (OGC-CSW)</b>';
 sg12='<b>IDE Sectoriales</b>';
 sg13='<b><u>Presentación</u><b>';
 sg14='<b>IDEC Local</b>';
 sg15='<b>IDE Univers</b>';
 sg16='<b>IDEC Litoral (en construcción)</b>';
 urlWS='http://delta.icc.es/idecwebservices/indexcas.html';
 sg17='Enlace a la página';
 }
 
 
    Ext.onReady(function(){
    
   // Ext.QuickTips.init();
   
    var tb = new Ext.Toolbar();
   
    tb.render('toolbar');
   
    tb.add(
    
    {
        text: inici,
        
        //enableToggle: true,
        handler: onItemClick,
        id:'home.jsp'
        //pressed: true
    },
    '-',
    
    {
            text:prc,
             //handler: onMenuClick,
             id:'presentacio.jsp',
            //iconCls: 'bmenu',  // <-- icon
            menu: {items: [
                        {text: qsf, handler: onItemClick,id:'quequi.html'},
                        {text: sg01, handler: onItemClick,id:'projecteidec.html'},
                        {text: sg02, handler: onItemClick,id:'interessar.html'},
                        {text: sg03, handler: onItemClick,id:'trobar.html' },
                        {text: sg04, handler: onItemClick,id:'indicadors.html' },
                    {text: sg05, handler: onItemClick,id:'activitats.html' }
                ]}
        }, '-',
        {
            text: sg06,
            handler: onItemClick,
             id:'documentacio.jsp'
            //tooltip: {text:'This is a an example QuickTip for a toolbar item', title:'Tip Title'},
           // iconCls: 'blist',
            // Menus can be built/referenced by using nested menu config objects
           
        }, '-', {
         text: sg07,
            handler: onItemClick,
             id:'noticies.jsp'
            //tooltip: {text:'This is a an example QuickTip for a toolbar item', title:'Tip Title'},
            //iconCls: 'blist',
            // Menus can be built/referenced by using nested menu config objects
    },
    '-',
    
    {
           text: sg08,
             handler: onItemClick,
             id:'links.jsp'
            //tooltip: {text:'This is a an example QuickTip for a toolbar item', title:'Tip Title'},
            //iconCls: 'blist',
            // Menus can be built/referenced by using nested menu config objects
        }, 
        
        '-',
    
    {
           text: sg09,
            handler: onItemClick,
             id:'metad.jsp'
            //tooltip: {text:'This is a an example QuickTip for a toolbar item', title:'Tip Title'},
           // iconCls: 'blist',
            // Menus can be built/referenced by using nested menu config objects
        }, 
    '-',
   {
            text:sg10,
           // iconCls: 'bmenu',  // <-- icon
            menu: {items: [
                        {text: sg11, handler: onItemClick,id:'catalogconnector.html'},
                        {text: '<b>Web Processing Service (OGC-WPS)</b>', handler: onItemClick,id:'wps.html'},
                        {text: '<b>Web Services (WS-I)</b>', handler: onItemClick,id:urlWS}
                      
                       
                       
                ]}
        }, 
    '-',
   {
   
   
            text:sg12,
            //iconCls: 'bmenu',  // <-- icon
            menu: {items: [
                        {text: sg13, handler: onItemClick,id:'idesectorial.jsp'},
                        {text: sg14, handler: onItemWClick,id:'http://www.geoportal-idec.cat/idelocal'},
                        {text: sg15, handler: onItemWClick,id:'http://www.geoportal-idec.cat/ideunivers/local.jsp?lang='+idioma},
                        {text: sg16, handler: onItemWClick,id:'http://www.geoportal-idec.cat/idecostes/'}
                       
                ]}
        }
    
    
    
    
    
    );


	 

   
   

   

    // functions to display feedback
    function onButtonClick(btn){
        Ext.example.msg('Button Click','You clicked the "{0}" button.', btn.text);
    }

    function onItemWClick(item){
    //document.location.target="_BLANK";
    //document.location.href=item.id;
window.open(item.id);
    }
    
    function onMenuClick(item){
   
     document.location.href="inici.jsp?pag="+item.id;
     
        }//
    
    function onItemClick(item){

     document.getElementById("contingutFrame").src=item.id;
     
        }//

    function onItemCheck(item, checked){
        Ext.example.msg('Item Check', 'You {1} the "{0}" menu item.', item.text, checked ? 'checked' : 'unchecked');
    }

    function onItemToggle(item, pressed){
        Ext.example.msg('Button Toggled', 'Button "{0}" was toggled to {1}.', item.text, pressed);
    }

});


function slikn(idio){

 surto=false;
 var uu;
var ref=document.location.href;

if(ref.indexOf('?')==-1){ref=ref+'?';}else{ref=ref.substring(0,ref.indexOf('?')+1);}

var p0=document.getElementById('contingutFrame').src;

if (p0.lastIndexOf('/') !=-1){

    firstpos=p0.lastIndexOf('/')+1;
    lastpos=p0.length;
    var pag=p0.substring(firstpos,lastpos);
   
    uu=ref+"pag="+pag;

}else{

uu=ref+"pag="+p0;
}


var oldId="/"+idioF;
var newId="/"+idio;

        if(idio=="0"){
         var enter=prompt(sg17,uu);
        

        }else{
       
        
        uu=uu.replace(oldId,newId);
       
        document.location.href=uu;

        }




}