// StdUOC
//   Funcions estandar per la UOC

CLOSE_WINDOW='Cerrar ventana';

function getWinNm() {
// Genera un nom de finestra per a poder-ne obrir més d'una
///////////////////////////////////////////////////////////
  var now = new Date();
  var hr = new String(now.getHours());
  var mn = new String(now.getMinutes());
  var sc = new String(now.getSeconds());
  var winNm = hr + mn + sc;
  return winNm;
}

function oWin(adr, x, y) {
// Obre una finestra nova amb els paràmetres passats o per defecte.
//////////////////////////////////////////////////////////////////
/* Exemples de crida
adr             oWin('blanc.htm')
adr,x,y         oWin('blanc.htm', '100', '100')
*/

  var nargs = new Number(arguments.length);
  var xdef = new String('600');
  var ydef = new String('350');

  if(nargs<3) {
    x = new String(xdef);
    y = new String(ydef);
  }

  var messWin = window.open(adr,getWinNm(),'width='+ x + ',height=' + y + ',menubar=yes,resizable=yes,scrollbars=yes,status=no');
}

// funció creada per fsantanach
function widthFinestra() {
var app=navigator.appName.substring(0,1);
var w = 0;
if (app == 'N') {
    w = window.innerWidth - 20
}
else if (app == 'M') {
    w='100%'
}


return w;
}

function style()
{
 return '<link rel="stylesheet" type="text/css" media="screen" href="css/styleICV.css">';
}
 
// funció creada per fsantanach
function dialegUOC(linia, plinia, slinia)
{
  var htm='';
  htm+='<table width="' + widthFinestra() + '" border="0" cellpadding="0" cellspacing="1" bordercolor="white">\n';
 // htm+='<tr><td rowspan="2" class="bg1" width=100><img src="img/top.jpg" border="0"></td>\n';
  htm+='<tr><td rowspan="2" class="bg1" valign="center" align="center" width=40 nowrap>&nbsp;<span class="fnt152b">' + linia + '</span>&nbsp;</td>\n';
  htm+='<td class="bg1" nowrap width="' + (widthFinestra()- 130) + '">'; 
  htm+='<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td align="left" width="1%"></td>\n';
  htm+='<td align="left" class="bg1"><span class="fnt111b">'+ plinia +'</span></td></td>\n';
  htm+='<td align="right"><table border="0" cellspacing="0" cellpadding="0"><tr>';
  htm+='<td><a class="fnt111" href="javascript:top.window.close()" onMouseOver="mouseOver(\'' + CLOSE_WINDOW + '\');return true" onMouseOut="mouseOut();return true">' + CLOSE_WINDOW + '</a></td>';
  htm+='<td><a href="javascript:window.close()" onMouseOver="mouseOver(\''+CLOSE_WINDOW +'\');return true" onMouseOut="mouseOut();return true"><img align="bottom" src="img/tanca_fines.gif" width="17" height="20" border="0" ALT="' + CLOSE_WINDOW +'"></a></td>';
  htm+='</tr></table></td></tr></table>';
  htm+='</tr><tr><td width="' + (widthFinestra()- 130) + '" nowrap class="bg1"><span class="fnt111b">&nbsp;&nbsp;' + slinia + '</span></td></tr>\n';
  htm+='</table>';
  return htm;	
}

function foto(foto,texto)
{
  return '<A HREF="javascript:oWin(\'img/'+foto+'\')" onMouseOver="self.status=\''+texto+'\';return true" onMouseOut="self.status=\'\';return true" class="fnt111"><IMG SRC="img/S_'+foto+'" ALT="'+texto+'" BORDER=0><BR>'+texto+'</A><P>';
}


// funció creada per fsantanach
function botoUOC(texte, accio)
{
  var htm='';
  htm+='<table border="0" cellpadding="0" cellspacing="0"><tr><td class="bg2">';
  htm+='<table border="0" cellpadding="0" cellspacing="1"><tr><td class="bg0">';
  htm+='<table border="0" cellpadding="0" cellspacing="1" border="0"><tr><td class="bg2">';
  htm+='&nbsp;<a class="fnt112s" href="'+ accio +'" onMouseOver="mouseOver(\''+ texte + '\');return true" onMouseOut="mouseOut();return true">' + texte +'</a>&nbsp;';
  htm+='</td></tr></table>';
  htm+='</td></tr></table>';
  htm+='</td></tr></table>';
  return htm;
}


function botoUOCbold(texte, accio)
{
  var htm='';
  htm+='<table border="0" cellpadding="0" cellspacing="0"><tr><td class="bg2">';
  htm+='<table border="0" cellpadding="0" cellspacing="1"><tr><td class="bg0">';
  htm+='<table border="0" cellpadding="0" cellspacing="1" border="0"><tr><td class="bg2">';
  htm+='&nbsp;<a class="fnt112s" href="'+ accio +'" onMouseOver="mouseOver(\''+ texte + '\');return true" onMouseOut="mouseOut();return true">' + texte +'</a>&nbsp;';
  htm+='</td></tr></table>';
  htm+='</td></tr></table>';
  htm+='</td></tr></table>';
  return htm;
}

function mouseOver(banner)
{
self.status=banner;
}

function mouseOut()
{
self.status="";
}

