//fons Cuyas i Sace
function Init(){

//var formulari=document.forms[1].name;

    var source=document.geograficaMunicipioForm.varpbl;

comboboxOptions = [];
     for(i = 0; i < source.options.length; i++){
          comboboxOptions[i] = new Option(source.options[i].text,source.options[i].value)}

}

//fons Cuyas i Sace
function cerca_mots(crit,list){

     var cind = 0;
     var list = list.options;
     list.length = 0;
     for(i =  0; i < comboboxOptions.length; i++)
     {
          if(comboboxOptions[i].text.toLowerCase().indexOf(crit.toLowerCase()) == 0)
          {
               list[cind] = comboboxOptions[i];
               cind++;
          }
     }
     if(list.length != 0) list.selectedIndex = 0;
}

//cartoteca digital. mapes municipals
function changeimg(){
    param = document.geograficaMunicipioForm.municipi.value;
		img = 'http://shagrat.icc.es/lizardtech/iserv/calcrgn?cat=minutes25k&item=' + param +'.sid&wid=420&hei=400&style=default/view.xsl';
    finestra = window.open(img,'minuta','scrollbars=no,location=no,width=500,height=520');
    finestra.focus();
}
//funcio per Cartoteca. Series cartografiques del mon
function obrirSeriesMon(theURL) {

var win =window.open(theURL,"","scrollbars=yes,resizable=yes");

}

function warp(){
    window.location=document.form1.select.options[document.form1.select.selectedIndex].value;
}

/** Atlantida  */
function submitAtlantida() {
 x =document.getElementById("formAtlantida");
 strUrl="";
 if (x.zonaAutor.selectedIndex == 0) {
	//zona selected
	strUrl="zona.php?zona=" + x.strAtlantida.value + "&Submit=Enviar";
 } else {
	strUrl="autor.php?autor=" + x.strAtlantida.value+ "&Submit3=Enviar";
 }

 if (strUrl != "") {
		window.open("/web/content/php/biblio/" + strUrl, "atl");
}
}
function canviaAction() {
 x =document.getElementById("formAtlantida");

 if (x.zonaAutor.selectedIndex == 0) {
	//zona selected
	x.action ="/web/content/php/biblio/zona.php";
	x.zona.value= x.strAtlantida.value;
 } else {
	x.action ="/web/content/php/biblio/autor.php";
	x.autor.value= x.strAtlantida.value;
 }
}

/** VTLS  */
function submitVtls() {
 x =document.getElementById("formVtls");
 strUrl="";
 strSearch = x.searchtype[x.searchtype.selectedIndex].value;
 if (strSearch !="") {
	strUrl += "searchtype=" + strSearch;
 }
 if (x.searcharg.value !="") {
 	strUrl += "&searcharg=" + x.searcharg.value;
 }
 window.open("/cgi-bin/vtls.web.gateway?" + strUrl + "&lang=catalan", "vtls");

}

function Init() {

	//var formulari=document.getElementById("formAtlantida").name;
    var source=document.geograficaMunicipioForm.varpbl;

	comboboxOptions = [];
	
	for(i = 0; i < source.options.length; i++){
		comboboxOptions[i] = new Option(source.options[i].text,source.options[i].value)
	}
	     
}

function cerca_mots(crit,list){

     var cind = 0;
     var list = list.options;
     list.length = 0;
     for(i =  0; i < comboboxOptions.length; i++)
     {
          if(comboboxOptions[i].text.toLowerCase().indexOf(crit.toLowerCase()) == 0)
          {
               list[cind] = comboboxOptions[i];
               cind++;
          }
     }
     if(list.length != 0) list.selectedIndex = 0;
}
	
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function validarFormCarto(){
 x =document.getElementById("formAtlantida");
if(x.t1.value == '') 
{ 	alert('Si us plau, introdueix un terme de cerca a la casella.'); 
	x.t1.focus(); 
	return false; } 
else if(x.t1.value == '*') 
{ 	
	alert('Si us plau, no comencis la cerca amb cap comod&iacute;'); this.t1.focus(); 
	return false; 
}
}

