$(function() {
        $('#container-1 > ul').tabs();
	$("#header_img").css({backgroundImage:"url(http://www.upf.edu/bibtic/_img/portada/portada_" + ranimage() + ")"});        					  		  
});

function enviar_bases() {
	if (document.form1.menu1.selectedIndex > 0) {
		document.location.href=document.form1.menu1.options[document.form1.menu1.selectedIndex].value;
	}
}

function enviar_sfx(){
 var textSearchType;
 for (i=0;i<document.consulta3.param_textSearchType_value.length;i++){
  if (document.consulta3.param_textSearchType_value[i].checked==true){
   textSearchType=document.consulta3.param_textSearchType_value[i].value;
   break;
  }
 }
 document.location.href="http://sfx.cbuc.cat/upf/az/default?param_lang_save="+document.consulta3.param_lang_save.value+"&param_perform_value=searchTitle&param_jumpToPage_value=&param_type_value=textSearch&param_chinese_checkbox_active=1&param_pattern_value="+encodeURIComponent(document.consulta3.param_pattern_value.value)+"&param_chinese_checkbox_value=0&param_textSearchType_value="+textSearchType;
}

function enviar_cataleg(idioma,autor,titol,materia){
 var textSearchType;
 for (i=0;i<document.consulta1.param_textSearchType_value.length;i++){
  if (document.consulta1.param_textSearchType_value[i].checked==true){
   textSearchType=document.consulta1.param_textSearchType_value[i].value;
   break;
  }
 }
 if (textSearchType == "upf")
 {
	document.location.href="http://cataleg.upf.edu/search*"+idioma+"/"+document.consulta1.searchtype.value+"?"+encodeURIComponent(document.consulta1.searcharg.value);
 }
 if (textSearchType == "ccuc")
 {
	//document.location.href="http://ccuc.cbuc.cat/search*"+idioma+"/"+document.consulta1.searchtype.value+"?"+encodeURIComponent(document.consulta1.searcharg.value);
	//document.location.href="http://cbueg-mt.iii.com/iii/encore/search/C|S"+encodeURIComponent(document.consulta1.searcharg.value)+"?lang="+idioma;
	if (document.consulta1.searchtype.value=="X") document.location.href="http://cbueg-mt.iii.com/iii/encore/search/C%7CS"+encodeURIComponent(document.consulta1.searcharg.value)+"%7COrightresult?lang="+idioma+"&suite=def";
	if (document.consulta1.searchtype.value=="a") document.location.href="http://cbueg-mt.iii.com/iii/encore/search/C%7CS"+encodeURIComponent(document.consulta1.searcharg.value)+"%7CFf%3Afacetfields%3Aauthor%3Aauthor%3A"+autor+"%3A%3A%7COrightresult?lang="+idioma+"&suite=def";
	if (document.consulta1.searchtype.value=="t") document.location.href="http://cbueg-mt.iii.com/iii/encore/search/C%7CS"+encodeURIComponent(document.consulta1.searcharg.value)+"%7CFf%3Afacetfields%3Atitle%3Atitle%3A"+titol+"%3A%3A%7COrightresult?lang="+idioma+"&suite=def";
	if (document.consulta1.searchtype.value=="d") document.location.href="http://cbueg-mt.iii.com/iii/encore/search/C%7CS"+encodeURIComponent(document.consulta1.searcharg.value)+"%7CFf%3Afacetfields%3Asubject%3Asubject%3A"+materia+"%3A%3A%7COrightresult?lang="+idioma+"&suite=def";
 }
}

function enviar_metalib(idioma)
{
document.location.href="http://metalib.cbuc.cat/V/?func=quick-1-check1&new_lng="+idioma+"&mode=simple&find_request_1="+encodeURIComponent(document.consulta.cerca_art.value)+"&group_number="+document.consulta.searchtype.value+"&url=http://metalib.cbuc.cat/pds?func=sso&institute=UPF&calling_system=metalib&url=http://metalib.cbuc.cat/V/?func=change-portal-1&portal-name=UPF";
return;
}

function esborra(formulari)
{
	formulari.searcharg.value = "";
}

function esborra_web(formulari)
{
	formulari.q.value = "";
}

function esborra_articles(formulari)
{
	formulari.cerca_art.value = "";
}

function esborra_revistes (formulari)
{
 formulari.param_pattern_value.value = "";
} 

function enviar_repositoris()
{
	document.location.href="http://www.google.com/cse?cx="+encodeURIComponent(document.consulta5.cx.value)+"&ie="+document.consulta5.ie.value+"&hl="+document.consulta5.hl.value+"&q="+encodeURIComponent(document.consulta5.q.value);
}

function enviar_cercador(){
 var textSearchType;
 for (i=0;i<document.consulta6.param_textSearchType_value.length;i++){
  if (document.consulta6.param_textSearchType_value[i].checked==true){
   textSearchType=document.consulta6.param_textSearchType_value[i].value;
   break;
  }
 }
 if (textSearchType == "bibtic")
 {
	document.location.href="http://cercador.upf.edu/search?q="+document.consulta6.q.value+"&ServerKey=p&ResultTemplate=&Theme=&Company=&action=&filter=&sourcequerytext=&redireccio=&idioma=cat_frontend&aux_QueryMode=AND&site=bib_collection&access=p&client=cat_frontend&proxystylesheet=cat_frontend&output=xml_no_dtd&oe=ISO-8859-1&ie=ISO-8859-1";
 }
 if (textSearchType == "google")
 {
	document.location.href="http://www.google.es/search?q="+document.consulta6.q.value;
 }
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

<!--
// Imagen Random ( hay que aumentar en +1 cada nueva donde pone NEW

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

image = new StringArray(22) // New 'sumar +1' Sempre és un més que el nombre d'imatges que tenim a _img/portada
image[0] = '01.gif'
image[1] = '01.gif' //Noteu que 01.gif està repetida
image[2] = '02.gif'
image[3] = '03.gif'
image[4] = '04.gif'
image[5] = '05.gif'
image[6] = '06.gif'
image[7] = '07.gif'
image[8] = '08.gif'
image[9] = '09.gif'
image[10] = '10.gif'
image[11] = '11.gif'
image[12] = '12.gif'
image[13] = '13.gif'
image[14] = '14.gif'
image[15] = '15.gif'
image[16] = '16.gif'
image[17] = '17.gif' 
image[18] = '18.gif'
image[19] = '19.gif'
image[20] = '20.gif'
image[21] = '21.gif'
// Afegir aquí línia nova   image[nn] = 'nn.gif'

function ranimage() {
	var rand_no = Math.random();
	rand_no = rand_no * 21; // New 'sumar +1' Coincideix amb el total d'imatges reals q tenim dins de _img/portada
	rand_no = Math.ceil(rand_no);
	return(image[rand_no])
}
//-->
