
//DESCRIPTION:  retorna un nombre aleatòri comprès entre el 'numero1' i el 'numero2' (ambdos inclòsos)
function nombreAleatori(a,b){
//generel el nombre aleatòri
num = Math.random();

//Calculem quin dels dos és el valor minim
if (eval(a) > eval(b))
 {
   minim=eval(b);
   maxim=eval(a);
 }
 else
 {
  minim=eval(a);
  maxim=eval(b);
 }

//Ajustem el valor aleatòri inicial perquè estigui compres entre els dos nombres donats
num = minim + ( num * ( maxim - minim ) );

//passem aquest nombre a un enter tot arrodonint-lo
num = Math.round(num);

return(num);
}

//DESCRIPTION:  Funcións Macromedia
function MM_showHideLayers() 
{ 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }	
}

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;
}

//DESCRIPTION:  Funció que obre una nova finestra amb el copyright de l'Ajuntament de Barcelona.
function obreCopyright(sIdioma)
{  
  var sURL = "";
  if (sIdioma=="ES") { sURL = 'http://www.bcn.es/castella/copyright/welcome2.htm'; }
  else if (sIdioma=="EN") { sURL = 'http://www.bcn.es/english/copyright/welcome2.htm'; }
  else { sURL = 'http://www.bcn.es/catala/copyright/welcome2.htm'; }
  var wFinestraCopyRight = window.open(sURL,'pagCopyRight','resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,width=780,height=355,left=5,top=80');
}

//DESCRIPTION:  Funció que obre una nova finestra amb un formulari per contactar amb el web master
function obrirContacteHome(sIdioma)	
{
  var sURL = "";  
  if (sIdioma=="ES") { sURL = 'http://www.bcn.es/castella/ecorreu_web_master.htm'; }
  else if (sIdioma=="EN") { sURL = 'http://www.bcn.es/english/icorreu_web_master.htm'; }
  else { sURL = 'http://www.bcn.es/catala/ccorreu_web_master.htm'; }  
  var wFinestraWebMaster = window.open(sURL,'pagWebMaster','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=531,height=480,left=5,top=35');
}

//DESCRIPTION:  Funció que obre una nova finestra per la retransmissió del ple.
function obrirRetransmissio(sIdioma)
{	
	var sURL = "http://streamstudio.unit.net/loginCheck.asp?ticket=55$81$2616&lang=";
	if (sIdioma == 'CA') sURL += "ca";
	else sURL += "es";
	var wPle = window.open(sURL,'Webcast','width=600,height=400,top=50,left=50,locationbar=no,menubar=no,resizable=no',true); 
}
//DESCRIPTION:  Obre una finestra, tipo Pop-up
function obrePopup(sURL,anMesura){
	var anPos_final = new Array();
    anPos_final[0] = (screen.availWidth - anMesura[0]) / 2;
    anPos_final[1] = (screen.availHeight - anMesura[1]) / 2;
	var sParam = 'toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no,width='+anMesura[0]+',height='+anMesura[1]+',left='+anPos_final[0]+',top='+anPos_final[1];
    var wPopup = window.open(sURL,"finestra",sParam);
}
//DESCRIPTION:  Obre una finestra, tipo Pop-up General
function obrePopupGeneral(sURL, iWidth, iHeight){
	var anPos_final = new Array();
    var iWidthAux = (screen.availWidth - iWidth) / 2;
    var iHeightAux = (screen.availHeight - iHeight) / 2;
	var sParam = 'toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no,width='+iWidth+',height='+iHeight+',left='+iWidthAux+',top='+iHeightAux;
    var wPopup = window.open(sURL,"finestra",sParam);
}